Mercurial > emacs
comparison lisp/novice.el @ 10216:c1ad03de412e
(enable-command): Always insert code to enable.
(disable-command): Insert newline before as well as after.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 22 Dec 1994 22:53:34 +0000 |
parents | 430b8cf09515 |
children | 1a97dea087d1 |
comparison
equal
deleted
inserted
replaced
10215:7690653b9231 | 10216:c1ad03de412e |
---|---|
102 (substitute-in-file-name user-init-file))) | 102 (substitute-in-file-name user-init-file))) |
103 (goto-char (point-min)) | 103 (goto-char (point-min)) |
104 (if (search-forward (concat "(put '" (symbol-name command) " ") nil t) | 104 (if (search-forward (concat "(put '" (symbol-name command) " ") nil t) |
105 (delete-region | 105 (delete-region |
106 (progn (beginning-of-line) (point)) | 106 (progn (beginning-of-line) (point)) |
107 (progn (forward-line 1) (point))) | 107 (progn (forward-line 1) (point)))) |
108 ;; Must have been disabled by default. | 108 ;; Explicitly enable, in case this command is disabled by default |
109 (goto-char (point-max)) | 109 ;; or in case the code we deleted was actually a comment. |
110 (insert "\n(put '" (symbol-name command) " 'disabled nil)\n")) | 110 (goto-char (point-max)) |
111 (insert "\n(put '" (symbol-name command) " 'disabled nil)\n") | |
111 (save-buffer))) | 112 (save-buffer))) |
112 | 113 |
113 ;;;###autoload | 114 ;;;###autoload |
114 (defun disable-command (command) | 115 (defun disable-command (command) |
115 "Require special confirmation to execute COMMAND from now on. | 116 "Require special confirmation to execute COMMAND from now on. |
126 (if (search-forward (concat "(put '" (symbol-name command) " ") nil t) | 127 (if (search-forward (concat "(put '" (symbol-name command) " ") nil t) |
127 (delete-region | 128 (delete-region |
128 (progn (beginning-of-line) (point)) | 129 (progn (beginning-of-line) (point)) |
129 (progn (forward-line 1) (point)))) | 130 (progn (forward-line 1) (point)))) |
130 (goto-char (point-max)) | 131 (goto-char (point-max)) |
131 (insert "(put '" (symbol-name command) " 'disabled t)\n") | 132 (insert "\n(put '" (symbol-name command) " 'disabled t)\n") |
132 (save-buffer))) | 133 (save-buffer))) |
133 | 134 |
134 ;;; novice.el ends here | 135 ;;; novice.el ends here |