From 6a378d89c52530744c24bc92342904347331b758 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 14 Feb 2013 00:05:26 -0800 Subject: [PATCH] * help-fns.el (find-lisp-object-file-name): Give special treatment to all ~/.foo.elc files, not just ~/.emacs. Fixes: debbugs:9007 --- lisp/ChangeLog | 5 +++++ lisp/help-fns.el | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 362567cbe41..cb3f0fcc978 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-02-14 Glenn Morris + + * help-fns.el (find-lisp-object-file-name): Give special treatment + to all ~/.foo.elc files, not just ~/.emacs. (Bug#9007) + 2013-02-14 David Biesack (tiny change) * net/quickurl.el (quickurl-save-urls): diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 178096d1024..bdf86016844 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -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. -- 2.39.5