ed@zinfandel.UUCP (Ed Hirgelt) (12/11/84)
Here is a little Mlisp program to edit a currently bound variable in
its own buffer. Invoke as edit-var and it will prompt for the name of
the variable. You will be placed in a buffer and allowed to edit the
variable. Typing ^C, ^X^C, or $^C will update the variable from the
buffer.
I've found this invaluable for fixing stupid mistakes in last-command
(from ^U^X^E) and doing anything moderately involved with any other
variable. Hope you all find it useful.
Ed Hirgelt
Zehntel Automation Systems
zehntel!zinfandel!ed
------------------------------- Cut Here ----------------------------
; edit-var.ml
; Edit a variable
;
; Modification $Log: /aa/ed/emacs/RCS/edit-var.ml,v$
; Revision 1.3 84/12/11 09:33:05 ed
; Change error-occured to error-occurred to be consistent with
; the Unipress version.
;
; Revision 1.2 84/01/02 13:54:19 ed
; Add error checking and handling.
;
; Revision 1.1 84/01/02 11:18:08 ed
; First version.
;
(defun
(edit-var vname value cmd
(setq vname (arg 1 ": edit-var: "))
(save-window-excursion
(switch-to-buffer "Var-edit")
(setq needs-checkpointing 0)
(local-bind-to-key "exit-emacs" "\^C")
(local-bind-to-key "exit-emacs" "\e\^C")
(local-bind-to-key "exit-emacs" "\^X\^C")
(erase-buffer)
(setq cmd (concat "(insert-string " vname ")"))
(if (error-occurred (execute-mlisp-line cmd))
(error-message "Can't edit unbound variable \"" vname "\"")
)
(beginning-of-file)
(message "Edit " vname " ^C to update definition")
(sit-for 4)
(recursive-edit)
(beginning-of-file)
(set-mark)
(end-of-line)
(setq cmd (concat "(setq " vname " \"" (region-to-string) "\")"))
(if (error-occurred (execute-mlisp-line cmd))
(error-message "Can't modify variable \"" vname "\"")
)
(setq buffer-is-modified 0)
(novalue)
)
) ; end of edit-var
)