mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 13:33:04 +00:00
Remove support for filenames-as-triggers
This commit is contained in:
parent
f48317e7c5
commit
238e46a020
40
yasnippet.el
40
yasnippet.el
@ -396,14 +396,6 @@ An error string \"[yas] error\" is returned instead."
|
|||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'yasnippet)
|
:group 'yasnippet)
|
||||||
|
|
||||||
(defcustom yas/ignore-filenames-as-triggers nil
|
|
||||||
"If non-nil, don't derive tab triggers from filenames.
|
|
||||||
|
|
||||||
This means a snippet without a \"# key:'\ directive won't have a
|
|
||||||
tab trigger."
|
|
||||||
:type 'boolean
|
|
||||||
:group 'yasnippet)
|
|
||||||
|
|
||||||
(defcustom yas/visit-from-menu nil
|
(defcustom yas/visit-from-menu nil
|
||||||
"If non-nil visit snippets's files from menu, instead of expanding them.
|
"If non-nil visit snippets's files from menu, instead of expanding them.
|
||||||
|
|
||||||
@ -703,11 +695,6 @@ snippet itself contains a condition that returns the symbol
|
|||||||
(not yas/good-grace))
|
(not yas/good-grace))
|
||||||
:help "If non-nil don't raise errors in bad embedded eslip in snippets"
|
:help "If non-nil don't raise errors in bad embedded eslip in snippets"
|
||||||
:style toggle :selected yas/good-grace]
|
:style toggle :selected yas/good-grace]
|
||||||
["Ignore filenames as triggers"
|
|
||||||
(setq yas/ignore-filenames-as-triggers
|
|
||||||
(not yas/ignore-filenames-as-triggers))
|
|
||||||
:help "If non-nil don't derive tab triggers from filenames"
|
|
||||||
:style toggle :selected yas/ignore-filenames-as-triggers]
|
|
||||||
)
|
)
|
||||||
"----"
|
"----"
|
||||||
["Load snippets..." yas/load-directory
|
["Load snippets..." yas/load-directory
|
||||||
@ -1380,9 +1367,7 @@ Here's a list of currently recognized directives:
|
|||||||
(let* ((type 'snippet)
|
(let* ((type 'snippet)
|
||||||
(name (and file
|
(name (and file
|
||||||
(file-name-nondirectory file)))
|
(file-name-nondirectory file)))
|
||||||
(key (unless yas/ignore-filenames-as-triggers
|
(key nil)
|
||||||
(and name
|
|
||||||
(file-name-sans-extension name))))
|
|
||||||
template
|
template
|
||||||
bound
|
bound
|
||||||
condition
|
condition
|
||||||
@ -1640,10 +1625,6 @@ TEMPLATES is a list of `yas/template'."
|
|||||||
(yas/compute-major-mode-and-parents (concat directory
|
(yas/compute-major-mode-and-parents (concat directory
|
||||||
"/dummy"))))
|
"/dummy"))))
|
||||||
(default-directory directory)
|
(default-directory directory)
|
||||||
(yas/ignore-filenames-as-triggers
|
|
||||||
(or yas/ignore-filenames-as-triggers
|
|
||||||
(file-exists-p (concat directory "/"
|
|
||||||
".yas-ignore-filenames-as-triggers"))))
|
|
||||||
(snippet-defs nil))
|
(snippet-defs nil))
|
||||||
;; load the snippet files
|
;; load the snippet files
|
||||||
;;
|
;;
|
||||||
@ -1934,10 +1915,7 @@ not need to be a real mode."
|
|||||||
;; `yas/parse-template'.
|
;; `yas/parse-template'.
|
||||||
;;
|
;;
|
||||||
(let* ((file (seventh snippet))
|
(let* ((file (seventh snippet))
|
||||||
(key (or (car snippet)
|
(key (car snippet))
|
||||||
(unless yas/ignore-filenames-as-triggers
|
|
||||||
(and file
|
|
||||||
(file-name-sans-extension (file-name-nondirectory file))))))
|
|
||||||
(name (or (third snippet)
|
(name (or (third snippet)
|
||||||
(and file
|
(and file
|
||||||
(file-name-directory file))))
|
(file-name-directory file))))
|
||||||
@ -2483,12 +2461,6 @@ there, otherwise, proposes to create the first option returned by
|
|||||||
|
|
||||||
With optional prefix argument KILL quit the window and buffer."
|
With optional prefix argument KILL quit the window and buffer."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(let ((yas/ignore-filenames-as-triggers
|
|
||||||
(or yas/ignore-filenames-as-triggers
|
|
||||||
(and buffer-file-name
|
|
||||||
(locate-dominating-file
|
|
||||||
buffer-file-name
|
|
||||||
".yas-ignore-filenames-as-triggers")))))
|
|
||||||
(cond
|
(cond
|
||||||
;; We have `yas/editing-template', this buffer's
|
;; We have `yas/editing-template', this buffer's
|
||||||
;; content comes from a template which is already loaded and
|
;; content comes from a template which is already loaded and
|
||||||
@ -2521,12 +2493,12 @@ With optional prefix argument KILL quit the window and buffer."
|
|||||||
(symbol-name (first yas/guessed-modes))))))))
|
(symbol-name (first yas/guessed-modes))))))))
|
||||||
(set (make-local-variable 'yas/editing-template)
|
(set (make-local-variable 'yas/editing-template)
|
||||||
(yas/define-snippets-1 (yas/parse-template buffer-file-name)
|
(yas/define-snippets-1 (yas/parse-template buffer-file-name)
|
||||||
table))))))
|
table)))))
|
||||||
;; Now, offer to save this shit
|
;; Now, offer to save this shit iff:
|
||||||
;;
|
;;
|
||||||
;; 1) if `yas/snippet-dirs' is a list and its first element does not
|
;; 1) `yas/snippet-dirs' is a list and its first element does not
|
||||||
;; match this template's file (i.e. this is a library snippet, not
|
;; match this template's file (i.e. this is a library snippet, not
|
||||||
;; a user snippet).
|
;; a user snippet) OR
|
||||||
;;
|
;;
|
||||||
;; 2) yas/editing-template comes from a file that we cannot write to...
|
;; 2) yas/editing-template comes from a file that we cannot write to...
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user