Make enable-var and exc-var to customizations in doom-modeline-def-env.

This commit is contained in:
Vincent Zhang 2019-07-15 03:18:59 +08:00
parent bb3f24c375
commit bdbf45e690

View file

@ -143,17 +143,21 @@ PARSER should be a function for parsing COMMAND's output line-by-line, to
(parser-var (intern (format "doom-modeline-env-%s-parser-fn" name))) (parser-var (intern (format "doom-modeline-env-%s-parser-fn" name)))
(exe-var (intern (format "doom-modeline-env-%s-executable" name)))) (exe-var (intern (format "doom-modeline-env-%s-executable" name))))
(macroexp-progn (macroexp-progn
`((defvar ,enable-var t `((defcustom ,enable-var t
(format "Whether to display the version string for %s buffers." ',name)) (format "Whether to display the version string for %s buffers." ',name)
:type 'boolean
:group 'doom-modeline-env)
(defvar ,command-var ',action-fn (defvar ,command-var ',action-fn
(concat "A function that returns the shell command and arguments (as a list) to\n" (concat "A function that returns the shell command and arguments (as a list) to\n"
"produce a version string.")) "produce a version string."))
(defvar ,parser-var ',parse-fn (defvar ,parser-var ',parse-fn
(format "The function for parsing each line of `%s's output." ',command-var)) (format "The function for parsing each line of `%s's output." ',command-var))
(defvar ,exe-var nil (defcustom ,exe-var nil
(format (concat "What executable to use for the version indicator in %s buffers.\n\n" (format (concat "What executable to use for the version indicator in %s buffers.\n\n"
"If nil, the default binary for this language is used.") "If nil, the default binary for this language is used.")
',name)) ',name)
:type 'string
:group 'doom-modeline-env)
(defalias ',parse-fn ,parser (defalias ',parse-fn ,parser
(format "The line parser for %s buffers.\n\nUsed by `%s'." (format "The line parser for %s buffers.\n\nUsed by `%s'."
',name ',update-fn)) ',name ',update-fn))