Version 13 of Emacs

Updated 2003-05-09 15:07:45

Purpose: to discuss the EMACS editing environment.---- An Oustervote in 2001 concluded that emacs [L1 ] remains the single most widely-used programming editor among Tcl practitioners, although all vi variants together appear to sum to a larger total.


[Where does one go to find Emacs? What about Emacs on MacOS or Windows?] Is there more than one program that is emacs?

Where to get Emacs:

  • GNU Emacs can be downloaded at [L2 ]
  • Xemacs can be picked up at [L3 ]

MacOS and Windows:

  • Both GNU Emacs and Xemacs are available for Windows. See same locations for details.

Quite a bit of available elisp implements functionality useful to Tcl coders, including syntax highlighting, ...


Just drop elisp specific items into the elisp page, mentioned above.


Ok, I'm not really in tune with wiki writing style, so I'll just dump stuff here (davidw):

  1. The biggest problem is a good tcl-mode for emacs. Both gnumacs and xemacs have some problems with comments, braces, and so on. Any suggestions?
  2. A little bitty bit of elisp, that looks up tcl man pages can be found on the elisp page.

It is true, that some details of the standard tcl-mode of emacs (I'm talking about GNU emacs, don't know much about Xemacs) could profit of a little bit work by an elisp guru. For example, I'm not that happy with the standard highlight regexp's. I use instead Donal Fellows highlighting code from http://www.cs.man.ac.uk/~fellowsd/tcl/#fontlock . And there are other, mostly minor problems.

That said, the tcl-mode has some very nice features, that really ease your work, if you are an emacs addict, like me. Have you ever have debugged a tk application? It's very easy to start the whole script from inside emacs (with the tcl mode command tcl-send-buffer, by default bound to C-c M-a). Now you click through your GUI, filling in data here and there. Then you click, let's say, a button, and you have to realize, that there is an error in the command bound to that button. Tk's error message may give you the reason, what's going wrong or at least an idea what debugging 'puts' to insert, to get more insight. Normally, this means exit your application, edit the code, restart your application, click through the GUI again, fill in the necessary data here and there and then you reach the point of interest again.

Not so, if you have started your applicatiom from emacs tcl mode. Don't exit your application, after you have encountered the error. Just edit the according proc (and fill some debugging puts in it, if you feel the needs, you will see the output in a special emacs buffer) and send the changed proc with tcl-send-buffer (per default bound to C-c M-a) to the running interpreter. Now - without restarting the application and clicking through again - just retry the malicious GUI action that has triggered the error before and see the outcome. (Of course, this is only possible due to the dynamic nature of tcl, and is not special to the emacs tcl mode. Emacs tcl mode only makes it very easy to use this tcl feature.) de.


In comp.lang.tcl, Bob Techentin writes the following to someone asking how to write Tcl code in Emacs and get the emacs syntax helps, etc.:

Start emacs. Open a file (new or existing) with a .tcl extension, and you should get Tcl mode automatically. If you don't get Tcl mode (perhaps because your file does not have the .tcl extension), use the m-x-tcl-mode command. One emacs trick to exploit is to put the magic code "-*-Tcl-*-" into one of the first lines of the file, so it always is recognized as Tcl source code. Start with a couple of lines like:

  #! /bin/sh
  #                          this is a -*-Tcl-*- file

Once you've got emacs running in Tcl mode, just type. Use file-save (or ctr-x-ctrl-s) to write the buffer to a file. Then it should run fine. If your Tcl code is a web page, then you would probably click "refresh".


Category Application | Category Dev. Tools |