summaryrefslogtreecommitdiff
path: root/lisp/help-fns.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-11-07 13:54:56 +0000
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-11-07 13:55:16 +0000
commit3d4fdb9f59731113f467b3705c8346b1ee8d2d81 (patch)
tree0a4b971094880b5ea3f48fb275537851b9f9edf6 /lisp/help-fns.el
parent8af7598d9851c067176ced829d8a5902f3afcbc1 (diff)
downloademacs-scratch/dir-local-wildcard.tar.gz
* lisp/files.el (dir-locals-file): Allow wildcardsscratch/dir-local-wildcard
(dir-locals-find-file, dir-locals-collect-variables) (dir-locals-read-from-file): Update accordingly. (hack-dir-local-variables): Rename a local variable.
Diffstat (limited to 'lisp/help-fns.el')
-rw-r--r--lisp/help-fns.el43
1 files changed, 25 insertions, 18 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 958a0754946..4e0bfee5bf7 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -907,29 +907,36 @@ 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)
+ (setq file (expand-file-name
+ dir-locals-file (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 `"))))
(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"))))