X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/665a035ee2def7f004f99dae0ff5580a122446ba..c69aef14ddc150da07dcd3527b5a9fb99d6cef34:/lisp/help-fns.el diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 958a075494..c3a5f26d26 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -1,6 +1,6 @@ ;;; help-fns.el --- Complex help functions -*- lexical-binding: t -*- -;; Copyright (C) 1985-1986, 1993-1994, 1998-2015 Free Software +;; Copyright (C) 1985-1986, 1993-1994, 1998-2016 Free Software ;; Foundation, Inc. ;; Maintainer: emacs-devel@gnu.org @@ -296,7 +296,6 @@ suitable file is found, return nil." (substring-no-properties lib-name 0 -1) lib-name) file-name)) - ;; The next three forms are from `find-source-lisp-file'. (src-file (locate-library file-name t nil 'readable))) (and src-file (file-readable-p src-file) src-file)))))) @@ -763,8 +762,12 @@ it is displayed along with the global value." (let ((from (point)) (line-beg (line-beginning-position)) (print-rep - (let ((print-quoted t)) - (prin1-to-string val)))) + (let ((rep + (let ((print-quoted t)) + (prin1-to-string val)))) + (if (and (symbolp val) (not (booleanp val))) + (format-message "`%s'" rep) + rep)))) (if (< (+ (length print-rep) (point) (- line-beg)) 68) (insert print-rep) (terpri) @@ -907,29 +910,35 @@ if it is given a local binding.\n")))) (buffer-file-name buffer))) (dir-locals-find-file (buffer-file-name buffer)))) - (dir-file t)) + (is-directory nil)) (princ (substitute-command-keys " This variable's value is directory-local")) - (if (null file) - (princ ".\n") - (princ ", set ") - (if (consp file) ; result from cache - ;; If the cache element has an mtime, we - ;; assume it came from a file. - (if (nth 2 file) - (setq file (expand-file-name - dir-locals-file (car file))) - ;; Otherwise, assume it was set directly. - (setq file (car file) - dir-file nil))) - (princ (substitute-command-keys - (if dir-file - "by the file\n `" - "for the directory\n `"))) + (when (consp file) ; result from cache + ;; If the cache element has an mtime, we + ;; assume it came from a file. + (if (nth 2 file) + ;; (car file) is a directory. + (setq file (dir-locals--all-files (car file))) + ;; Otherwise, assume it was set directly. + (setq file (car file) + is-directory t))) + (if (null file) + (princ ".\n") + (princ ", set ") + (princ (substitute-command-keys + (cond + (is-directory "for the directory\n `") + ;; Many files matched. + ((and (consp file) (cdr file)) + (setq file (file-name-directory (car file))) + (format "by one of the\n %s files in the directory\n `" + dir-locals-file)) + (t (setq file (car file)) + "by the file\n `")))) (with-current-buffer standard-output (insert-text-button file 'type 'help-dir-local-var-def - 'help-args (list variable file))) + 'help-args (list variable file))) (princ (substitute-command-keys "'.\n")))) (princ (substitute-command-keys " This variable's value is file-local.\n")))) @@ -990,7 +999,10 @@ file-local variable.\n") ;;;###autoload (defun describe-symbol (symbol &optional buffer frame) "Display the full documentation of SYMBOL. -Will show the info of SYMBOL as a function, variable, and/or face." +Will show the info of SYMBOL as a function, variable, and/or face. +Optional arguments BUFFER and FRAME specify for which buffer and +frame to show the information about SYMBOL; they default to the +current buffer and the selected frame, respectively." (interactive (let* ((v-or-f (symbol-at-point)) (found (cl-some (lambda (x) (funcall (nth 1 x) v-or-f)) @@ -1033,15 +1045,17 @@ Will show the info of SYMBOL as a function, variable, and/or face." (let ((inhibit-read-only t) (name (caar docs)) ;Name of doc currently at BOB. (doc (cdr (cadr docs)))) ;Doc to add at BOB. - (insert doc) - (delete-region (point) (progn (skip-chars-backward " \t\n") (point))) - (insert "\n\n" - (eval-when-compile - (propertize "\n" 'face '(:height 0.1 :inverse-video t))) - "\n") - (when name - (insert (symbol-name symbol) - " is also a " name "." "\n\n"))) + (when doc + (insert doc) + (delete-region (point) + (progn (skip-chars-backward " \t\n") (point))) + (insert "\n\n" + (eval-when-compile + (propertize "\n" 'face '(:height 0.1 :inverse-video t))) + "\n") + (when name + (insert (symbol-name symbol) + " is also a " name "." "\n\n")))) (setq docs (cdr docs))) (unless single ;; Don't record the `describe-variable' item in the stack.