/[emacs]/emacs/lisp/novice.el
ViewVC logotype

Diff of /emacs/lisp/novice.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.28 by pj, Sun Jul 15 16:15:34 2001 UTC revision 1.28.4.1 by eliz, Sat Feb 2 13:00:42 2002 UTC
# Line 107  The user's .emacs file is altered so tha Line 107  The user's .emacs file is altered so tha
107  to future sessions."  to future sessions."
108    (interactive "CEnable command: ")    (interactive "CEnable command: ")
109    (put command 'disabled nil)    (put command 'disabled nil)
110    (let ((init-file user-init-file))    (let ((init-file user-init-file)
111      (when (or (not (stringp init-file))          (default-init-file
112                (not (file-exists-p init-file)))            (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs")))
113        (setq init-file (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs"))      (when (null init-file)
114          (if (or (file-exists-p default-init-file)
115                  (and (eq system-type 'windows-nt)
116                       (file-exists-p "~/_emacs")))
117              ;; Started with -q, i.e. the file containing
118              ;; enabled/disabled commands hasn't been read.  Saving
119              ;; settings there would overwrite other settings.
120              (error "Saving settings from \"emacs -q\" would overwrite existing customizations"))
121          (setq init-file default-init-file)
122        (if (and (not (file-exists-p init-file))        (if (and (not (file-exists-p init-file))
123                 (eq system-type 'windows-nt)                 (eq system-type 'windows-nt)
124                 (file-exists-p "~/_emacs"))                 (file-exists-p "~/_emacs"))
# Line 138  to future sessions." Line 146  to future sessions."
146    (if (not (commandp command))    (if (not (commandp command))
147        (error "Invalid command name `%s'" command))        (error "Invalid command name `%s'" command))
148    (put command 'disabled t)    (put command 'disabled t)
149      (let ((init-file user-init-file)
150            (default-init-file
151              (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs")))
152        (when (null init-file)
153          (if (or (file-exists-p default-init-file)
154                  (and (eq system-type 'windows-nt)
155                       (file-exists-p "~/_emacs")))
156              ;; Started with -q, i.e. the file containing
157              ;; enabled/disabled commands hasn't been read.  Saving
158              ;; settings there would overwrite other settings.
159              (error "Saving settings from \"emacs -q\" would overwrite existing customizations"))
160          (setq init-file default-init-file)
161          (if (and (not (file-exists-p init-file))
162                   (eq system-type 'windows-nt)
163                   (file-exists-p "~/_emacs"))
164              (setq init-file "~/_emacs")))
165    (save-excursion    (save-excursion
166     (set-buffer (find-file-noselect     (set-buffer (find-file-noselect
167                  (substitute-in-file-name user-init-file)))                  (substitute-in-file-name init-file)))
168     (goto-char (point-min))     (goto-char (point-min))
169     (if (search-forward (concat "(put '" (symbol-name command) " ") nil t)     (if (search-forward (concat "(put '" (symbol-name command) " ") nil t)
170         (delete-region         (delete-region
# Line 148  to future sessions." Line 172  to future sessions."
172          (progn (forward-line 1) (point))))          (progn (forward-line 1) (point))))
173     (goto-char (point-max))     (goto-char (point-max))
174     (insert "\n(put '" (symbol-name command) " 'disabled t)\n")     (insert "\n(put '" (symbol-name command) " 'disabled t)\n")
175     (save-buffer)))     (save-buffer))))
176    
177  (provide 'novice)  (provide 'novice)
178    

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.28.4.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26