diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2016-01-25 16:56:08 +0000 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2016-01-25 23:42:41 +0000 |
commit | 914fb99d38f8a9db7fbf926d0cf34b808d581afe (patch) | |
tree | c0bd9d9b0900613e7fad0e5583d2754949e6bff5 /lisp/files-x.el | |
parent | 777c712c9c419d20de2602e53308fca2eb8442b3 (diff) | |
download | emacs-914fb99d38f8a9db7fbf926d0cf34b808d581afe.tar.gz emacs-914fb99d38f8a9db7fbf926d0cf34b808d581afe.tar.bz2 emacs-914fb99d38f8a9db7fbf926d0cf34b808d581afe.zip |
* lisp/files-x.el (modify-dir-local-variable): Small rewrite
Change a variable name to be more meaningful, and reorder some of
the code with no change in behaviour.
Diffstat (limited to 'lisp/files-x.el')
-rw-r--r-- | lisp/files-x.el | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/lisp/files-x.el b/lisp/files-x.el index 2e1a728356e..05ad7f57c57 100644 --- a/lisp/files-x.el +++ b/lisp/files-x.el @@ -429,23 +429,24 @@ from the MODE alist ignoring the input argument VALUE." (catch 'exit (unless enable-local-variables (throw 'exit (message "Directory-local variables are disabled"))) - (let ((variables-file (and (buffer-file-name) - (not (file-remote-p (buffer-file-name))) - (dir-locals-find-file (buffer-file-name)))) - variables) - (setq variables-file + (let* ((dir-or-cache (and (buffer-file-name) + (not (file-remote-p (buffer-file-name))) + (dir-locals-find-file (buffer-file-name)))) + (variables-file ;; If there are several .dir-locals, the user probably ;; wants to edit the last one (the highest priority). - (cond ((stringp variables-file) - (car (last (dir-locals--all-files variables-file)))) - ((consp variables-file) ; result from cache - ;; If cache element has an mtime, assume it came from a file. - ;; Otherwise, assume it was set directly. - (if (nth 2 variables-file) - (car (last (dir-locals--all-files (car variables-file)))) - (cadr variables-file))) + (cond ((stringp dir-or-cache) + (car (last (dir-locals--all-files dir-or-cache)))) + ((consp dir-or-cache) ; result from cache + ;; If cache element has an mtime, assume it came + ;; from a file. Otherwise, assume it was set + ;; directly. + (if (nth 2 dir-or-cache) + (car (last (dir-locals--all-files (car dir-or-cache)))) + (cadr dir-or-cache))) ;; Try to make a proper file-name. - (t (concat dir-locals-file ".el")))) + (t (expand-file-name dir-locals-file)))) + variables) ;; I can't be bothered to handle this case right now. ;; Dir locals were set directly from a class. You need to ;; directly modify the class in dir-locals-class-alist. |