diff options
| author | Eli Zaretskii | 2001-05-27 06:18:28 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2001-05-27 06:18:28 +0000 |
| commit | 49b1a63801d264d7cb9a417d2bb1b461c738acf4 (patch) | |
| tree | 0d6583057733bab7dea589311080208b020e81a8 | |
| parent | 86f6474ca2761ee7a9346a350dda6d9ec053ddc0 (diff) | |
| download | emacs-49b1a63801d264d7cb9a417d2bb1b461c738acf4.tar.gz emacs-49b1a63801d264d7cb9a417d2bb1b461c738acf4.zip | |
(enable-command): If user-init-file is nil or does not
exist, default to "~/.emacs" (~/_emacs on DOS and, maybe, Windows).
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/novice.el | 34 |
2 files changed, 26 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 57184acb695..7d513375741 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2001-05-27 Eli Zaretskii <eliz@is.elta.co.il> | ||
| 2 | |||
| 3 | * novice.el (enable-command): If user-init-file is nil or does not | ||
| 4 | exist, default to "~/.emacs" (~/_emacs on DOS and, maybe, Windows). | ||
| 5 | |||
| 1 | 2001-05-25 Stefan Monnier <monnier@cs.yale.edu> | 6 | 2001-05-25 Stefan Monnier <monnier@cs.yale.edu> |
| 2 | 7 | ||
| 3 | * textmodes/tex-mode.el (tex-mode-syntax-table): Add ^. | 8 | * textmodes/tex-mode.el (tex-mode-syntax-table): Add ^. |
diff --git a/lisp/novice.el b/lisp/novice.el index d57aa224a8d..348774a90fa 100644 --- a/lisp/novice.el +++ b/lisp/novice.el | |||
| @@ -107,19 +107,27 @@ The user's .emacs file is altered so that this will apply | |||
| 107 | to future sessions." | 107 | to future sessions." |
| 108 | (interactive "CEnable command: ") | 108 | (interactive "CEnable command: ") |
| 109 | (put command 'disabled nil) | 109 | (put command 'disabled nil) |
| 110 | (save-excursion | 110 | (let ((init-file user-init-file)) |
| 111 | (set-buffer (find-file-noselect | 111 | (when (or (not (stringp init-file)) |
| 112 | (substitute-in-file-name user-init-file))) | 112 | (not (file-exists-p init-file))) |
| 113 | (goto-char (point-min)) | 113 | (setq init-file (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs")) |
| 114 | (if (search-forward (concat "(put '" (symbol-name command) " ") nil t) | 114 | (if (and (not (file-exists-p init-file)) |
| 115 | (delete-region | 115 | (eq system-type 'windows-nt) |
| 116 | (progn (beginning-of-line) (point)) | 116 | (file-exists-p "~/_emacs")) |
| 117 | (progn (forward-line 1) (point)))) | 117 | (setq init-file "~/_emacs"))) |
| 118 | ;; Explicitly enable, in case this command is disabled by default | 118 | (save-excursion |
| 119 | ;; or in case the code we deleted was actually a comment. | 119 | (set-buffer (find-file-noselect |
| 120 | (goto-char (point-max)) | 120 | (substitute-in-file-name init-file))) |
| 121 | (insert "\n(put '" (symbol-name command) " 'disabled nil)\n") | 121 | (goto-char (point-min)) |
| 122 | (save-buffer))) | 122 | (if (search-forward (concat "(put '" (symbol-name command) " ") nil t) |
| 123 | (delete-region | ||
| 124 | (progn (beginning-of-line) (point)) | ||
| 125 | (progn (forward-line 1) (point)))) | ||
| 126 | ;; Explicitly enable, in case this command is disabled by default | ||
| 127 | ;; or in case the code we deleted was actually a comment. | ||
| 128 | (goto-char (point-max)) | ||
| 129 | (insert "\n(put '" (symbol-name command) " 'disabled nil)\n") | ||
| 130 | (save-buffer)))) | ||
| 123 | 131 | ||
| 124 | ;;;###autoload | 132 | ;;;###autoload |
| 125 | (defun disable-command (command) | 133 | (defun disable-command (command) |