changeset 104712:c4fb8f245750

* paths.el (abbrev-file-name): Move to abbrev.el. * abbrev.el (abbrev-file-name): Move from paths.el. Obey user-emacs-directory. * calc/calc.el (calc-settings-file): Don't autoload and instead obey user-emacs-directory. * dos-fns.el (dos-reevaluate-defcustoms): Don't reevaluate abbrev-file-name and calc-settings-file any more. * startup.el (command-line): Recompute abbrev-file-name and abbreviated-home-dir. (normal-no-mouse-startup-screen): Improve the generic code and get rid of the special code for when C-h bindings haven't been changed. (display-startup-echo-area-message): Use with-current-buffer. (command-line-1): Use a list of strings, rather than a list of lists of strings for longopts.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 29 Aug 2009 19:22:38 +0000
parents adeed914a5fb
children bf61a80c87b4
files etc/NEWS lisp/ChangeLog lisp/abbrev.el lisp/calc/calc.el lisp/dos-fns.el lisp/paths.el lisp/startup.el
diffstat 7 files changed, 74 insertions(+), 87 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS	Sat Aug 29 18:56:12 2009 +0000
+++ b/etc/NEWS	Sat Aug 29 19:22:38 2009 +0000
@@ -117,6 +117,8 @@
 
 * Changes in Specialized Modes and Packages in Emacs 23.2
 
