Mercurial > hg > xemacs-beta
comparison lisp/prim/novice.el @ 193:f53b5ca2e663 r20-3b23
Import from CVS: tag r20-3b23
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:58:30 +0200 |
parents | 0132846995bd |
children |
comparison
equal
deleted
inserted
replaced
192:9d35321dd38c | 193:f53b5ca2e663 |
---|---|
136 (progn (beginning-of-line) (point)) | 136 (progn (beginning-of-line) (point)) |
137 (progn (forward-line 1) (point)))) | 137 (progn (forward-line 1) (point)))) |
138 ;; Explicitly enable, in case this command is disabled by default | 138 ;; Explicitly enable, in case this command is disabled by default |
139 ;; or in case the code we deleted was actually a comment. | 139 ;; or in case the code we deleted was actually a comment. |
140 (goto-char (point-max)) | 140 (goto-char (point-max)) |
141 (insert "\n(put '" (symbol-name command) " 'disabled nil)\n") | 141 (or (bolp) (insert "\n")) |
142 (insert "(put '" (symbol-name command) " 'disabled nil)\n") | |
142 (save-buffer))) | 143 (save-buffer))) |
143 | 144 |
144 ;;;###autoload | 145 ;;;###autoload |
145 (defun disable-command (command) | 146 (defun disable-command (command) |
146 "Require special confirmation to execute COMMAND from now on. | 147 "Require special confirmation to execute COMMAND from now on. |
147 The user's .emacs file is altered so that this will apply | 148 The user's `custom-file' is altered so that this will apply |
148 to future sessions." | 149 to future sessions." |
149 (interactive "CDisable command: ") | 150 (interactive "CDisable command: ") |
150 (if (not (commandp command)) | 151 (if (not (commandp command)) |
151 (error "Invalid command name `%s'" command)) | 152 (error "Invalid command name `%s'" command)) |
152 (put command 'disabled t) | 153 (put command 'disabled t) |
153 (save-excursion | 154 (save-excursion |
154 (set-buffer (find-file-noselect | 155 (set-buffer (find-file-noselect |
155 (substitute-in-file-name user-init-file))) | 156 (substitute-in-file-name custom-file))) |
156 (goto-char (point-min)) | 157 (goto-char (point-min)) |
157 (if (search-forward (concat "(put '" (symbol-name command) " ") nil t) | 158 (if (search-forward (concat "(put '" (symbol-name command) " ") nil t) |
158 (delete-region | 159 (delete-region |
159 (progn (beginning-of-line) (point)) | 160 (progn (beginning-of-line) (point)) |
160 (progn (forward-line 1) (point)))) | 161 (progn (forward-line 1) (point)))) |
161 (goto-char (point-max)) | 162 (goto-char (point-max)) |
162 (insert "\n(put '" (symbol-name command) " 'disabled t)\n") | 163 (or (bolp) (insert "\n")) |
164 (insert "(put '" (symbol-name command) " 'disabled t)\n") | |
163 (save-buffer))) | 165 (save-buffer))) |
164 | 166 |
165 ;;; novice.el ends here | 167 ;;; novice.el ends here |