Make yas-snippet-mode-buffer-p robust against symlinks

* yasnippet.el (yas-snippet-mode-buffer-p): Instead of a string
comparison of file names to check whether the buffer file is in on of
the `yas-snippet-dirs', use the builtin `file-in-directory-p'
function.
This commit is contained in:
Noam Postavsky 2018-02-18 07:55:56 -05:00
parent cf23537279
commit 3d7cafccf8

View File

@ -984,11 +984,8 @@ Honour `yas-dont-activate-functions', which see."
Meaning it's visiting a file under one of the mode directories in Meaning it's visiting a file under one of the mode directories in
`yas-snippet-dirs'." `yas-snippet-dirs'."
(when buffer-file-name (when buffer-file-name
(member (cl-member buffer-file-name (yas-snippet-dirs)
(expand-file-name :test #'file-in-directory-p)))
".."
(file-name-directory buffer-file-name))
(yas-snippet-dirs))))
;; We're abusing `magic-fallback-mode-alist' here because ;; We're abusing `magic-fallback-mode-alist' here because
;; `auto-mode-alist' doesn't support function matchers. ;; `auto-mode-alist' doesn't support function matchers.