massar@godot.UUCP (J.P. Massar) (02/14/85)
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