]> code.delx.au - gnu-emacs/blobdiff - lisp/help-fns.el
; Merge from origin/emacs-25
[gnu-emacs] / lisp / help-fns.el
index e750f51e0c4b84f300dc5e8771419616a1498616..c3a5f26d261a274f82632ed24b15b1a4fcbc3c57 100644 (file)
@@ -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))))))
 
@@ -918,29 +917,28 @@ if it is given a local binding.\n"))))
                         ;; 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)))
+                            ;; (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 ")
-                        (let ((files (file-expand-wildcards file)))
-                          (princ (substitute-command-keys
-                                  (cond
-                                   (is-directory "for the directory\n  `")
-                                   ;; Many files matched.
-                                   ((cdr files)
-                                    (setq file (file-name-directory (car files)))
-                                    (format "by a file\n  matching `%s' in the directory\n  `"
-                                            dir-locals-file))
-                                   (t (setq file (car files))
-                                      "by the file\n  `"))))
+                        (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"))))