X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/974b73e83842d63b14512aa225cc53983a9b5d14..0a957b2f7720a1bd177b37c32e11b4dee8f807c0:/lisp/help-fns.el diff --git a/lisp/help-fns.el b/lisp/help-fns.el index a105083aaf..cb99d188ff 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -1,7 +1,7 @@ ;;; help-fns.el --- Complex help functions ;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001, -;; 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +;; 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: help, internal @@ -10,7 +10,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) +;; the Free Software Foundation; either version 3, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, @@ -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 @@ -400,7 +421,7 @@ face (according to `face-differs-from-default-p')." ;;;###autoload (defun variable-at-point (&optional any-symbol) - "Return the bound variable symbol found around point. + "Return the bound variable symbol found at or before point. Return 0 if there is no such symbol. If ANY-SYMBOL is non-nil, don't insist the symbol be bound." (or (condition-case () @@ -561,7 +582,11 @@ it is displayed along with the global value." ;; of a symbol. (set-syntax-table emacs-lisp-mode-syntax-table) (goto-char val-start-pos) - (delete-region (point) (progn (end-of-line) (point))) + ;; The line below previously read as + ;; (delete-region (point) (progn (end-of-line) (point))) + ;; which suppressed display of the buffer local value for + ;; large values. + (when (looking-at "value is") (replace-match "")) (save-excursion (insert "\n\nValue:") (set (make-local-variable 'help-button-cache) @@ -571,7 +596,7 @@ it is displayed along with the global value." 'action help-button-cache 'follow-link t 'help-echo "mouse-2, RET: show value") - (insert ".\n\n"))) + (insert ".\n"))) ;; Mention if it's an alias (let* ((alias (condition-case nil @@ -583,8 +608,11 @@ it is displayed along with the global value." (documentation-property alias 'variable-documentation)))) (unless (eq alias variable) (princ (format "\nThis variable is an alias for `%s'.\n" alias))) + (if (or obsolete safe-var) + (terpri)) + (when obsolete - (princ "\nThis variable is obsolete") + (princ "This variable is obsolete") (if (cdr obsolete) (princ (format " since %s" (cdr obsolete)))) (princ ";") (terpri) (princ (if (stringp (car obsolete)) (car obsolete) @@ -595,10 +623,10 @@ it is displayed along with the global value." (princ "if its value\nsatisfies the predicate ") (princ (if (byte-code-function-p safe-var) "which is byte-compiled expression.\n" - (format "`%s'.\n" safe-var))) - (terpri)) - (princ "Documentation:\n") - (princ (or doc "Not documented as a variable."))) + (format "`%s'.\n" safe-var)))) + (princ "\nDocumentation:\n") + (with-current-buffer standard-output + (insert (or doc "Not documented as a variable.")))) ;; Make a link to customize if this variable can be customized. (if (custom-variable-p variable) (let ((customize-label "customize"))