home *** CD-ROM | disk | FTP | other *** search
- Organization: Freshman, MCS general, Carnegie Mellon, Pittsburgh, PA
- Path: sparky!uunet!cis.ohio-state.edu!news.sei.cmu.edu!bb3.andrew.cmu.edu!crabapple.srv.cs.cmu.edu!andrew.cmu.edu!dw3u+
- Newsgroups: comp.lang.tcl
- Message-ID: <kfMDALO00aw6I8z2IL@andrew.cmu.edu>
- Date: Sat, 23 Jan 1993 02:26:15 -0500
- From: "Daniel C. Wang" <dw3u+@andrew.cmu.edu>
- Subject: help with regsub
- Lines: 32
-
-
- Ok I'm trying to intereface tcl, with a process that was designed to
- send elisp commands to and emacs buffer via a pipe. I have everything
- set up, but I need some help converting elisp statements to something
- that tcl can eval.
-
- The elisp forms that the process returns are like
-
- (~bat-foo-do-this arg arg arg)
-
- I need some simple code that will converent this to a function that
- tcl can call as command right now this is what
-
- proc lisp_convert {str} {
- regsub "\{[string trim "$str" "(~)"]\}"
- }
-
- which should retrun
-
- {bat-foo-do-this arg arg arg}
-
- I just pass this to an eval statement and define the appropiate
- command. Unfortuantly I think tcl gets confused with the '-' in the
- command name, so I need some help with a regsub statement that will
- convert the elisp command to
-
- {bat_foo_do_this arg arg arg}
-
- I could just replace the '-' with a '_' but there is always a
- possibility of that there are '-' in the arguments of the elisp. So
- can someone provide me with a regsub that only replaces the '-' with
- a '_' only for the command name????
-