From 28f91fd925d7e07819c37f91df091706dd562aa0 Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Tue, 3 Jul 2018 21:44:37 +0800 Subject: [PATCH 1/3] Fix comments. --- doom-modeline.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doom-modeline.el b/doom-modeline.el index 7357f40..40f0ca3 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -222,7 +222,7 @@ active.") (defmacro doom-modeline-def-modeline (name lhs &optional rhs) "Defines a modeline format and byte-compiles it. -AME is a symbol to identify it (used by `doom-modeline' for retrieval). +NAME is a symbol to identify it (used by `doom-modeline' for retrieval). LHS and RHS are lists of symbols of modeline segments defined with `doom-modeline-def-segment'. Example: From 258179ba7a11cc297dce91dec60733b8c7bfe203 Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Wed, 4 Jul 2018 02:15:48 +0800 Subject: [PATCH 2/3] Fix env versions on mode-line. --- doom-modeline.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doom-modeline.el b/doom-modeline.el index 40f0ca3..a16c67c 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -1009,13 +1009,13 @@ enabled." ;; Versions, support Python, Ruby and Golang (add-hook 'python-mode-hook (lambda () - (setq doom-modeline-env-command "python --version 2>&1 | cut -d' ' -f2"))) + (setq doom-modeline-env-command "python --version 2>&1 | cut -d' ' -f2 | sed -n '1p'"))) (add-hook 'ruby-mode-hook (lambda () - (setq doom-modeline-env-command "ruby --version 2>&1 | cut -d' ' -f2"))) + (setq doom-modeline-env-command "ruby --version 2>&1 | cut -d' ' -f2 | sed -n '1p'"))) (add-hook 'go-mode-hook (lambda () - (setq doom-modeline-env-command "go version 2>&1 | cut -d' ' -f3 | tr -d 'go'"))) + (setq doom-modeline-env-command "go version 2>&1 | cut -d' ' -f3 | tr -d 'go' | sed -n '1p'"))) ;; Ensure modeline is inactive when Emacs is unfocused (and active otherwise) From 926a83360c3c685279344f87fcfaffc6c655dcae Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Wed, 4 Jul 2018 02:24:34 +0800 Subject: [PATCH 3/3] Fix errors for env versions in mode-line. --- doom-modeline.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doom-modeline.el b/doom-modeline.el index a16c67c..c064bc2 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -1009,13 +1009,16 @@ enabled." ;; Versions, support Python, Ruby and Golang (add-hook 'python-mode-hook (lambda () - (setq doom-modeline-env-command "python --version 2>&1 | cut -d' ' -f2 | sed -n '1p'"))) + (when (executable-find "python") + (setq doom-modeline-env-command "python --version 2>&1 | cut -d' ' -f2 | sed -n '1p'")))) (add-hook 'ruby-mode-hook (lambda () - (setq doom-modeline-env-command "ruby --version 2>&1 | cut -d' ' -f2 | sed -n '1p'"))) + (when (executable-find "ruby") + (setq doom-modeline-env-command "ruby --version 2>&1 | cut -d' ' -f2 | sed -n '1p'")))) (add-hook 'go-mode-hook (lambda () - (setq doom-modeline-env-command "go version 2>&1 | cut -d' ' -f3 | tr -d 'go' | sed -n '1p'"))) + (when (executable-find "go") + (setq doom-modeline-env-command "go version 2>&1 | cut -d' ' -f3 | tr -d 'go' | sed -n '1p'")))) ;; Ensure modeline is inactive when Emacs is unfocused (and active otherwise)