aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Djärv2007-05-22 13:45:59 +0000
committerJan Djärv2007-05-22 13:45:59 +0000
commit2f041d624968c64b1c8a06d78b761a4226ddaf11 (patch)
treef4d2f69e00a52b3ae6a7e2f6bb4eac94b04f2e2d
parentc297055514ffc34bbf79ca4ed2c00d77d49d021c (diff)
downloademacs-2f041d624968c64b1c8a06d78b761a4226ddaf11.tar.gz
emacs-2f041d624968c64b1c8a06d78b761a4226ddaf11.zip
(find-source-lisp-file): New function.
(describe-function-1): Use find-source-lisp-file to find source file in compile tree.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/help-fns.el21
2 files changed, 27 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2ec6ae659e9..e36fed25413 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12007-05-22 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2
3 * help-fns.el (find-source-lisp-file): New function.
4 (describe-function-1): Use find-source-lisp-file to find source
5 file in compile tree.
6
12007-05-22 Eli Zaretskii <eliz@gnu.org> 72007-05-22 Eli Zaretskii <eliz@gnu.org>
2 8
3 * dos-w32.el (find-buffer-file-type-coding-system): Doc fix. 9 * dos-w32.el (find-buffer-file-type-coding-system): Doc fix.
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index dab6bdb157c..92354624d88 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -232,6 +232,23 @@ face (according to `face-differs-from-default-p')."
232 libname) 232 libname)
233 file)))) 233 file))))
234 234
235(defun find-source-lisp-file (file-name)
236 (let* ((elc-file (locate-file (concat file-name
237 (if (string-match "\\.el" file-name)
238 "c"
239 ".elc"))
240 load-path))
241 (str (if (and elc-file (file-readable-p elc-file))
242 (with-temp-buffer
243 (insert-file-contents-literally elc-file nil 0 256)
244 (buffer-string))))
245 (src-file (and str
246 (string-match ";;; from file \\(.*\\.el\\)" str)
247 (match-string 1 str))))
248 (if (and src-file (file-readable-p src-file))
249 src-file
250 file-name)))
251
235;;;###autoload 252;;;###autoload
236(defun describe-function-1 (function) 253(defun describe-function-1 (function)
237 (let* ((def (if (symbolp function) 254 (let* ((def (if (symbolp function)
@@ -309,6 +326,10 @@ face (according to `face-differs-from-default-p')."
309 ;; but that's completely wrong when the user used load-file. 326 ;; but that's completely wrong when the user used load-file.
310 (princ (if (eq file-name 'C-source) "C source code" file-name)) 327 (princ (if (eq file-name 'C-source) "C source code" file-name))
311 (princ "'") 328 (princ "'")
329 ;; See if lisp files are present where they where installed from.
330 (if (not (eq file-name 'C-source))
331 (setq file-name (find-source-lisp-file file-name)))
332
312 ;; Make a hyperlink to the library. 333 ;; Make a hyperlink to the library.
313 (with-current-buffer standard-output 334 (with-current-buffer standard-output
314 (save-excursion 335 (save-excursion