Compare commits

..

No commits in common. "020cbc918f0d2decd9e2d0052630e397374f20da" and "1c22801c960b1217552b921beba5855fdb0ac654" have entirely different histories.

6 changed files with 35 additions and 49 deletions

View File

@ -7,14 +7,14 @@
(start-time (current-time)))
(cl-loop for i to num
do (format-mode-line mode-line-format))
(format-time-string "%s.%3N seconds" (time-since start-time))))
(format-time-string "%s.%3N" (time-since start-time))))
;; Default mode line:
(time-mode-line 10000) ;; "0.440 seconds"
(time-mode-line 10000 :and-mem) ;; "2.402 seconds"
(time-mode-line 10000) ;; "0.440"
(time-mode-line 10000 :and-mem) ;; "2.402"
;; mood-line (default settings):
(mood-line-mode t)
(time-mode-line 10000) ;; "0.309 seconds"
(time-mode-line 10000 :and-mem) ;; "1.286 seconds"
(time-mode-line 10000) ;; "0.309"
(time-mode-line 10000 :and-mem) ;; "1.286"
```

BIN
.repo-assets/preview.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

View File

@ -1,4 +1,4 @@
# <img src=".repo-assets/icon.png" width=50> mood-line
# <img src=".repo-assets/icon.png" width=75> mood-line
A lightweight, drop-in replacement for the default Emacs mode line configuration.
@ -19,7 +19,7 @@ A lightweight, drop-in replacement for the default Emacs mode line configuration
## Preview
![Preview Image](.repo-assets/preview.webp "Preview Image")
![Preview Image](.repo-assets/preview.png "Preview Image")
## Configuration

View File

@ -49,11 +49,8 @@
(defun mood-line-segment-vc--rev (vc-mode-str backend)
"Return name of current file's revision for BACKEND according to `vc-mode'.
VC-MODE-STR is expected to be the value of `vc-mode' in the current buffer.
If `vc-display-status' is nil, return the name of BACKEND."
(or (unless vc-display-status
(symbol-name backend))
(pcase backend
VC-MODE-STR is expected to be the value of `vc-mode' in the current buffer."
(or (pcase backend
('Git (substring-no-properties vc-mode-str 5))
('Hg (substring-no-properties vc-mode-str 4)))
(ignore-errors

View File

@ -144,8 +144,6 @@ An optional key :padding may be provided, the value of which will be used as
(:buffer-modified . ?*)
(:buffer-read-only . ?#)
(:frame-client . ?@)
(:count-separator . ?*))
"Set of ASCII glyphs for use with mood-line.")
@ -167,8 +165,6 @@ An optional key :padding may be provided, the value of which will be used as
(:buffer-modified . ?●)
(:buffer-read-only . ?■)
(:frame-client . ?)
(:count-separator . ?×))
"Set of Fira Code-compatible glyphs for use with mood-line.")
@ -190,8 +186,6 @@ An optional key :padding may be provided, the value of which will be used as
(:buffer-modified . ?●)
(:buffer-read-only . ?■)
(:frame-client . ?⇅)
(:count-separator . ?✕))
"Set of Unicode glyphs for use with mood-line.")
@ -199,7 +193,7 @@ An optional key :padding may be provided, the value of which will be used as
(mood-line-defformat
:left
(((mood-line-segment-modal) . " ")
((or (mood-line-segment-buffer-status) " ") . " ")
((mood-line-segment-buffer-status) . " ")
((mood-line-segment-buffer-name) . " ")
((mood-line-segment-anzu) . " ")
((mood-line-segment-multiple-cursors) . " ")
@ -217,9 +211,7 @@ An optional key :padding may be provided, the value of which will be used as
(mood-line-defformat
:left
(((mood-line-segment-modal) . " ")
((or (mood-line-segment-buffer-status)
(mood-line-segment-client)
" ") . " ")
((mood-line-segment-buffer-status) . " ")
((mood-line-segment-buffer-name) . " ")
((mood-line-segment-anzu) . " ")
((mood-line-segment-multiple-cursors) . " ")
@ -296,8 +288,6 @@ Keys are names for different mode line glyphs, values are characters for that
:buffer-modified | File-backed buffer is modified
:buffer-read-only | File-backed buffer is read-only
:frame-client | Frame is a client for an Emacs daemon
:count-separator | Separates some indicator names from numerical counts
`mood-line-glyphs-ascii' will be used as a fallback whenever a glyph is found
@ -354,10 +344,6 @@ See `mood-line-defformat' for a helpful formatting macro."
"Face used for the ':buffer-narrowed' buffer status indicator."
:group 'mood-line-faces)
(defface mood-line-frame-status-client
'((t (:inherit shadow :weight normal)))
"Face used for the :frame-client frame status indicator.")
(defface mood-line-major-mode
'((t (:inherit bold)))
"Face used for the major mode indicator."
@ -398,6 +384,15 @@ See `mood-line-defformat' for a helpful formatting macro."
"Face used for less important mode line elements."
:group 'mood-line-faces)
;; ---------------------------------- ;;
;; Obsolete faces
;; ---------------------------------- ;;
(define-obsolete-face-alias
'mood-line-modified
'mood-line-buffer-status-modified
"2.1.0")
;; -------------------------------------------------------------------------- ;;
;;
;; Helper functions
@ -509,18 +504,6 @@ Modal modes checked, in order: `evil-mode', `meow-mode', `god-mode'."
((bound-and-true-p flymake-mode)
mood-line-segment-checker--flymake-text)))
;; -------------------------------------------------------------------------- ;;
;;
;; Client segment
;;
;; -------------------------------------------------------------------------- ;;
(defun mood-line-segment-client ()
"Return an indicator representing the client status of the current frame."
(when (frame-parameter nil 'client)
(propertize (mood-line--get-glyph :frame-client)
'face 'mood-line-frame-status-client)))
;; -------------------------------------------------------------------------- ;;
;;
;; anzu segment
@ -590,10 +573,12 @@ Modal modes checked, in order: `evil-mode', `meow-mode', `god-mode'."
'face 'mood-line-buffer-status-modified))
(buffer-read-only
(propertize (mood-line--get-glyph :buffer-read-only)
'face 'mood-line-buffer-status-read-only)))
(when (buffer-narrowed-p)
'face 'mood-line-buffer-status-read-only))
(t " "))
(if (buffer-narrowed-p)
(propertize (mood-line--get-glyph :buffer-narrowed)
'face 'mood-line-buffer-status-narrowed))))
'face 'mood-line-buffer-status-narrowed)
" ")))
;; ---------------------------------- ;;
;; Buffer name segment
@ -705,6 +690,10 @@ Modal modes checked, in order: `evil-mode', `meow-mode', `god-mode'."
;;
;; -------------------------------------------------------------------------- ;;
;; ---------------------------------- ;;
;; Configuration
;; ---------------------------------- ;;
(defconst mood-line--hooks-alist
'((mood-line-segment-checker--flycheck-update
. (flycheck-mode-hook