Skip to content

Commit

Permalink
perf: improve buffer-position segment
Browse files Browse the repository at this point in the history
  • Loading branch information
seagle0128 committed Sep 11, 2024
1 parent 3134178 commit 297fb8c
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions doom-modeline-segments.el
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,11 @@
(defvar meow--indicator)
(defvar minions-mode-line-lighter)
(defvar minions-mode-line-minor-modes-map)
(defvar mlscroll-minimum-current-width)
(defvar mlscroll-right-align)
(defvar mu4e--modeline-item)
(defvar mu4e-alert-mode-line)
(defvar mu4e-alert-modeline-formatter)
(defvar mu4e-modeline-mode)
(defvar nyan-minimum-window-width)
(defvar objed--obj-state)
(defvar objed--object)
(defvar objed-modeline-setup-func)
Expand All @@ -103,9 +101,7 @@
(defvar phi-search--overlays)
(defvar phi-search--selection)
(defvar phi-search-mode-line-format)
(defvar poke-line-minimum-window-width)
(defvar rcirc-activity)
(defvar sml-modeline-len)
(defvar symbol-overlay-keywords-alist)
(defvar symbol-overlay-temp-symbol)
(defvar text-scale-mode-amount)
Expand Down Expand Up @@ -1625,8 +1621,7 @@ By default, this shows the information specified by `global-mode-string'."

(doom-modeline-def-segment buffer-position
"The buffer position information."
(let ((visible (doom-modeline--segment-visible 'buffer-position))
(sep (doom-modeline-spc))
(let ((sep (doom-modeline-spc))
(wsep (doom-modeline-wspc))
(face (doom-modeline-face))
(help-echo "Buffer percentage\n\
Expand Down Expand Up @@ -1660,25 +1655,19 @@ mouse-1: Display Line and Column Mode Menu")
,sep)

;; Position
(,visible
,(cond
((and (bound-and-true-p nyan-mode)
(>= (window-width) nyan-minimum-window-width))
(concat sep (nyan-create) sep))
((and (bound-and-true-p poke-line-mode)
(>= (window-width) poke-line-minimum-window-width))
(concat sep (poke-line-create) sep))
((and (bound-and-true-p mlscroll-mode)
(>= (window-width) mlscroll-minimum-current-width))
(concat
sep
(let ((mlscroll-right-align nil))
(format-mode-line (mlscroll-mode-line)))
sep))
((and (bound-and-true-p sml-modeline-mode)
(>= (window-width) sml-modeline-len))
(concat sep (sml-modeline-create) sep))
(t "")))
,(cond
((bound-and-true-p nyan-mode)
(concat sep (nyan-create) sep))
((bound-and-true-p poke-line-mode)
(concat sep (poke-line-create) sep))
((bound-and-true-p mlscroll-mode)
(concat sep
(let ((mlscroll-right-align nil))
(format-mode-line (mlscroll-mode-line)))
sep))
((bound-and-true-p sml-modeline-mode)
(concat sep (sml-modeline-create) sep))
(t ""))

;; Percent position
(doom-modeline-percent-position
Expand Down

0 comments on commit 297fb8c

Please sign in to comment.