summaryrefslogtreecommitdiff
path: root/lisp/help-fns.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2007-05-25 02:47:22 +0000
committerMiles Bader <miles@gnu.org>2007-05-25 02:47:22 +0000
commit98db66cac2e07862a43014b57ebcc2f0fbfc07e6 (patch)
treef1ef3d994208c3c102c40454971e195fda91b42f /lisp/help-fns.el
parent24236bd83e64a3cfa96f01af3b2a925dd234612d (diff)
parent5dfdf72f7aee102988a98447de9d19523af50055 (diff)
downloademacs-98db66cac2e07862a43014b57ebcc2f0fbfc07e6.tar.gz
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 765-770) - Update from CVS - Merge from emacs--rel--22 - Merge from gnus--rel--5.10 * emacs--rel--22 (patch 24-25) * gnus--rel--5.10 (patch 222-223) - Update from CVS Revision: emacs@sv.gnu.org/emacs--multi-tty--0--patch-16
Diffstat (limited to 'lisp/help-fns.el')
-rw-r--r--lisp/help-fns.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index e03d98652ab..426db1116e3 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -232,6 +232,23 @@ face (according to `face-differs-from-default-p')."
libname)
file))))
+(defun find-source-lisp-file (file-name)
+ (let* ((elc-file (locate-file (concat file-name
+ (if (string-match "\\.el" file-name)
+ "c"
+ ".elc"))
+ load-path))
+ (str (if (and elc-file (file-readable-p elc-file))
+ (with-temp-buffer
+ (insert-file-contents-literally elc-file nil 0 256)
+ (buffer-string))))
+ (src-file (and str
+ (string-match ";;; from file \\(.*\\.el\\)" str)
+ (match-string 1 str))))
+ (if (and src-file (file-readable-p src-file))
+ src-file
+ file-name)))
+
;;;###autoload
(defun describe-function-1 (function)
(let* ((def (if (symbolp function)
@@ -309,6 +326,10 @@ face (according to `face-differs-from-default-p')."
;; but that's completely wrong when the user used load-file.
(princ (if (eq file-name 'C-source) "C source code" file-name))
(princ "'")
+ ;; See if lisp files are present where they where installed from.
+ (if (not (eq file-name 'C-source))
+ (setq file-name (find-source-lisp-file file-name)))
+
;; Make a hyperlink to the library.
(with-current-buffer standard-output
(save-excursion