Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site zinfandel.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!houxm!ihnp4!zehntel!zinfandel!ed From: ed@zinfandel.UUCP (Ed Hirgelt) Newsgroups: net.emacs Subject: Edit an Emacs variable Message-ID: <266@zinfandel.UUCP> Date: Tue, 11-Dec-84 12:39:27 EST Article-I.D.: zinfande.266 Posted: Tue Dec 11 12:39:27 1984 Date-Received: Thu, 13-Dec-84 03:24:34 EST Reply-To: ed@zinfandel.UUCP (Ed Hirgelt) Organization: Zehntel Inc., Walnut Creek, CA Lines: 60 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 )