Skip to content

Commit

Permalink
refactor buffer-postion
Browse files Browse the repository at this point in the history
  • Loading branch information
seagle0128 committed May 6, 2024
1 parent 9b6f9b3 commit dcf24c1
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions doom-modeline-segments.el
Original file line number Diff line number Diff line change
Expand Up @@ -1606,13 +1606,13 @@ By default, this shows the information specified by `global-mode-string'."
"The buffer position information."
(let ((visible (doom-modeline--segment-visible 'buffer-position))
(sep (doom-modeline-spc))
(wspc (doom-modeline-wspc))
(wsep (doom-modeline-wspc))
(face (doom-modeline-face))
(help-echo "Buffer percentage\n\
mouse-1: Display Line and Column Mode Menu")
(mouse-face 'doom-modeline-highlight)
(local-map mode-line-column-line-number-mode-map))
`(,wspc
`(,wsep

;; Line and column
(:propertize
Expand All @@ -1635,43 +1635,38 @@ mouse-1: Display Line and Column Mode Menu")
mouse-face ,mouse-face
local-map ,local-map)

((or line-number-mode column-number-mode)
,sep)

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

;; Percent position
(doom-modeline-percent-position
(,sep
(:propertize ("" doom-modeline-percent-position)
((:propertize ("" doom-modeline-percent-position)
face ,face
help-echo ,help-echo
mouse-face ,mouse-face
local-map ,local-map)))

((or line-number-mode column-number-mode doom-modeline-percent-position)
,sep))))
local-map ,local-map)
,sep)))))

;;
;; Party parrot
Expand Down

0 comments on commit dcf24c1

Please sign in to comment.