- (setq 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)))
- ;; Try to make a proper file-name. This doesn't cover all
- ;; wildcards, but it covers the default value of `dir-locals-file'.
- (t (replace-regexp-in-string
- "\\*" "" (replace-regexp-in-string "\\?" "-" dir-locals-file)))))
+ (if (consp variables-file) ; result from cache
+ ;; If cache element has an mtime, assume it came from a file.
+ ;; Otherwise, assume it was set directly.
+ (setq variables-file (if (nth 2 variables-file)
+ (expand-file-name dir-locals-file
+ (car variables-file))
+ (cadr variables-file))))