* paths.el (abbrev-file-name): Move to abbrev.el.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 29 Aug 2009 19:22:38 +0000 (19:22 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 29 Aug 2009 19:22:38 +0000 (19:22 +0000)
* 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.

etc/NEWS
lisp/ChangeLog
lisp/abbrev.el
lisp/calc/calc.el
lisp/dos-fns.el
lisp/paths.el
lisp/startup.el

index 042694f..ed4397a 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -117,6 +117,8 @@ default-file-name-coding-system on Mac OS X.
 \f
 * 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.
index 4bf474b..a06b9ff 100644 (file)
@@ -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):
index 4a2c57d..6441381 100644 (file)
@@ -27,7 +27,6 @@
 
 ;; Todo:
 
-;; - Make abbrev-file-name obey user-emacs-directory.
 ;; - Cleanup name space.
 
 ;;; Code:
   :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
index 8e6af0d..790647d 100644 (file)
   :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))
index 37a1a9c..5b3c5df 100644 (file)
@@ -224,16 +224,7 @@ returned unaltered."
 ;; 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)
index 10881e5..385df84 100644 (file)
@@ -181,9 +181,5 @@ If non-nil, Emacs startup does (load (concat term-file-prefix (getenv \"TERM\"))
 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
index cc2165b..1253284 100644 (file)
@@ -721,6 +721,9 @@ opening the first frame (e.g. open a connection to an X server).")
   (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 @@ To quit a partially entered command, type Control-g.\n")
 
   ;; 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"))
-
-      (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]"))))
+  (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 "\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 @@ Type \\[describe-distribution] for information on "))
                 (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 @@ A fancy display is used on graphic displays, normal otherwise."
            ;; 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 @@ A fancy display is used on graphic displays, normal otherwise."
        ;; 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 @@ A fancy display is used on graphic displays, normal otherwise."
                (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)))