home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / tcl / 2466 < prev    next >
Encoding:
Text File  |  1993-01-23  |  1.4 KB  |  42 lines

  1. Organization: Freshman, MCS general, Carnegie Mellon, Pittsburgh, PA
  2. Path: sparky!uunet!cis.ohio-state.edu!news.sei.cmu.edu!bb3.andrew.cmu.edu!crabapple.srv.cs.cmu.edu!andrew.cmu.edu!dw3u+
  3. Newsgroups: comp.lang.tcl
  4. Message-ID: <kfMDALO00aw6I8z2IL@andrew.cmu.edu>
  5. Date: Sat, 23 Jan 1993 02:26:15 -0500 
  6. From: "Daniel C. Wang" <dw3u+@andrew.cmu.edu>
  7. Subject: help with regsub
  8. Lines: 32
  9.  
  10.  
  11. Ok I'm trying to intereface tcl, with a process that was designed to
  12. send elisp commands to and emacs buffer via a pipe.  I have everything
  13. set up, but I need some help converting elisp statements to something
  14. that tcl can eval.
  15.  
  16. The elisp forms that the process returns are like
  17.  
  18. (~bat-foo-do-this arg arg arg)
  19.  
  20. I need some simple code that will converent this to a function that
  21. tcl can call as command right now this is what 
  22.  
  23. proc lisp_convert {str} {
  24.          regsub "\{[string trim "$str" "(~)"]\}"
  25. }
  26.  
  27. which should retrun
  28.  
  29. {bat-foo-do-this arg arg arg}
  30.  
  31. I just pass this to an eval statement and define the appropiate
  32. command. Unfortuantly I think tcl gets confused with the '-' in the
  33. command name, so I need some help with a regsub statement that will
  34. convert the elisp command to
  35.  
  36. {bat_foo_do_this arg arg arg}
  37.  
  38. I could just replace the '-' with a '_' but there is always a
  39. possibility of that there are '-' in the arguments of the elisp.  So
  40. can someone provide me with a regsub that only replaces the '-' with
  41. a '_' only for the command name????
  42.