diff --git a/README.md b/README.md index 34af473..8b0e350 100644 --- a/README.md +++ b/README.md @@ -213,6 +213,15 @@ Run `M-x customize-group RET doom-modeline RET` or set the variables. ;; The interval of checking github. (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 (setq doom-modeline-env-version t) ;; 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-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 (setq doom-modeline-env-python-executable "python") ; or `python-shell-interpreter' (setq doom-modeline-env-ruby-executable "ruby") diff --git a/doom-modeline-env.el b/doom-modeline-env.el index 1cdc9b4..b541003 100644 --- a/doom-modeline-env.el +++ b/doom-modeline-env.el @@ -30,6 +30,9 @@ (require 'subr-x) (require 'doom-modeline-core) +;; Externals +(defvar python-shell-interpreter) + ;; ;; Customizations ;; @@ -38,37 +41,6 @@ "The environment parser for 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 "..." "What to dispaly as the version while a new one is being loaded." :type 'string @@ -84,7 +56,6 @@ :type 'hook :group 'doom-modeline-env) - ;; Show version string for multi-version managers like rvm, rbenv, pyenv, etc. (defvar-local doom-modeline-env--version nil "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) (pipenv-project-p)) (list "pipenv" "run" - doom-modeline-env-python-executable + (or doom-modeline-env-python-executable + python-shell-interpreter + "python") "--version")) - ((list doom-modeline-env-python-executable + ((list (or doom-modeline-env-python-executable + python-shell-interpreter + "python") "--version")))) :parser (lambda (line) (cadr (split-string line)))) ;;;###autoload (autoload 'doom-modeline-env-setup-ruby "doom-modeline-env") (doom-modeline-def-env ruby :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) (car (split-string (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") (doom-modeline-def-env perl :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) (cadr (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") (doom-modeline-def-env go :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) (cadr (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") (doom-modeline-def-env elixir :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)))) ;;;###autoload (autoload 'doom-modeline-env-setup-rust "doom-modeline-env") (doom-modeline-def-env rust :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) (car (split-string