From: CRDGW2::CRDGW2::MRGATE::"SMTP::PREP.AI.MIT.EDU::INFO-GNU-EMACS-REQUEST" 29-AUG-1989 22:37 To: MRGATE::"ARISIA::EVERHART" Subj: GNU/Common Lisp interface (1 of 2) Received: by life.ai.mit.edu (4.1/AI-4.10) id AA09146; Tue, 29 Aug 89 19:07:25 EDT Return-Path: Received: from tut.cis.ohio-state.edu by life.ai.mit.edu (4.1/AI-4.10) id AA09073; Tue, 29 Aug 89 18:56:57 EDT Received: by tut.cis.ohio-state.edu (5.61/4.890725) id AA08568; Tue, 29 Aug 89 16:49:02 -0400 Received: from USENET by tut.cis.ohio-state.edu with netnews for info-gnu-emacs@prep.ai.mit.edu (info-gnu-emacs@prep.ai.mit.edu) (contact usenet@tut.cis.ohio-state.edu if you have questions) Date: 29 Aug 89 20:17:42 GMT From: segre@cu-arpa.cs.cornell.edu (Alberto M. Segre) Organization: Cornell Univ. CS Dept, Ithaca NY Subject: GNU/Common Lisp interface (1 of 2) Message-Id: <31525@cornell.UUCP> Sender: info-gnu-emacs-request@prep.ai.mit.edu To: info-gnu-emacs@prep.ai.mit.edu This is the first of 2 shell archives containing the latest release of GNU emacs/Common Lisp interface "clisp.el". Unshar and see the file "Help" for more information. Alberto Segre Assistant Professor Cornell University Department of Computer Science Upson Hall Ithaca, NY 14853-7501 ARPA: segre@cs.cornell.edu # This is a shell archive. # Remove everything above and including the cut line. # Then run the rest of the file through sh. #----cut here-----cut here-----cut here-----cut here----# #!/bin/sh # shar: Shell Archiver # Run the following text with /bin/sh to create: # Install # Notes # .emacs # autoinclude.el # xmouse.el # header.lisp # This archive created: Fri Aug 18 12:43:09 1989 cat << \SHAR_EOF > Install GNU Emacs/Common Lisp Environment Installation Instructions. 0. Create a temporary directory containing only the distribution file. 1. Unpack the distribution shar file by stripping the mail header and passing the file to /bin/sh 2. Create two new directories (in your home directory will be fine): call them ".elisp" and ".auto". These are "hidden" directories since they begin with a "." so they won't show up with an "ls" command unless you use the "-a" option. 3. Included in the distribution is a sample .emacs file. You will need to integrate any existing .emacs file you have with the contents of this file. In this file, change references to "/usr/u/cap/.elisp" and "/usr/u/cap/.auto/" to point to the directories created in step 2. NOTE: The trailing "/" after ".auto" IS SIGNIFICANT! Place ".emacs" in your home directory. 4. Move all the files ending in ".el" to the ".elisp" directory. 5. Edit the file "clisp.el" in the .elisp directory using GNU emacs. YOU WILL NEED TO CHANGE THE VARIABLES RIGHT AFTER WHERE IT SAYS "System-dependent variables." Change the default value of inferior-lisp-host to be a string containing the machine where your Common Lisp should be started. Currently defaults to whatever machine you're running on. Change the default value of inferior-lisp-program to point to the Common Lisp executable on the inferior-lisp-host. Change the default value of inferior-lisp-prompt to be consistent with the type of Common Lisp used in inferior-lisp-program (e.g., Lucid, KCL, etc.). Working prompts for KCL, Allegro, CMU Lisp, Lucid and BBN Common Lisp are defvar'd for your convenience. Change the default value of remote-shell-program to point to the rsh executable on the inferior-lisp-host for your installation. You probably won't need to change this. Change the value of *clisp-motd-file* to point to a file where the "message of the day" is stored. The contents of this file will be displayed in each users first Common Lisp buffer. Change the value of *lisp-filename-extenstion* to whatever your Common Lisp expects (".lsp" for KCL, ".lisp" for Lucid, ".cl" for Allegro, etc.). Change the value of *clisp-temporary-directory* to point to a directory that is readable/writeable by the user. It will be used for temporary files. Defaults to "/tmp". 6. "C-u 1 M-x byte-recompile-directory" to GNU will compile all of the files ending with ".el" in the ".elisp" directory. 7. Edit the file "header.lisp" to whatever you like. This is the file that will be read in at the beginning of every new Lisp file you create. The sample header.lisp file included contains a mode line that makes it easy to transfer your code to a Symbolics. 8. Exit GNU emacs (don't stop it; exit with C-x C-c after saving all the files). 9. Place your edited header.lisp file in the ".auto" directory. You should change the ".lisp" extension at this time to match whatever you set *lisp-filename-extenion* to in step 5 (from here on, we'll assume you're using ".lisp" as your extension). Note that the autoinclude feature works for any extension you like (provided you've set the auto-include-alist properly in your .emacs file); thus you can have a header.txt file to place your favorite troff or latex commands at the beginning of every fresh file with the ".txt" extension. A header.ltr file could contain a letter template for new files ending with ".ltr" and so forth. 10. Now we're ready to go. Start a new emacs on a new file with a ".lisp" extension. You should end up facing a fresh file containing header.lisp; "C-c l" should take you to a buffer with a live Lisp session. 11. For a complete list of the commands available, print out the documentation in the file called Help. 12. Enjoy. Send bug reports to me. We're still making changes/additions, so you should periodically get updates provided you are on my environment mailing list (send mail to "segre@cs.cornell.edu" to get on the list). The file "Notes" contains release notes describing changes from release to release. SHAR_EOF cat << \SHAR_EOF > Notes Cornell Apprentice Project (CAP) GNU Emacs/Common Lisp Environment Release Notes. Mail bug reports to segre@cs.cornell.edu ===== August 15, 1989 Compilation of defmacros, defmethods, defstructs and the like now work properly. Handling these requires writing them out to a temporary file and then compiling that file. New variable *clisp-temporary-directory* defaults to /tmp. Handling of clisp-eval-buffer (C-c b, C-c C-b) and clisp-eval-region (C-c r, C-c C-r) have been changed to use this intermediate temporary file mechanism as well. The functions clisp-eval-file, clisp-eval-file-and-go, clisp-compile-file, clisp-compile-file-and-go, clisp-compile-region, clisp-compile-region-and-go, clisp-compile-buffer and clisp-compile-buffer-and-go are now available although not bound to keys. Extensive changes made to startup mechanism in order to support running different flavors of lisps on different hosts. Check the Install file for new installation instructions. We've removed the dependency on shell.el; the parts of shell.el that were used have been revised for clisp.el. New variable *clisp-image-table* allows you to specify host names, images and prompts for a variety of machines. Function clisp-create-lisp-buffer (M-C-l) now takes a prefix argument. A 0 creates a new lisp process on the default host (same as start-lisp). An integer creates the lisp specified as the ith entry in *clisp-image-table*. No prefix argument cycles through *clisp-image-table*, allowing you to pick one. Variable *clisp-default-host* no longer exists. Function start-lisp no longer takes an argument (check your .emacs files). Each installation should establish default values in the clisp.el file. If a user wishes to make their own default lisp different than the standard default lisp set in their installation's clisp.el file, they should change their lisp-mode-hook to look like this: (setq lisp-mode-hook '(lambda () (require 'clisp) (setq-default inferior-lisp-host "myfavoritemachine") (setq-default inferior-lisp-program "/usr/u/cap/akcl/xbin/kcl") (setq-default inferior-lisp-prompt *clisp-kcl-prompt*) (setq-default remote-shell-program "/usr/ucb/rsh") (start-lisp))) You probably don't need to set remote-shell-program differently. In addition, if you are satisfied with the default lisp flavor (e.g., Lucid vs. KCL vs. BBN, etc) but want a different default host, you need not reset the defaults for inferior-lisp-program and inferior-lisp-prompt; just reset inferior-lisp-host. Similarly, each site should set a value for *clisp-image-table* in the clisp.el file, although a user can establish their own value in their .emacs file. My .emacs file contains the following (which supersedes the value set in clisp.el for my own site; note that each entry is eval'd, thus (system-name) refers to the current system): (defvar *clisp-image-table* '(((system-name) "/usr/u/cap/akcl/xbin/kcl" *clisp-kcl-prompt* nil) ((system-name) "/usr/local/bin/lisp-pcl" *clisp-lucid-prompt* nil) ((system-name) "/usr/local/bin/lisp-clx" *clisp-lucid-prompt* nil) ("iron" "/usr/blisp/mach/bin/common-lisp" *clisp-bbn-prompt* "/usr/ucb/rsh") ("rocky" "/usr/local/bin/lisp" *clisp-lucid-prompt* "/usr/ucb/rsh") ("rocky" "/usr/local/bin/lisp-pcl" *clisp-lucid-prompt* "/usr/ucb/rsh"))) Fixed a bug in handling packages. Modeline package specifier is coerced to upper case (as on Symbolics). Argument to in-package command is coerced to upper case only if its an atom (strings are read as is). New Lucid Common Lisp prompt regexp. Sample .emacs file distributed with past versions caused problems for some people due to control character strings getting munged in transit. The global-set-key commands have been rewritten to avoid using control characters to specify key sequences. Sorry! ===== June 13, 1989 Distribution now comes in two parts to satisfy the mailing system. Fixed a bug in the package handling mechanism that arose when evaling buffers or regions with package commands in them. Provided the package commands are relatively straight-forward, things ought to work pretty much correctly now. C-c a, C-c f, and C-c v now work within the Lisp process as well. Fixed a bug in handling *clisp-default-host*. CLOS defgeneric added to template facility (C-c =). ===== May 5, 1989 We're now tracking the package of the current buffer. Any expression sent to Lisp will be evaluated in the current package (as read from the mode line of the file or explicitly set via M-p). In addition, the file is searched backwards from current point for explicit IN-PACKAGE statements that would alter the current package. The mode line must be the first line of the file, and should look like the Symbolics mode-line; however, only the PACKAGE: specifier is meaningful. Note that if an operation causes a break in the inferior lisp, and you abort this break, you may be stuck in an unexpected package. Added a new interactive template facility. C-c = begins an interactive dialogue with the user that results in a new DEFUN, DEFVAR, DEPARAMETER, DEFCONSTANT, DEFSTRUCT, DEFCLASS or DEFMETHOD (appropriately tagged with user's name and date of creation). A prefix arg to C-c= inserts a separator (a line of semicolons) before the new definition (you can also set *clisp-default-separate* to t if you always want this separator). Specify argument names, slot names, etc when prompted in the minibuffer. Slots for structures or CLOS classes may be specified as NAME or (NAME VALUE) pairs. Prefix arg to C-c d, C-c b, C-c s, C-c r, C-c t, C-c p and their variants (e.g., C-c C-d, C-c C-b, C-c C-s, C-c C-r, C-c C-t, C-c C-p) specifies which running Lisp process. Defaults to last selected Lisp process. Respects packages. Same goes for C-c m, C-c f, C-c v, and C-c a. Changed behavior of all of the "-and-go" functions to be a little smarter about bringing up new windows when the proper buffer is already being displayed. Changed behavior when attempting to select a dead Lisp process; clisp now switches to the "next" reasonable Lisp process and prints a message. A few new keybindings, and a few changed ones. M-C-t and M-t from the last release overwrote useful transpose commands. These have been rebound. C-c = interactive definition facility (prefix arg inserts separator) C-c / [was M-t] recomputes lookup table for (C-c .) and (M-c-,) C-c ? [was M-C-t] lists files indexed by (C-c .) M-p set default package for current buffer Fixed bug in remote lisp procedures; they are now started using the current default directory as Lisp's *default-pathname-defaults*. Fixed bug in output filter function that prevented typeahead from working correctly in some situations. Fixed a bug that was evident if you used funny characters in function or variable names. Common Lisp allows function names like "foo.1.2" (no quotes) or even "|foo\|.2\|.3|" (no quotes); the interface now handles these correctly. Added some bindings for ease of mouse use under X11R3. These are in a separate file "xmouse.el", and are likely to change in the near future. Indentation support for the FOR macro package I distribute also seems to work fairly well for the Zeta-lispish LOOP macro. This has been added so you needn't do anything special to get your LOOPs to indent properly. Inferior-lisp-prompt for CMU lisp on an IBM RT seems to be "\\*". ===== March 10, 1989 Added new prompt string for Lucid Common Lisp; this is now the default lisp. If you use Kyoto Common Lisp or Allegro Common Lisp you will need to change both inferior-lisp-prompt and inferior-lisp-program; see the documentation in clisp.el. Added a new variable *clisp-default-host* which defaults to the current system. This variable determines which machine should run your default lisp process. Fixed a bug that often caused more than one copy of the motd to be printed in buffer *lisp*. This was most noticeable with Lucid Common Lisp. The new string inferior-lisp-extension now needs to be set. This fixes a bug in the tags facility that expected lisp files to end with the ".lsp" extension from KCL. Defaults to ".lisp" C-c C-a now works as advertised. Some new bindings and some bindings have changed: C-c t Trace current defun C-c C-t Trace current defun and go to lisp M-t List tag files (was C-c t) M-C-t Recompute tag files (was C-c C-t) C-c a Beginning of current defun C-c e End of current defun Fixed a bug with where lisp output is placed in the buffer. Now properly supports typeahead when the process hasn't finished dumping output to the lisp buffer. Hitting return at the end of any sexpr in the lisp buffer brings that sexpr down to the current prompt and evaluates it. Previously destroyed lisp process buffers are now reused when starting new lisps. ===== December 18, 1988 Minor bug corrections to support Allegro Common Lisp. Suggested inferior-lisp-prompt string for Allegro is given in clisp.el. Also minor fixes to macroexpansion and documentation since Allegro prefaces printed items with a carriage return and doesn't have *print-pretty* initially t. ===== December 1, 1988 start-lisp now takes an optional argument if you want your initial *lisp* started something other than the local host. You would change the call to start-lisp on your lisp-mode-hook to take the on-local hostname as a string. ===== November 27, 1988 A few bug fixes that snuck past in the last release. Macro expansion and documentation functions should now work properly (at least for KCL). ===== November 22, 1988 Use M-C-l to start a new Lisp Listener (will prompt for a hostname). ===== October 26, 1988 Common lisp indentation is fixed. It properly indents the FOR macro for those of you who use it (others who might be interested, drop me a line and I'll send you a copy). We're working on multiple lisp listeners. Soon you'll be able to have >1 lisp, some on other machines. ===== October 2, 1988 Several additions/changes have occured since the last release. The file "kcl.el" has been renamed "clisp.el" to reflect the fact that any Common Lisp can be used as the inferior lisp process. Simply set the variable "inferior-lisp-program" in the "clisp.el" to point to the right place. A "super-paren" feature has been added. The "[" and "]" brackets act as super-parens (a la Interlisp), replacing themselves with the proper number of "(" and ")" (since Common Lisp only recognizes these characters as parens). C-c h has been replaced by C-c f and C-c v, fetching function and variable documentation respectively. We're still working on the indentation. ===== September 12, 1988 This message contains a new release of the GNU/KCL environment. This release features a cleaned up process-filter mechanism that will handle long doc strings or macroexpansions properly. Enjoy! ===== September 1, 1988 This message containts four files comprising a simple environment for Kyoto Common Lisp (or any other lisp with appropriate minimum modifications) running under GNUemacs. Many of the functions are modeled after similar functions on the Symbolics machines. Editing a file in lisp mode (extension ".lsp") will cause a session with KCL to start in an emacs buffer (only one such session will be started). These files provide commands for transferring information back and forth between KCL and GNUemacs. To use, set your lisp-mode-hook to: (lambda () (require 'kcl)(start-lisp)) There are two sets of key bindings established, one for editing lisp code and the other for interacting with the lisp listener. Both sets of bindings are available via the ^C prefix. See the file kcl.el for more detail. The file autoinclude.el provides a mechanism for placing headers in new files. I use this to place the file ~/.auto/header.lsp containing a header specifying lisp mode at the beginning of every new file. You should load autoinclude in your .emacs file to enable this feature, which may not work properly in older versions of GNUemacs. The files are packaged in a shar file. Cut below and pass the resulting file to /bin/sh for extraction. I plan to use this environment on Vaxen and Suns for students writing lisp code for class assignments. I am also using it as a development environment until I can get my hands on something better. I'd love to hear comments/suggestions from those of you who use it. Please let me know what you think or if you find any bugs. Most of the interesting stuff is in kcl.el. The other three files were grabbed from netnews and are presented with only minor modifications. I am also including my .emacs file as an example. Good luck and enjoy! SHAR_EOF cat << \SHAR_EOF > .emacs ;;; First things first: fix brain-damaged XON/XOFF (set-input-mode t nil) ;;; Enable eval-ing of an emacs-lisp expression. (put 'eval-expression 'disabled nil) ;;; Tell emacs where to look for customization files. (setq load-path (cons (expand-file-name "/usr/u/cap/.elisp") load-path)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Make sure the filename extension your lisp expects is associated ;;; with lisp-mode. Many of the common ones (e.g., ".lisp" or ".l") ;;; are already on auto-mode-alist. (setq auto-mode-alist (append '(("\\.lsp$" . lisp-mode)) auto-mode-alist)) ;;; Set up the autoinclude file hack. (load "autoinclude" nil t) (setq auto-include-alist (append '(("\\.lsp$" . "header.lsp")) auto-include-alist)) (setq auto-include-directory "/usr/u/cap/.auto/") ;;; Change the lisp-mode-hook to load the inferior lisp process stuff. (setq lisp-mode-hook '(lambda () (require 'clisp) (start-lisp))) ;;; Set the lisp images you will be using. Note that each entry in the ;;; table consists of four elements which are EVALUATED when the image is ;;; constructed. Thus (system-name) returns the name of the system ;;; you're currently logged into. You don't need this if you're satisfied ;;; with your installation's *clisp-image-table* (see file clisp.el). (defvar *clisp-image-table* '(((system-name) "/usr/local/bin/lisp" *clisp-lucid-prompt* "/usr/ucb/rsh") ((system-name) "/usr/local/bin/lisp-pcl" *clisp-lucid-prompt* "/usr/ucb/rsh") ((system-name) "/usr/local/bin/lisp-clx" *clisp-lucid-prompt* "/usr/ucb/rsh") ((system-name) "/usr/u/cap/akcl/xbin/kcl" *clisp-kcl-prompt* "/usr/ucb/rsh") ("iron" "/usr/blisp/mach/bin/common-lisp -nint 16 -nmem 5" *clisp-bbn-prompt* "/usr/ucb/rsh") ("vali" "/usr/bin/cl" *clisp-allegro-prompt* "/usr/ucb/rsh"))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Key bindings. ;;; Global replace (global-set-key "\M-r" 'replace-string) (global-set-key "\M-\C-r" 'query-replace) ;;; Change other window commands. (global-set-key "\C-xn" 'select-next-window) (global-set-key "\C-xp" 'select-previous-window) (global-set-key "\C-xd" 'delete-window) (global-set-key "\C-xv" 'find-alternate-file) (global-set-key "\C-x\C-v" 'find-file-other-window) (global-set-key "\C-xt" 'line-to-top) ;;; Add kill-some-buffers. (global-set-key "\C-x\C-k" 'kill-some-buffers) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Here are the next and previous window functions. (defun select-next-window () (interactive) (other-window 1)) (defun select-previous-window () (interactive) (other-window -1)) ;;; Brings current line to top of window. (defun line-to-top () (interactive) (recenter 0)) SHAR_EOF cat << \SHAR_EOF > autoinclude.el ;;; autoinclude.el ;;;+ ------------------------------------------------------------ ;;; Abstract: ;;; ;;; The following defines an association list for files to be ;;; automatically included when a new file is created, and a function ;;; which automatically inserts these files; the idea is to include ;;; default files much as the mode is automatically set using ;;; auto-mode-alist. ;;; ;;; The auto-include-alist consists of dotted pairs of ;;; ( REGEXP . FILENAME ) where REGEXP is a regular expression, and ;;; FILENAME is the file name of a file which is to be included into ;;; all new files matching the regular expression with which it is ;;; paired. ;;; ;;; To use: ;;; load autoinclude.el ;;; setq auto-include-directory to an appropriate value, which ;;; must end in "/" ;;; set the find-file-not-found-hooks list to include ;;; (include-auto-include-files) ;;; ;;; Author: Charlie Martin ;;; Department of Computer Science and ;;; National Biomedical Simulation Resource ;;; Box 3709 ;;; Duke University Medical Center ;;; Durham, NC 27710 ;;; ;;; Date: Fri Jul 1 16:15:31 EDT 1988 ;;; ;;; Copyright (c) 1988 Charles R. Martin ;;; ;;; Copying is permitted under those conditions described by the GNU ;;; Emacs General Public License as clarified 11 February 1988, which ;;; is incorporated here by reference. ;;; ;;; Modified by Alberto M. Segre (1988) Cornell University. ;;; (segre@gvax.cs.cornell.edu) ;;; ;;;- ------------------------------------------------------------ ;;; Define the auto-include-alist (defvar auto-include-alist nil "\ Alist of file name patterns and corresponding include files for creation of new files. The include files are standard file headers or trailers found at \"auto-include-file-path\". Each element looks like (REGEXP . FILENAME). Creating a file whose name matches REGEXP causes FILENAME to be included.") (setq auto-include-alist (mapcar 'purecopy '(("\\.lsp$" . "header.lsp")))) ;;; Establish a default value for auto-include-directory (defvar auto-include-directory nil "\ Directory from which auto-included files are taken.") (setq auto-include-directory "~/.auto/") ;;; Include the file if name match found in auto-include-alist. ;;; Uses buffer-file-name, searches auto-include-alist for a matching ;;; REGEXP, then does 'insert-file' to include that file. ;;; (defun include-auto-include-files () "Include the file from the include directory if regexp match found in auto-include-alist. Silently terminates if the file name matches none of the regular expressions." (let ((alist auto-include-alist) (name buffer-file-name) (include-file nil)) ;; remove backup suffixes from file name (setq name (file-name-sans-versions name)) ;; find first matching alist entry (while (and (not include-file) alist) (if (string-match (car (car alist)) name) (setq include-file (cdr (car alist))) (setq alist (cdr alist)))) ;; Now, if we found an appropriate include file, include it (if include-file (let ((file (concat auto-include-directory include-file))) (if (file-readable-p file) ;; Changed 7/4/88 ams to goto end of file and unmark as ;; changed. (progn (insert-file file) (goto-char (point-max)) (set-buffer-modified-p nil)) ;;; Corrected 7/4/88 ams to include file name. (message "Auto-include: file %s not found" file)))))) ;;; Add autoinclude handling to find-file-not-found-hooks. (or (memq 'include-auto-include-files find-file-not-found-hooks) (setq find-file-not-found-hooks (nconc find-file-not-found-hooks '(include-auto-include-files)))) ;;; ;;; End of file ;;; ------------------------------------------------------------ SHAR_EOF cat << \SHAR_EOF > xmouse.el ;;; This file contains fixes to the behavior of x-mouse.el ;;; to make it work in a fashion more consistent with xterm. It is ;;; based on a set of corrections called fix-x-mouse.el by ;;; Jean-Francois Lamy (lamy@ai.utoronto.ca). It also has a number of ;;; fixes (x11cut.el) posted by Reed Hastings (hastings@spar.slb.com) ;;; to make the X11 cut buffer and the top of the emacs kill ring be ;;; the same thing. ;;; Mouse bindings: ;;; Left Middle Right ;;; ;;; Unshifted set-point yank set-mark and ;;; copy to kill buffer ;;; ;;; (Drag) set-mark and set-mark and ;;; copy to kill buffer () copy to kill buffer ;;; ;;; Shifted split-window help buffer menu ;;; ;;; Control unsplit-window yank-pop kill-region ;;; ;;; Control-Shifted () () () (define-key mouse-map x-button-left 'x-mouse-set-point) (define-key mouse-map x-button-middle 'x-yank) (define-key mouse-map x-button-right 'x-cut-text) (define-key mouse-map x-button-left-up 'x-cut-text-if-moved) (define-key mouse-map x-button-right-up 'x-cut-text-if-moved) (define-key mouse-map x-button-s-left 'x-mouse-select-and-split) (define-key mouse-map x-button-s-middle 'x-help) (define-key mouse-map x-button-s-right 'x-buffer-menu) (define-key mouse-map x-button-c-left 'x-mouse-keep-one-window) (define-key mouse-map x-button-c-middle 'x-yank-pop) (define-key mouse-map x-button-c-right 'x-cut-and-wipe-text) (define-key mouse-map x-button-c-s-left 'x-unbound-mouse) (define-key mouse-map x-button-c-s-middle 'x-unbound-mouse) (define-key mouse-map x-button-c-s-right 'x-unbound-mouse) (defun x-unbound-mouse (arg) (beep)) (defun x-cut-text (arg &optional kill) "Copy text between point and mouse into window system cut buffer. Set mark to current mouse position. Save in Emacs kill ring also." (if (coordinates-in-window-p arg (selected-window)) (progn (x-mouse-set-mark arg) (let ((beg (point)) (end (mark))) (x-store-cut-buffer (buffer-substring beg end)) (if kill (delete-region beg end)))) (message "Mouse not in selected window"))) (defun x-cut-text-if-moved (arg &optional kill) "Copy text between point and current mouse position into window system cut buffer if the mouse has changed position. Set mark to current mouse position. Save in Emacs kill ring also." (let ((opoint (point))) (x-mouse-set-point arg) (cond ((not (equal (point) opoint)) (goto-char opoint) (x-cut-text arg kill))))) (defun x-paste-text (arg) "Insert window system cut buffer contents at current point." (insert (x-get-cut-buffer))) (defun x-cut-and-wipe-text (arg) "Kill text between point and mark; also copy to window system cut buffer." (x-cut-text arg t)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; the way yank and yank-pop in simple.el communicate is by ;;; setting the var last-command. ;;; Because of the way the mouse is hacked into Gnu, last-command is ;;; x-mouse-flush-queue, and we have to use a different procedure. We ;;; record the mouse position. If the mouse moves the ;;; yank/yank-pop/yank-pop... chain is broken. This is gross. If ;;; anyone knows how, please fix last command so we can use it. (defvar mouse-position-on-last-yank nil "hack holder for yank/yank-top communication.") (defun x-yank (arg) "Yank from X cut buffer (which is the same as the top of the emacs kill ring) after moving the point to the mouse cursor" (x-mouse-set-point arg) (yank nil) (setq mouse-position-on-last-yank arg)) ;; hack for yank-pop's benefit (defun x-yank-pop (arg) (if (equal arg mouse-position-on-last-yank) (progn (let ((last-command 'yank)) (yank-pop 1))) (setq mouse-position-on-last-yank nil) (error "Mouse cursor has moved since last yank. Hold it still to cycle the kill ring"))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; from simple.el (defun copy-region-as-kill (beg end) "Save the region as if killed, but don't kill it." (interactive "r") (if (eq last-command 'kill-region) (kill-append (buffer-substring beg end) (< end beg)) (let ((this-string (buffer-substring beg end))) (copy-to-window-system-cut-buffer this-string) (setq kill-ring (cons this-string kill-ring))) (if (> (length kill-ring) kill-ring-max) (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil))) (setq this-command 'kill-region) (setq kill-ring-yank-pointer kill-ring)) ;;; from simple.el (defun kill-append (string before-p) (let ((new-top (if before-p (concat string (car kill-ring)) (concat (car kill-ring) string)))) (setcar kill-ring new-top) (copy-to-window-system-cut-buffer new-top))) (defun copy-to-window-system-cut-buffer (string) (if window-system (x-store-cut-buffer string))) ;;; from simple.el (defun yank (&optional arg) "Reinsert the last stretch of killed text. More precisely, reinsert the stretch of killed text most recently killed OR yanked. With just C-U as argument, same but put point in front (and mark at end). With argument n, reinsert the nth most recently killed stretch of killed text. See also the command \\[yank-pop]." (interactive "*P") (rotate-yank-pointer (if (listp arg) 0 (if (eq arg '-) -1 (1- arg)))) (push-mark (point)) (if (listp arg);;(normal case) we are yanking from the top ;; of the ring, so we do have to hassle ;; with the X cut buffer. ;;see if cut buffer has changed (if (not (string-equal (x-get-cut-buffer) (car kill-ring-yank-pointer))) ;; yes? then push the new cut buffer contents onto the kill ring (setq kill-ring (setq kill-ring-yank-pointer (cons (x-get-cut-buffer) kill-ring))))) (insert (car kill-ring-yank-pointer)) (if (consp arg) (exchange-point-and-mark))) ;;; from simple.el (defun rotate-yank-pointer (arg) "Rotate the yanking point in the kill ring." (interactive "p") (if (not (= 0 arg)) (let ((length (length kill-ring))) (if (zerop length) (error "Kill ring is empty") (setq kill-ring-yank-pointer (nthcdr (% (+ arg (- length (length kill-ring-yank-pointer))) length) kill-ring)) (copy-to-window-system-cut-buffer (car kill-ring-yank-pointer)))))) SHAR_EOF cat << \SHAR_EOF > header.lisp ;;; -*- Syntax: Common-Lisp; Package: USER; Base: 10; Mode: LISP -*- ;;; ;;; ;;; ;;; Copyright (c) 1989 Cornell Apprentice Project, Cornell University ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SHAR_EOF # End of shell archive exit 0