+** .calc.el and .abbrev_defs obey user-emacs-directory.
+
 ** Calc graphing commands (`g f' etc.) now work on MS-Windows,
 if you have the native Windows port of Gnuplot version 3.8 or later
 installed.
--- a/lisp/ChangeLog	Sat Aug 29 18:56:12 2009 +0000
+++ b/lisp/ChangeLog	Sat Aug 29 19:22:38 2009 +0000
@@ -9,6 +9,21 @@
 
 2009-08-29  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* paths.el (abbrev-file-name): Move to abbrev.el.
+	* abbrev.el (abbrev-file-name): Move from paths.el.
+	Obey user-emacs-directory.
+	* calc/calc.el (calc-settings-file): Don't autoload and instead obey
+	user-emacs-directory.
+	* dos-fns.el (dos-reevaluate-defcustoms): Don't reevaluate
+	abbrev-file-name and calc-settings-file any more.
+	* startup.el (command-line): Recompute abbrev-file-name and
+	abbreviated-home-dir.
+	(normal-no-mouse-startup-screen): Improve the generic code and get rid
+	of the special code for when C-h bindings haven't been changed.
+	(display-startup-echo-area-message): Use with-current-buffer.
+	(command-line-1): Use a list of strings, rather than a list of lists
+	of strings for longopts.
+
 	* files.el (get-free-disk-space): Use / for default-directory.
 
 	* textmodes/ispell.el (ispell-accept-output, ispell-command-loop):
--- a/lisp/abbrev.el	Sat Aug 29 18:56:12 2009 +0000
+++ b/lisp/abbrev.el	Sat Aug 29 19:22:38 2009 +0000
@@ -27,7 +27,6 @@
 
 ;; Todo:
 
-;; - Make abbrev-file-name obey user-emacs-directory.
 ;; - Cleanup name space.
 
 ;;; Code:
@@ -39,6 +38,11 @@
   :link '(custom-manual "(emacs)Abbrevs")
   :group 'abbrev)
 
+(defcustom abbrev-file-name
+  (locate-user-emacs-file "abbrev_defs" ".abbrev_defs")
+  "Default name of file to read abbrevs from."
+  :type 'file)
+
 (defcustom only-global-abbrevs nil
   "Non-nil means user plans to use global abbrevs only.
 This makes the commands that normally define mode-specific abbrevs
--- a/lisp/calc/calc.el	Sat Aug 29 18:56:12 2009 +0000
+++ b/lisp/calc/calc.el	Sat Aug 29 19:22:38 2009 +0000
@@ -227,9 +227,10 @@
   :tag    "Calc"
   :group  'applications)
 
-;;;###autoload
+;; Do not autoload, so it is evaluated at run-time rather than at dump time.
+;; ;;;###autoload
 (defcustom calc-settings-file
-  (convert-standard-filename "~/.calc.el")
+  (locate-user-emacs-file "calc.el" ".calc.el")
   "File in which to record permanent settings."
   :group 'calc
   :type '(file))
--- a/lisp/dos-fns.el	Sat Aug 29 18:56:12 2009 +0000
+++ b/lisp/dos-fns.el	Sat Aug 29 19:22:38 2009 +0000
@@ -224,16 +224,7 @@
 ;; see if the list of defcustom's below is up to date, run the command
 ;; "M-x apropos-value RET ~/\. RET".
 (defun dos-reevaluate-defcustoms ()
-  ;; This was computed in paths.el, but that was at dump time.
-  (setq abbrev-file-name
-	(if (msdos-long-file-names)
-	    "~/.abbrev_defs"
-	  "~/_abbrev.defs"))
-  ;; This was computed in loaddefs.el, but that was at dump time.
-  (setq calc-settings-file
-	(if (msdos-long-file-names)
-	    "~/.calc.el"
-	  "~/_calc.el"))
+  ;; This was computed at dump time.
   (custom-reevaluate-setting 'trash-directory))
 
 (add-hook 'before-init-hook 'dos-reevaluate-defcustoms)
--- a/lisp/paths.el	Sat Aug 29 18:56:12 2009 +0000
+++ b/lisp/paths.el	Sat Aug 29 19:22:38 2009 +0000
@@ -181,9 +181,5 @@
 You may set this variable to nil in your `.emacs' file if you do not wish
 the terminal-initialization file to be loaded.")
 
-(defvar abbrev-file-name
-  (convert-standard-filename "~/.abbrev_defs")
-  "*Default name of file to read abbrevs from.")
-
 ;; arch-tag: bae27ffb-9944-4c87-b569-30d4635a99e1
 ;;; paths.el ends here
--- a/lisp/startup.el	Sat Aug 29 18:56:12 2009 +0000
+++ b/lisp/startup.el	Sat Aug 29 19:22:38 2009 +0000
@@ -721,6 +721,9 @@
   (custom-reevaluate-setting 'temporary-file-directory)
   (custom-reevaluate-setting 'small-temporary-file-directory)
   (custom-reevaluate-setting 'auto-save-file-name-transforms)
+  (custom-reevaluate-setting 'abbrev-file-name)
+  ;; Force recomputation, in case it was computed during the dump.
+  (setq abbreviated-home-dir nil)
 
   ;; See if we should import version-control from the environment variable.
   (let ((vc (getenv "VERSION_CONTROL")))
@@ -1822,68 +1825,45 @@
 
   ;; If keys have their default meanings,
   ;; use precomputed string to save lots of time.
-  (let ((c-h-accessible
-         ;; If normal-erase-is-backspace is used on a tty, there's
-         ;; no way to invoke C-h and you have to use F1 instead.
-         (or (not (char-table-p keyboard-translate-table))
-             (eq (aref keyboard-translate-table ?\C-h) ?\C-h))))
-    (if (and (eq (key-binding "\C-h") 'help-command)
-             (eq (key-binding "\C-xu") 'advertised-undo)
-             (eq (key-binding "\C-x\C-c") 'save-buffers-kill-terminal)
-             (eq (key-binding "\C-ht") 'help-with-tutorial)
-             (eq (key-binding "\C-hi") 'info)
-             (eq (key-binding "\C-hr") 'info-emacs-manual)
-             (eq (key-binding "\C-h\C-n") 'view-emacs-news))
-        (let ((help (if c-h-accessible "C-h" "<f1>")))
-          (insert "
-Get help\t   " help "  (Hold down CTRL and press h)
-")
-          (insert-button "Emacs manual"
-                         'action (lambda (button) (info-emacs-manual))
-                         'follow-link t)
-          (insert "	   " help " r\t")
-          (insert-button "Browse manuals"
-                         'action (lambda (button) (Info-directory))
-                         'follow-link t)
-          (insert "\t   " help " i
-")
-          (insert-button "Emacs tutorial"
-                         'action (lambda (button) (help-with-tutorial))
-                         'follow-link t)
-          (insert "	   " help " t\tUndo changes\t   C-x u
-")
-          (insert-button "Buy manuals"
-                         'action (lambda (button) (view-order-manuals))
-                         'follow-link t)
-          (insert "\t   " help " C-m\tExit Emacs\t   C-x C-c"))
+  (let* ((c-h-accessible
+          ;; If normal-erase-is-backspace is used on a tty, there's
+          ;; no way to invoke C-h and you have to use F1 instead.
+          (or (not (char-table-p keyboard-translate-table))
+              (eq (aref keyboard-translate-table ?\C-h) ?\C-h)))
+         (minor-mode-overriding-map-alist
+          (cons (cons (not c-h-accessible)
+                      ;; If C-h can't be invoked, temporarily disable its
+                      ;; binding, so where-is uses alternative bindings.
+                      (let ((map (make-sparse-keymap)))
+                        (define-key map [?\C-h] 'undefined)
+                        map))
+                minor-mode-overriding-map-alist)))
 
-      (insert (format "
-Get help\t   %s
-"
-                      (let ((where (where-is-internal 'help-command nil t)))
-                        (if where
-                            (key-description where)
-                          "M-x help"))))
-      (insert-button "Emacs manual"
-                     'action (lambda (button) (info-emacs-manual))
-                     'follow-link t)
-      (insert (substitute-command-keys"\t   \\[info-emacs-manual]\t"))
-      (insert-button "Browse manuals"
-                     'action (lambda (button) (Info-directory))
-                     'follow-link t)
-      (insert (substitute-command-keys "\t   \\[info]
-"))
-      (insert-button "Emacs tutorial"
-                     'action (lambda (button) (help-with-tutorial))
-                     'follow-link t)
-      (insert (substitute-command-keys
-               "\t   \\[help-with-tutorial]\tUndo changes\t   \\[advertised-undo]
-"))
-      (insert-button "Buy manuals"
-                     'action (lambda (button) (view-order-manuals))
-                     'follow-link t)
-      (insert (substitute-command-keys
-	       "\t   \\[view-order-manuals]\tExit Emacs\t   \\[save-buffers-kill-terminal]"))))
+    (insert (format "\nGet help\t   %s\n"
+                    (let ((where (where-is-internal 'help-command nil t)))
+                      (cond
+                       ((equal where [?\C-h])
+                        "C-h  (Hold down CTRL and press h)")
+                       (where (key-description where))
+                       (t "M-x help")))))
+    (insert-button "Emacs manual"
+                   'action (lambda (button) (info-emacs-manual))
+                   'follow-link t)
+    (insert (substitute-command-keys"\t   \\[info-emacs-manual]\t"))
+    (insert-button "Browse manuals"
+                   'action (lambda (button) (Info-directory))
+                   'follow-link t)
+    (insert (substitute-command-keys "\t   \\[info]\n"))
+    (insert-button "Emacs tutorial"
+                   'action (lambda (button) (help-with-tutorial))
+                   'follow-link t)
+    (insert (substitute-command-keys
+             "\t   \\[help-with-tutorial]\tUndo changes\t   \\[advertised-undo]\n"))
+    (insert-button "Buy manuals"
+                   'action (lambda (button) (view-order-manuals))
+                   'follow-link t)
+    (insert (substitute-command-keys
+             "\t   \\[view-order-manuals]\tExit Emacs\t   \\[save-buffers-kill-terminal]")))
 
   ;; Say how to use the menu bar with the keyboard.
   (insert "\n")
@@ -2035,8 +2015,7 @@
 		 (let ((buffer (get-buffer-create " *temp*")))
 		   (prog1
 		       (condition-case nil
-			   (save-excursion
-			     (set-buffer buffer)
+			   (with-current-buffer buffer
 			     (insert-file-contents user-init-file)
 			     (re-search-forward
 			      (concat
@@ -2109,11 +2088,10 @@
 	    ;; This includes our standard options' long versions
 	    ;; and long versions of what's on command-switch-alist.
 	    (longopts
-	     (append '(("--funcall") ("--load") ("--insert") ("--kill")
-		       ("--directory") ("--eval") ("--execute") ("--no-splash")
-		       ("--find-file") ("--visit") ("--file") ("--no-desktop"))
-		     (mapcar (lambda (elt)
-			       (list (concat "-" (car elt))))
+           (append '("--funcall" "--load" "--insert" "--kill"
+                     "--directory" "--eval" "--execute" "--no-splash"
+                     "--find-file" "--visit" "--file" "--no-desktop")
+                   (mapcar (lambda (elt) (concat "-" (car elt)))
 			     command-switch-alist)))
 	    (line 0)
 	    (column 0))
@@ -2121,7 +2099,7 @@
 	;; Add the long X options to longopts.
 	(dolist (tem command-line-x-option-alist)
 	  (if (string-match "^--" (car tem))
-	      (push (list (car tem)) longopts)))
+            (push (car tem) longopts)))
 
 	;; Add the long NS options to longopts.
 	(dolist (tem command-line-ns-option-alist)
@@ -2149,7 +2127,7 @@
 		(if (eq completion t)
 		    (setq argi (substring argi 1))
 		  (if (stringp completion)
-		      (let ((elt (assoc completion longopts)))
+                  (let ((elt (member completion longopts)))
 			(or elt
 			    (error "Option `%s' is ambiguous" argi))
 			(setq argi (substring (car elt) 1)))