Convert def-modeline! macro into function

Eager-expansion was causing void-function errors for set-modeline!
This commit is contained in:
Henrik Lissner 2019-12-29 21:23:39 -05:00
parent db9bc763ef
commit 4808d40736
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -141,17 +141,15 @@ See `def-modeline!' on how modelines are defined."
(remove-hook hook (intern (format "+modeline-set-%s-format-h" name))))) (remove-hook hook (intern (format "+modeline-set-%s-format-h" name)))))
(add-hook hook fn)))) (add-hook hook fn))))
(defmacro def-modeline! (name lhs rhs) (defun def-modeline! (name lhs rhs)
"Define a modeline format by NAME. "Define a modeline format by NAME.
LHS and RHS are the formats representing the left and right hand side of the LHS and RHS are the formats representing the left and right hand side of the
mode-line, respectively. See the variable `format-mode-line' for details on what mode-line, respectively. See the variable `format-mode-line' for details on what
LHS and RHS will accept." LHS and RHS will accept."
`(progn (setf (alist-get name +modeline-format-alist)
(setf (alist-get ',name +modeline-format-alist) (cons lhs rhs))
(cons ,lhs ,rhs)) (fset (intern (format "+modeline-set-%s-format-h" name))
(defun ,(intern (format "+modeline-set-%s-format-h" name)) (&rest _) (lambda (&rest _) (set-modeline! name))))
"TODO"
(set-modeline! ',name))))
(defmacro def-modeline-var! (name body &optional docstring &rest plist) (defmacro def-modeline-var! (name body &optional docstring &rest plist)
"TODO" "TODO"
@ -499,7 +497,7 @@ lines are selected, or the NxM dimensions of a block selection.")
" " " "
(+modeline-checker ("" +modeline-checker " ")))) (+modeline-checker ("" +modeline-checker " "))))
(def-modeline! project (def-modeline! 'project
`(" " `(" "
,(all-the-icons-octicon ,(all-the-icons-octicon
"file-directory" "file-directory"
@ -510,7 +508,7 @@ lines are selected, or the NxM dimensions of a block selection.")
face bold)) face bold))
'("" +modeline-modes)) '("" +modeline-modes))
(def-modeline! special (def-modeline! 'special
'("" +modeline-matches '("" +modeline-matches
" " +modeline-buffer-identification) " " +modeline-buffer-identification)
'("" +modeline-modes)) '("" +modeline-modes))