Add unset capability to set-file-template!
This commit is contained in:
parent
445ca59b67
commit
8bd9b24137
1 changed files with 8 additions and 2 deletions
|
@ -1,5 +1,10 @@
|
||||||
;;; feature/file-templates/autoload.el -*- lexical-binding: t; -*-
|
;;; feature/file-templates/autoload.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(defun +file-templates--set (pred plist)
|
||||||
|
(if (null (car-safe plist))
|
||||||
|
(setq +file-templates-alist (map-delete +file-templates-alist pred))
|
||||||
|
(push `(,pred ,@plist) +file-templates-alist)))
|
||||||
|
|
||||||
;;;###autodef
|
;;;###autodef
|
||||||
(defun set-file-template! (pred &rest plist)
|
(defun set-file-template! (pred &rest plist)
|
||||||
"Register a file template.
|
"Register a file template.
|
||||||
|
@ -23,13 +28,14 @@ these properties:
|
||||||
If non-nil, don't expand any template for this file and don't test any other
|
If non-nil, don't expand any template for this file and don't test any other
|
||||||
file template rule against this buffer."
|
file template rule against this buffer."
|
||||||
(after! (:when (boundp '+file-templates-alist))
|
(after! (:when (boundp '+file-templates-alist))
|
||||||
(push `(,pred ,@plist) +file-templates-alist)))
|
(+file-templates--set pred plist)))
|
||||||
|
|
||||||
;;;###autodef
|
;;;###autodef
|
||||||
(defun set-file-templates! (&rest templates)
|
(defun set-file-templates! (&rest templates)
|
||||||
"Like `set-file-templates!', but register many file templates at once."
|
"Like `set-file-templates!', but register many file templates at once."
|
||||||
(after! (:when (boundp '+file-templates-alist))
|
(after! (:when (boundp '+file-templates-alist))
|
||||||
(setq +file-templates-alist (append (list templates) +file-templates-alist))))
|
(dolist (template templates)
|
||||||
|
(+file-templates--set (car template) (cdr template)))))
|
||||||
|
|
||||||
;; FIXME obsolete :file-template
|
;; FIXME obsolete :file-template
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue