Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/17/84; site godot.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!massar From: massar@godot.UUCP (J.P. Massar) Newsgroups: net.emacs Subject: CCA Emacs Elisp enhanced code. Message-ID: <976@godot.UUCP> Date: Thu, 14-Feb-85 15:38:08 EST Article-I.D.: godot.976 Posted: Thu Feb 14 15:38:08 1985 Date-Received: Fri, 15-Feb-85 05:55:12 EST Distribution: net Organization: Thinking Machines, Cambridge, MA Lines: 58 Following are enhanced versions of M-X Evaluate Elisp Form and M-X Load Elisp Buffer. M-X Evaluate Elisp Form will now, if given a C-U argument, echo the result of evaluation in the Echo area at the bottom of the screen. M-X Load Elisp Buffer can now be given a numeric argument, in which case it will load the buffer referred to by that index. Otherwise, if no buffer name is given and a RETURN is typed when Elisp prompts for 'buffer? ' it will load the current buffer. These enhancements will only work correctly if the bug fix with respect to 'numarg' posted a few days ago has been implemented. Replace the definitions of |Evaluate Elisp Form| and |Load Elisp Buffer| in /usr/lib/emacs/elisp/erep.l (or where ever your emacs library lives) with the following: --------------------------------------------------------------------------- (edefun |Load Elisp Buffer| (argtype argval &optional buffername) (let ((curbuf #V"& Current Buffer")) (if (and (eql argtype numarg) (> argval 0)) (#F"Select Buffer" numarg argval) (let ((bname (lisp::prompt-user buffername "buffer? " 0))) (if (not (equal bname "")) (#F"Select Buffer" noarg 1 bname)))) (#F"Goto Line") (load *emacs-buffer*) (#F"Select Buffer" numarg curbuf) )) (edefun |Evaluate Elisp Form| (argtype n &optional formstring) ; a C-U argument echos the result of evaluation. This is a hack. ; It would be much simpler if 'print-to-string' were implemented. (if (eql argtype nullarg) (progn (#F"Beginning of Line") (print-line (eval (read-from-string (lisp::prompt-user formstring "form? " 0)))) (#F"Up Real Line") (#F"& Echo 1" (emacs-get-line)) (#F"Up Real Line") (#F"Kill Line" numarg 1) ) (dotimes (j n) (eval (read-from-string (lisp::prompt-user formstring "form? " 0)))) )) --------------------------------------------------------------------------- JP Massar ihnp4!godot!massar massar@cca-unix