Update the customization group doom-modeline-env.

This commit is contained in:
Vincent Zhang 2019-07-15 03:02:51 +08:00
parent 165c864d46
commit bb3f24c375
2 changed files with 23 additions and 48 deletions

View file

@ -213,6 +213,15 @@ Run `M-x customize-group RET doom-modeline RET` or set the variables.
;; The interval of checking github. ;; The interval of checking github.
(setq doom-modeline-github-interval (* 30 60)) (setq doom-modeline-github-interval (* 30 60))
;; Whether display mu4e notifications or not. Requires `mu4e-alert' package.
(setq doom-modeline-mu4e t)
;; Whether display irc notifications or not. Requires `circe' package.
(setq doom-modeline-irc t)
;; Function to stylize the irc buffer names.
(setq doom-modeline-irc-stylize 'identity)
;; Whether display environment version or not ;; Whether display environment version or not
(setq doom-modeline-env-version t) (setq doom-modeline-env-version t)
;; Or for individual languages ;; Or for individual languages
@ -223,15 +232,6 @@ Run `M-x customize-group RET doom-modeline RET` or set the variables.
(setq doom-modeline-env-enable-elixir t) (setq doom-modeline-env-enable-elixir t)
(setq doom-modeline-env-enable-rust t) (setq doom-modeline-env-enable-rust t)
;; Whether display mu4e notifications or not. Requires `mu4e-alert' package.
(setq doom-modeline-mu4e t)
;; Whether display irc notifications or not. Requires `circe' package.
(setq doom-modeline-irc t)
;; Function to stylize the irc buffer names.
(setq doom-modeline-irc-stylize 'identity)
;; Change the executables to use for the language version string ;; Change the executables to use for the language version string
(setq doom-modeline-env-python-executable "python") ; or `python-shell-interpreter' (setq doom-modeline-env-python-executable "python") ; or `python-shell-interpreter'
(setq doom-modeline-env-ruby-executable "ruby") (setq doom-modeline-env-ruby-executable "ruby")

View file

@ -30,6 +30,9 @@
(require 'subr-x) (require 'subr-x)
(require 'doom-modeline-core) (require 'doom-modeline-core)
;; Externals
(defvar python-shell-interpreter)
;; ;;
;; Customizations ;; Customizations
;; ;;
@ -38,37 +41,6 @@
"The environment parser for doom-modeline." "The environment parser for doom-modeline."
:group 'doom-modeline) :group 'doom-modeline)
(defcustom doom-modeline-env-python-executable
(or (bound-and-true-p python-shell-interpreter) "python")
"The executable to parse Python version."
:type 'string
:group 'doom-modeline-env)
(defcustom doom-modeline-env-ruby-executable "ruby"
"The executable to parse Ruby version."
:type 'string
:group 'doom-modeline-env)
(defcustom doom-modeline-env-perl-executable "perl"
"The executable to parse Perl version."
:type 'string
:group 'doom-modeline-env)
(defcustom doom-modeline-env-go-executable "go"
"The executable to parse Golang version."
:type 'string
:group 'doom-modeline-env)
(defcustom doom-modeline-env-elixir-executable "iex"
"The executable to parse Elixir version."
:type 'string
:group 'doom-modeline-env)
(defcustom doom-modeline-env-rust-executable "rustc"
"The executable to parse Rust version."
:type 'string
:group 'doom-modeline-env)
(defcustom doom-modeline-env-load-string "..." (defcustom doom-modeline-env-load-string "..."
"What to dispaly as the version while a new one is being loaded." "What to dispaly as the version while a new one is being loaded."
:type 'string :type 'string
@ -84,7 +56,6 @@
:type 'hook :type 'hook
:group 'doom-modeline-env) :group 'doom-modeline-env)
;; Show version string for multi-version managers like rvm, rbenv, pyenv, etc. ;; Show version string for multi-version managers like rvm, rbenv, pyenv, etc.
(defvar-local doom-modeline-env--version nil (defvar-local doom-modeline-env--version nil
"The version to display with major-mode in mode-line. "The version to display with major-mode in mode-line.
@ -222,16 +193,20 @@ PARSER should be a function for parsing COMMAND's output line-by-line, to
:command (lambda () (cond ((and (fboundp 'pipenv-project-p) :command (lambda () (cond ((and (fboundp 'pipenv-project-p)
(pipenv-project-p)) (pipenv-project-p))
(list "pipenv" "run" (list "pipenv" "run"
doom-modeline-env-python-executable (or doom-modeline-env-python-executable
python-shell-interpreter
"python")
"--version")) "--version"))
((list doom-modeline-env-python-executable ((list (or doom-modeline-env-python-executable
python-shell-interpreter
"python")
"--version")))) "--version"))))
:parser (lambda (line) (cadr (split-string line)))) :parser (lambda (line) (cadr (split-string line))))
;;;###autoload (autoload 'doom-modeline-env-setup-ruby "doom-modeline-env") ;;;###autoload (autoload 'doom-modeline-env-setup-ruby "doom-modeline-env")
(doom-modeline-def-env ruby (doom-modeline-def-env ruby
:hooks '(ruby-mode-hook enh-ruby-mode-hook) :hooks '(ruby-mode-hook enh-ruby-mode-hook)
:command (lambda () (list doom-modeline-env-ruby-executable "--version")) :command (lambda () (list (or doom-modeline-env-ruby-executable "ruby") "--version"))
:parser (lambda (line) :parser (lambda (line)
(car (split-string (car (split-string
(cadr (cadr
@ -241,7 +216,7 @@ PARSER should be a function for parsing COMMAND's output line-by-line, to
;;;###autoload (autoload 'doom-modeline-env-setup-perl "doom-modeline-env") ;;;###autoload (autoload 'doom-modeline-env-setup-perl "doom-modeline-env")
(doom-modeline-def-env perl (doom-modeline-def-env perl
:hooks 'perl-mode-hook :hooks 'perl-mode-hook
:command (lambda () (list doom-modeline-env-perl-executable "--version")) :command (lambda () (list (or doom-modeline-env-perl-executable "perl") "--version"))
:parser (lambda (line) :parser (lambda (line)
(cadr (cadr
(split-string (split-string
@ -255,7 +230,7 @@ PARSER should be a function for parsing COMMAND's output line-by-line, to
;;;###autoload (autoload 'doom-modeline-env-setup-go "doom-modeline-env") ;;;###autoload (autoload 'doom-modeline-env-setup-go "doom-modeline-env")
(doom-modeline-def-env go (doom-modeline-def-env go
:hooks 'go-mode-hook :hooks 'go-mode-hook
:command (lambda () (list doom-modeline-env-go-executable "version")) :command (lambda () (list (or doom-modeline-env-go-executable "go") "version"))
:parser (lambda (line) :parser (lambda (line)
(cadr (cadr
(split-string (split-string
@ -267,13 +242,13 @@ PARSER should be a function for parsing COMMAND's output line-by-line, to
;;;###autoload (autoload 'doom-modeline-env-setup-elixir "doom-modeline-env") ;;;###autoload (autoload 'doom-modeline-env-setup-elixir "doom-modeline-env")
(doom-modeline-def-env elixir (doom-modeline-def-env elixir
:hooks 'elixir-mode-hook :hooks 'elixir-mode-hook
:command (lambda () (list doom-modeline-env-elixir-executable "--version")) :command (lambda () (list (or doom-modeline-env-elixir-executable "iex") "--version"))
:parser (lambda (line) (cadr (split-string line)))) :parser (lambda (line) (cadr (split-string line))))
;;;###autoload (autoload 'doom-modeline-env-setup-rust "doom-modeline-env") ;;;###autoload (autoload 'doom-modeline-env-setup-rust "doom-modeline-env")
(doom-modeline-def-env rust (doom-modeline-def-env rust
:hooks 'rust-mode-hook :hooks 'rust-mode-hook
:command (lambda () (list doom-modeline-env-rust-executable "--version")) :command (lambda () (list (or doom-modeline-env-rust-executable "rustc") "--version"))
:parser (lambda (line) :parser (lambda (line)
(car (car
(split-string (split-string