Fix #4271: prevent file-templates in org-capture
This commit is contained in:
parent
3265c25821
commit
da54fa98ce
|
@ -8,6 +8,9 @@
|
|||
"The default yasnippet trigger key (a string) for file template rules that
|
||||
don't have a :trigger property in `+file-templates-alist'.")
|
||||
|
||||
(defvar +file-templates-inhibit nil
|
||||
"If non-nil, inhibit file template expansion.")
|
||||
|
||||
(defvar +file-templates-alist
|
||||
'(;; General
|
||||
(gitignore-mode)
|
||||
|
@ -133,7 +136,8 @@ information.")
|
|||
"Check if the current buffer is a candidate for file template expansion. It
|
||||
must be non-read-only, empty, and there must be a rule in
|
||||
`+file-templates-alist' that applies to it."
|
||||
(and buffer-file-name
|
||||
(and (not +file-templates-inhibit)
|
||||
buffer-file-name
|
||||
(not buffer-read-only)
|
||||
(bobp) (eobp)
|
||||
(not (member (substring (buffer-name) 0 1) '("*" " ")))
|
||||
|
@ -142,6 +146,11 @@ must be non-read-only, empty, and there must be a rule in
|
|||
(when-let (rule (cl-find-if #'+file-template-p +file-templates-alist))
|
||||
(apply #'+file-templates--expand rule))))
|
||||
|
||||
(defadvice! +file-templates-inhibit-in-org-capture-a (orig-fn &rest args)
|
||||
:around #'org-capture
|
||||
(let ((+file-templates-inhibit t))
|
||||
(apply orig-fn args)))
|
||||
|
||||
|
||||
;;
|
||||
;;; Bootstrap
|
||||
|
|
Loading…
Reference in New Issue
Block a user