aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Malabarba2016-01-25 16:56:08 +0000
committerArtur Malabarba2016-01-25 23:42:41 +0000
commit914fb99d38f8a9db7fbf926d0cf34b808d581afe (patch)
treec0bd9d9b0900613e7fad0e5583d2754949e6bff5
parent777c712c9c419d20de2602e53308fca2eb8442b3 (diff)
downloademacs-914fb99d38f8a9db7fbf926d0cf34b808d581afe.tar.gz
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.
-rw-r--r--lisp/files-x.el29
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."
429 (catch 'exit 429 (catch 'exit
430 (unless enable-local-variables 430 (unless enable-local-variables
431 (throw 'exit (message "Directory-local variables are disabled"))) 431 (throw 'exit (message "Directory-local variables are disabled")))
432 (let ((variables-file (and (buffer-file-name) 432 (let* ((dir-or-cache (and (buffer-file-name)
433 (not (file-remote-p (buffer-file-name))) 433 (not (file-remote-p (buffer-file-name)))
434 (dir-locals-find-file (buffer-file-name)))) 434 (dir-locals-find-file (buffer-file-name))))
435 variables) 435 (variables-file
436 (setq variables-file
437 ;; If there are several .dir-locals, the user probably 436 ;; If there are several .dir-locals, the user probably
438 ;; wants to edit the last one (the highest priority). 437 ;; wants to edit the last one (the highest priority).
439 (cond ((stringp variables-file) 438 (cond ((stringp dir-or-cache)
440 (car (last (dir-locals--all-files variables-file)))) 439 (car (last (dir-locals--all-files dir-or-cache))))
441 ((consp variables-file) ; result from cache 440 ((consp dir-or-cache) ; result from cache
442 ;; If cache element has an mtime, assume it came from a file. 441 ;; If cache element has an mtime, assume it came
443 ;; Otherwise, assume it was set directly. 442 ;; from a file. Otherwise, assume it was set
444 (if (nth 2 variables-file) 443 ;; directly.
445 (car (last (dir-locals--all-files (car variables-file)))) 444 (if (nth 2 dir-or-cache)
446 (cadr variables-file))) 445 (car (last (dir-locals--all-files (car dir-or-cache))))
446 (cadr dir-or-cache)))
447 ;; Try to make a proper file-name. 447 ;; Try to make a proper file-name.
448 (t (concat dir-locals-file ".el")))) 448 (t (expand-file-name dir-locals-file))))
449 variables)
449 ;; I can't be bothered to handle this case right now. 450 ;; I can't be bothered to handle this case right now.
450 ;; Dir locals were set directly from a class. You need to 451 ;; Dir locals were set directly from a class. You need to
451 ;; directly modify the class in dir-locals-class-alist. 452 ;; directly modify the class in dir-locals-class-alist.