autoload temp files generated by sd's tempfn_random
* adds 16 random hex digits to the end of file name * instead of a bunch of autoloads, draw regexp into a pair of defconst * not sure how to splice a reusable list of extensions into an rx call, which would be nicer than duplicating it
This commit is contained in:
parent
a86323e90b
commit
070e15e4c0
32
systemd.el
32
systemd.el
@ -73,6 +73,22 @@
|
|||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'systemd)
|
:group 'systemd)
|
||||||
|
|
||||||
|
(defconst systemd-autoload-regexp
|
||||||
|
(eval-when-compile
|
||||||
|
(rx "."
|
||||||
|
(or "automount" "busname" "mount" "service" "slice"
|
||||||
|
"socket" "swap" "target" "timer" "link" "netdev" "network")
|
||||||
|
string-end))
|
||||||
|
"Regexp for file buffers in which to autoload `systemd-mode'.")
|
||||||
|
|
||||||
|
(defconst systemd-tempfn-autoload-regexp
|
||||||
|
(eval-when-compile
|
||||||
|
(rx (or "automount" "busname" "mount" "service" "slice"
|
||||||
|
"socket" "swap" "target" "timer" "link" "netdev" "network"
|
||||||
|
"override.conf")
|
||||||
|
(?? (= 16 (char hex-digit))) string-end))
|
||||||
|
"Regexp for temp file buffers in which to autoload `systemd-mode'.")
|
||||||
|
|
||||||
(defvar systemd-font-lock-keywords
|
(defvar systemd-font-lock-keywords
|
||||||
`(("^\\([#;]\\)\\(.*\\)$"
|
`(("^\\([#;]\\)\\(.*\\)$"
|
||||||
(1 'font-lock-comment-delimiter-face)
|
(1 'font-lock-comment-delimiter-face)
|
||||||
@ -178,18 +194,10 @@ file, defaulting to the link under point, if any."
|
|||||||
["Open systemd.directives(7)" systemd-doc-directives
|
["Open systemd.directives(7)" systemd-doc-directives
|
||||||
:help "Index of configuration directives"]))
|
:help "Index of configuration directives"]))
|
||||||
|
|
||||||
;;;###autoload (add-to-list 'auto-mode-alist '("\\.automount\\'" . systemd-mode))
|
;;;###autoload
|
||||||
;;;###autoload (add-to-list 'auto-mode-alist '("\\.busname\\'" . systemd-mode))
|
(add-to-list 'auto-mode-alist `(,systemd-autoload-regexp . systemd-mode))
|
||||||
;;;###autoload (add-to-list 'auto-mode-alist '("\\.mount\\'" . systemd-mode))
|
;;;###autoload
|
||||||
;;;###autoload (add-to-list 'auto-mode-alist '("\\.service\\'" . systemd-mode))
|
(add-to-list 'auto-mode-alist `(,systemd-tempfn-autoload-regexp . systemd-mode))
|
||||||
;;;###autoload (add-to-list 'auto-mode-alist '("\\.slice\\'" . systemd-mode))
|
|
||||||
;;;###autoload (add-to-list 'auto-mode-alist '("\\.socket\\'" . systemd-mode))
|
|
||||||
;;;###autoload (add-to-list 'auto-mode-alist '("\\.target\\'" . systemd-mode))
|
|
||||||
;;;###autoload (add-to-list 'auto-mode-alist '("\\.timer\\'" . systemd-mode))
|
|
||||||
;;;###autoload (add-to-list 'auto-mode-alist '("\\.link\\'" . systemd-mode))
|
|
||||||
;;;###autoload (add-to-list 'auto-mode-alist '("\\.netdev\\'" . systemd-mode))
|
|
||||||
;;;###autoload (add-to-list 'auto-mode-alist '("\\.network\\'" . systemd-mode))
|
|
||||||
;;;###autoload (add-to-list 'auto-mode-alist '("\\.override\\.conf.*\\'" . systemd-mode))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(define-derived-mode systemd-mode conf-mode "Systemd"
|
(define-derived-mode systemd-mode conf-mode "Systemd"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user