Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggle displaying major and minor modes in mode-line #199

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions powerline-themes.el
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@
:group 'powerline
:type 'boolean)


(defcustom powerline-display-minor-modes t
"When non-nil, display minor modes in the mode-line."
:group 'powerline
:type 'boolean)

(defcustom powerline-display-major-mode t
"When non-nil, display minor modes in the mode-line."
:group 'powerline
:type 'boolean)

;;;###autoload
(defun powerline-default-theme ()
"Setup the default mode-line."
Expand Down Expand Up @@ -71,9 +82,9 @@
(funcall separator-left face0 face1)
(when (and (boundp 'erc-track-minor-mode) erc-track-minor-mode)
(powerline-raw erc-modified-channels-object face1 'l))
(powerline-major-mode face1 'l)
(when powerline-display-major-mode (powerline-major-mode face1 'l))
(powerline-process face1)
(powerline-minor-modes face1 'l)
(when powerline-display-minor-modes (powerline-minor-modes face1 'l))
(powerline-narrow face1 'l)
(powerline-raw " " face1)
(funcall separator-left face1 face2)
Expand Down Expand Up @@ -139,10 +150,10 @@
(funcall separator-left face1 face2)
(when (and (boundp 'erc-track-minor-mode) erc-track-minor-mode)
(powerline-raw erc-modified-channels-object face2 'l))
(powerline-major-mode face2 'l)
(when powerline-display-major-mode (powerline-major-mode face2 'l))
(powerline-process face2)
(powerline-raw " :" face2)
(powerline-minor-modes face2 'l)
(when powerline-display-minor-modes (powerline-minor-modes face2 'l))
(powerline-raw " " face2)
(funcall separator-right face2 face1))))
(concat (powerline-render lhs)
Expand Down Expand Up @@ -190,7 +201,7 @@
(funcall separator-left face1 face2)
(when (and (boundp 'erc-track-minor-mode) erc-track-minor-mode)
(powerline-raw erc-modified-channels-object face2 'l))
(powerline-major-mode face2 'l)
(when powerline-display-major-mode (powerline-major-mode face2 'l))
(powerline-process face2)
(powerline-raw " " face2))
(if (split-string (format-mode-line minor-mode-alist))
Expand All @@ -199,9 +210,10 @@
(powerline-raw evil-mode-line-tag face1 'l)
(powerline-raw " " face1)
(funcall separator-left face1 face2)))
(list (powerline-minor-modes face2 'l)
(powerline-raw " " face2)
(funcall separator-right face2 face1)))
(if powerline-display-minor-modes
(list (powerline-minor-modes face2 'l)
(powerline-raw " " face2)
(funcall separator-right face2 face1))))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use when here, too?

(list (powerline-raw evil-mode-line-tag face2)
(funcall separator-right face2 face1))))))
(concat (powerline-render lhs)
Expand Down Expand Up @@ -230,7 +242,7 @@
(cdr powerline-default-separator-dir))))
(lhs (list (powerline-buffer-id `(mode-line-buffer-id ,face0) 'l)
(powerline-raw "[" face0 'l)
(powerline-major-mode face0)
(when powerline-display-major-mode (powerline-major-mode face0))
(powerline-process face0)
(powerline-raw "]" face0)
(when (buffer-modified-p)
Expand All @@ -244,7 +256,7 @@
(when (and (boundp 'erc-track-minor-mode) erc-track-minor-mode)
(powerline-raw erc-modified-channels-object face1 'l))
(powerline-raw "[" face0 'l)
(powerline-minor-modes face0)
(when powerline-display-minor-modes (powerline-minor-modes face0))
(powerline-raw "%n" face0)
(powerline-raw "]" face0)
(when (and vc-mode buffer-file-name)
Expand Down