From 202a90e660ac52efa4108a2c493737f9dc57d13b Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Mon, 31 Dec 2018 22:55:23 +0800 Subject: [PATCH] Fix #78: a new toggle for env version. --- README.md | 3 +++ doom-modeline.el | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9a968b6..88b59fe 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,9 @@ Strongly recommend to use ;; The interval of checking github. (setq doom-modeline-github-interval (* 30 60)) + +;; Whether display environment version or not. +(setq doom-modeline-version t) ``` ## FAQ diff --git a/doom-modeline.el b/doom-modeline.el index c0604e3..22eddaa 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -137,6 +137,9 @@ The icons may not be showed correctly in terminal and on Windows.") (defvar doom-modeline-github-interval (* 30 60) "The interval of checking github.") +(defvar doom-modeline-version t + "Whether display environment version or not.") + ;; ;; Compatibilities @@ -526,7 +529,7 @@ If DEFAULT is non-nil, set the default mode-line for all buffers." (add-hook 'focus-in-hook #'doom-modeline-update-env))) (defun doom-modeline-update-env () "Update environment info on mode-line." - (when doom-modeline-env-command + (when (and doom-modeline-version doom-modeline-env-command) (let ((default-directory (doom-modeline-project-root)) (s (shell-command-to-string doom-modeline-env-command))) (setq doom-modeline-env-version (if (string-match "[ \t\n\r]+\\'" s) @@ -926,7 +929,7 @@ mouse-2: Show help for major mode\n\ mouse-3: Toggle minor modes" mouse-face mode-line-highlight local-map ,mode-line-major-mode-keymap)) - (when doom-modeline-env-version + (when (and doom-modeline-version doom-modeline-env-version) (format " %s" doom-modeline-env-version)) (and (boundp 'text-scale-mode-amount) (/= text-scale-mode-amount 0)