]> code.delx.au - gnu-emacs/blobdiff - lisp/help-fns.el
* mh-e.texi (VERSION, EDITION, UPDATED, UPDATE-MONTH): Update for
[gnu-emacs] / lisp / help-fns.el
index bb3695abcc2d801422c882c86fbe94238d13a004..bdf860168443f0367eaf852cdda4f2f610110b8a 100644 (file)
@@ -1,7 +1,7 @@
 ;;; help-fns.el --- Complex help functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1993-1994, 1998-2012
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 1993-1994, 1998-2013 Free Software
+;; Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: help, internal
@@ -76,7 +76,7 @@ DEF is the function whose usage we're looking for in DOCSTRING."
   (when (and docstring (string-match "\n\n(fn\\(\\( .*\\)?)\\)\\'" docstring))
     (cons (format "(%s%s"
                  ;; Replace `fn' with the actual function name.
-                 (if (consp def) "anonymous" def)
+                 (if (symbolp def) def "anonymous")
                  (match-string 1 docstring))
          (unless (zerop (match-beginning 0))
             (substring docstring 0 (match-beginning 0))))))
@@ -336,11 +336,15 @@ suitable file is found, return nil."
       ;; If we don't have a file-name string by now, we lost.
       nil)
      ;; Now, `file-name' should have become an absolute file name.
-     ;; For files loaded from ~/.emacs.elc, try ~/.emacs.
+     ;; For files loaded from ~/.foo.elc, try ~/.foo.
+     ;; This applies to config files like ~/.emacs,
+     ;; which people sometimes compile.
      ((let (fn)
-       (and (string-equal file-name
-                          (expand-file-name ".emacs.elc" "~"))
-            (file-readable-p (setq fn (expand-file-name ".emacs" "~")))
+       (and (string-match "\\`\\..*\\.elc\\'"
+                          (file-name-nondirectory file-name))
+            (string-equal (file-name-directory file-name)
+                          (file-name-as-directory (expand-file-name "~")))
+            (file-readable-p (setq fn (file-name-sans-extension file-name)))
             fn)))
      ;; When the Elisp source file can be found in the install
      ;; directory, return the name of that file.