Xref: utzoo gnu.emacs:3836 comp.emacs:9057 Path: utzoo!utgpu!watserv1!watmath!uunet!tut.cis.ohio-state.edu!pt.cs.cmu.edu!a.gp.cs.cmu.edu!shivers From: shivers@a.gp.cs.cmu.edu (Olin Shivers) Newsgroups: gnu.emacs,comp.emacs Subject: CMU process modes, release 2.01 (1/5) Keywords: comint, cmushell Message-ID: <10452@pt.cs.cmu.edu> Date: 12 Sep 90 20:49:35 GMT Organization: Carnegie-Mellon University, CS/RI Lines: 295 This message is broken into 5 parts so notesfiles sites can handle it: 1. The 2.01 release notes (this msg) 2. The source for comint.el 3. A shar file for cmushell.el and tea.el 4. A shar file for cmulisp.el and cmuscheme.el 5. A shar file for background.el and cmutex.el ------------------------------------------------------------------------------- I am posting release 2.01 of the CMU process modes. These are a suite of gnu-emacs packages for running various command interpreters in buffers. They are all built on top of a single base mode (comint mode) that provides a consistent set of base functionality and keybindings. These modes have the following advantages: - Input history is kept in all modes, traversed with M-p and M-n, just like on LispM's and various fancy shells. - Filename completion and query is available in all modes. - Keybindings are cross-compatible among all modes. - Keybindings are compatible with Zwei and Hemlock. - Directory tracking is more robust in shell mode, and is *only* active in shell mode. (Try entering "cd /" to an inferior lisp in the old package: Lisp barfs, but the inferior lisp mode goes ahead and changes the buffer's directory.) - Non-echoed text entry (for entering passwords) is available in all modes. - Shell and inferior Lisp modes are backwards compatible with the standard gnu modes. - A full set of eval/compile-region/defun commands for the inferior Lisp, Scheme, and T modes. - New modes are easily created for new types of processes. The comint source has a section giving hints on converting older shell.el-based modes to use comint. I am told that the FSF will be using comint in the next release of gnumacs. The current set of modes are: background.el - run process in background, a la csh. cmulisp.el - simple lisp-in-a-buffer mode. cmuscheme.el - Scheme-in-a-buffer. cmushell.el - shell-in-a-buffer. cmutex.el - for TeX and LaTeX editing. Process support for running tex and latex, and printing and previewing .dvi files. comint.el - base mode. Used by everyone else. tea.el - T-in-a-buffer These packages can be used singly or together. They are careful not to interfere with other modes. Where possible, I have tried to make them compatible with other similar modes, in terms of keybindings, functionality, and variable names. Users familiar with Hemlock or the LispM's Zemacs will find the commands in cmulisp are bound to similar keys. Cmushell mode pays attention to the variables that customise shell.el. And so forth. Also separately available are: ilisp.el - Powerful tightly-integrated lisp-in-a-buffer mode. comint-ipc.el - Facility for piggy-backing emacs/subprocess communications on top of the user's pipe or pty communications. Unavoidably somewhat fragile, but nontheless useful. Used by ilisp.el. These files should be released imminently by Chris McConnell. CHANGES FROM RELEASE 2.00 =============================================================================== You can now anonymously ftp the source files from CMU: - Ftp to a.gp.cs.cmu.edu (128.2.242.7) or any other machine that mounts the AFS file tree. - cd /afs/cs.cmu.edu/user/shivers/lib/emacs Don't try to cd to or ls any of the intermediate directories; go straight to the .../emacs subdirectory. The CMU security mechanisms will block you from accessing any of the other directories while you are doing anonymous accesses. - ls *.el - get the files you want. - Release notes are in the notes subdirectory. Of course, anyone with AFS access at CMU, Dartmouth, Michigan, MIT, Mt. Xinu Transarc, et al. can just cd to the directory and copy what they want. 2.00->2.01 CHANGES: A few small bugs have been fixed in version 2.00 of the comint modes. For further details, see the changelogs in the source files. Release 2.01 has the following fixes/improvements over 2.00: - The directory tracking machinery in cmushell now expands environment variables in path names. This doesn't always work right, since the variables are evaluated in *emacs*' process environment, not the shell's. However, enough people wanted this feature that I installed it in spite of its obvious fragility. - Background.el had a bug that sometimes fails to correctly set the current working directory for the process to the current buffer's w.d. when starting up a job. This has been fixed. - Emacs has two separate mechanisms for maintaining the process environment (**environ in C programs). You choose one at compile time. If your emacs is compiled with the default mechanism (which uses the process-environment global var), then you have no problems. If your emacs was compiled with #define MAINTAIN_ENVIRONMENT, then the comint-exec function would break. This has been fixed in rel 2.01. The bug was reported by several people. Dan Pierson provided some of the new code that repairs it. Some people patched around this bug in rel 2.00 by setq'ing the process-environment variable to nil. Don't do this in 2.01. It will screw up emacs' process environment mechanisms. - Lisp and Scheme modes consider "." to separate symbols. E.g., "foo.bar" is not recognised by emacs as one symbol; forward-sexp on it will only skip past the "foo". Similarly, forward-sexp on "3.1415" will only skip past the "3". This will mess up certain commands that deal with sexps. For instance, lisp-show-variable-documentation will not get the default choice right. lisp-eval-last-sexp will try to evaluate "bar" instead of "foo.bar". This is really a problem with the syntax table in Scheme and Lisp modes, not with the CMU process modes. You could fix it by defining "." to have the symbol syntax code in the relevant syntax tables: (modify-syntax-entry ?. "_" lisp-mode-syntax-table) This will, however, cause emacs to consider dotted pairs like (a . b) to be 3 element lists. A more sophisticated fix is up to the FSF folks. Doug Roberts pointed this problem out. - Cmushell documentation mentions variables of the form explicit-csh-args. The code actually used variables of the form explicit-csh-arguments. The doc has been changed to match the code in rel 2.01 for compatibility with shell.el. This is a long-standing documentation bug that goes back to the original shell.el. I suspect very few people use this feature, so most people won't notice the fix. Stephen Anderson reported the problem. - Several people have written extensions for cmutex.el. To help people use these extensions and still be able to autoload cmutex.el (it's pretty big), I've added a load hook to rel 2.01 cmutex.el: cmutex-load-hook. The last thing cmutex does when it loads in is run the load hook. This is just the right thing for loading in extensions when cmutex loads: ;; For your .emacs -- when cmutex.el loads, myhacks.el will load, too. (setq cmutex-load-hook '((lambda () (load-library "myhacks")))) All of the CMU process modes except background.el have load hooks now. - The interaction between comint-previous-input and comint-previous-similar-input has been improved. - Some of the keybindings for the environment commands in cmutex.el have been moved around for greater consistency. sk@thp.Uni-Koeln reported this problem. -Olin MAJOR CHANGES FROM RELEASE ONE =============================================================================== - An extremely hairy Lisp/Scheme interface by Chris Mconnell (ccm@cs.cmu.edu). This package, ilisp.el, allows emacs to query the running process for useful state. Example commands are: lisp-arglist display the arguments taken by the current function. lisp-describe call the Common Lisp DESCRIBE function on the symbol the cursor is over, and put the results in a window. lisp-macroexpand macroexpand the current form and display the results. lisp-find-source Edit the file that defines the function the point is on. edit-next-caller Edit the next place this function is called. Ilisp.el allows tight integration with the lisp subprocess by sending messages to the subprocess "behind-the-scenes" over the user's connection. It does not assume a multithreaded lisp (as in Franz Inc.'s Allegro Common Lisp). (However, it could certainly be ported to take advantage of a multithreaded lisp, providing greater communications robustness without altering the interface functionality at all. Anyone interested in doing so should contact Chris.) Ilisp can be customised for most major dialects of Lisp and Scheme. This package is so massive it is being released in a separate post by Chris. I've included a dumb, simple inferior-lisp package in this release, as well (cmulisp.el). - A new package, background.el that allows you to run background processes in buffers. This was adapted for comint.el from Joe Keane's background.el. - A very hairy TeX and LaTeX package. This includes buffer validation, command entry commands, process interfaces to TeX, LaTeX, dvi printers and previewers. Pieces of this have been contributed by many people, notably Steve Anderson, Stephen Gildea, Dorab Patel, and Ashwin Ram. - Lots of tweaks to the basic comint package, many contributed by other people. + A new input history command comint-previous-similar-input (M-s) taken from some LispM interface. This is *quite* useful. + The other input history commands have been improved. + Filename completion has been improved. + By popular demand, return now jumps to the end of line before submitting input (this is settable, but defaults to the eol behavior). + New hooks for mode hackers. + comint-exec no longer dependent on etc/env program. + Process communication via pipes supported better. + Simple process-query facility available. + New procedures for sending input to processes that avoid hanging on large text blocks. - Tweaks to the other packages: + Improved directory tracking in cmushell.el. It now handles all forms of pushd and popd. New commands dirtrack-toggle and dirs toggle the directory tracking machinery off and on, and resync the mode's directory stack with the shell's. + cmushell and cmulisp modes now reside in separate files cmushell.el and cmulisp.el. Not only is this a good idea, it's apparently the way it'll be rel 19. N.B.: CMULISP USERS MUST CHANGE THEIR .EMACS AUTOLOAD'S ACCORDINGLY. + better support for multiple processes in cmulisp, cmuscheme and tea modes. + cmulisp has some simple query commands, for function and variable documentation, describing symbols, and getting function arglists. This is a simple facility; Chris McConnell's ilisp package is much more featureful. It was based on some code contributed by Doug Roberts. + cmulisp, cmuscheme, and tea now have a command (c-x c-e) to eval the last sexp. The keybinding is compatible with emacs lisp and Hemlock. + Filename defaults in Scheme and Lisp modes will use the string the cursor is over, if it's an existing filename. This is a debatable decision. Feedback appreciated. GENERAL NOTES =============================================================================== Directory tracking: The new directory tracking code will handle pushd [+n | ] popd [+n] cd [] The emacs command M-x dirs will stuff a "dirs" at the process, wait for a line of output, parse it up, and reset the buffer's directory stack accordingly. The emacs command M-x dirtrack-toggle will toggle the directory tracking machinery on and off. This is useful, for example, when you are running ftp, and don't want ftp's "cd" command to throw emacs off. The new code was based on source contributed by Vince Broman, Mike Coffin, Jeff Peck, and Barry Warsaw. Its structure should allow zealous shell hackers to extend it pretty easily. The commands that directory tracking looks for are customisable. If you define aliases for cd or pushd or popd, you can set the right emacs variables and win. Note that in general, complex directory tracking is a losing game. You can't win. If you have a programmable shell, an excellent hack is to program the directory-changing commands to type code sequences at the terminal, and write a process filter to watch for these sequences. A sequence like "ESC D " where is characters long would do fine. (Using a parameter instead of string delimeters prevents emacs from gobbling up unbounded amounts of shell output in the event the terminating delimiter gets lost.) Multiple process buffers: Many people suggest ways to run multiple shell buffers. This does not require extra features. Suppose you want two shell buffers. Simply make a shell buffer with M-x cmushell, and then rename it with M-x rename-buffer. Make the next shell with M-x cmushell, and now you've got two. Use M-x cmushell to get to the newest one, and C-x b to get to the other. Multiple Lisp and Scheme buffers work similarly. Commands that send text from a source buffer to the process buffer will always send to the buffer with the "official" name unless you explicitly override this (see variable lisp/scheme/tea-buffer). I don't see any real good ways to extend this. You could associate each source buffer with some process buffer, but this gets messy. I've tried to keep it simple. If you find yourself switching between multiple process buffers a lot, consider using ilisp.el. Or write a little code to soup up cmulisp.el. Documentation: There is no manual or info node for any of this stuff. I am not going to write one. Feel free to write one if you like, and submit it to me or the FSF. It would be a good thing. The .el files are copiously documented, however. If you want to use any of these modes, I strongly suggest that you read the source files. Really. Do it. They contain many useful sections of comments. Skip anything you don't understand; read the easy parts. You may find some useful commands you didn't know about. The top of each file contains a clearly-marked, friendly "suggestions for your .emacs file" section that will show you exactly how to get set up using the package. Also, pay attention to the DEFVAR'd variables. These are typically the means by which you can customise the package for your local environment. The usual on-line documentation on modes, variables and commands is also available via c-h m, c-h v, and c-h d. =============================================================================== This code is available under the terms of the Gnu Copyright agreement: you can do whatever you like with it as long as you don't charge for it or hold me responsible for anything it does. Please send any comments, improvements, bug reports, fixes or suggestions to olin.shivers@cs.cmu.edu. I would like to thank all the people who took the time to send me the code that went into this second release. -Olin Sept 12, 1990