Compare commits
11 Commits
1c22801c96
...
020cbc918f
Author | SHA1 | Date | |
---|---|---|---|
020cbc918f | |||
a0c84a3c1e | |||
a9b55d8308 | |||
eb3993601d | |||
5dfc7572dd | |||
731c786af4 | |||
8a580f30bb | |||
![]() |
b1028ce61a | ||
![]() |
6e3f62f57c | ||
![]() |
21e4addc9b | ||
![]() |
25c7846b8f |
@ -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" (time-since start-time))))
|
||||
(format-time-string "%s.%3N seconds" (time-since start-time))))
|
||||
|
||||
;; Default mode line:
|
||||
(time-mode-line 10000) ;; "0.440"
|
||||
(time-mode-line 10000 :and-mem) ;; "2.402"
|
||||
(time-mode-line 10000) ;; "0.440 seconds"
|
||||
(time-mode-line 10000 :and-mem) ;; "2.402 seconds"
|
||||
|
||||
;; mood-line (default settings):
|
||||
(mood-line-mode t)
|
||||
(time-mode-line 10000) ;; "0.309"
|
||||
(time-mode-line 10000 :and-mem) ;; "1.286"
|
||||
(time-mode-line 10000) ;; "0.309 seconds"
|
||||
(time-mode-line 10000 :and-mem) ;; "1.286 seconds"
|
||||
```
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 226 KiB |
BIN
.repo-assets/preview.webp
Normal file
BIN
.repo-assets/preview.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 65 KiB |
@ -1,4 +1,4 @@
|
||||
# <img src=".repo-assets/icon.png" width=75> mood-line
|
||||
# <img src=".repo-assets/icon.png" width=50> 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
|
||||
|
||||

|
||||

|
||||
|
||||
## Configuration
|
||||
|
||||
|
@ -49,8 +49,11 @@
|
||||
|
||||
(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."
|
||||
(or (pcase backend
|
||||
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
|
||||
('Git (substring-no-properties vc-mode-str 5))
|
||||
('Hg (substring-no-properties vc-mode-str 4)))
|
||||
(ignore-errors
|
||||
|
63
mood-line.el
63
mood-line.el
@ -144,6 +144,8 @@ 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.")
|
||||
|
||||
@ -165,6 +167,8 @@ 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.")
|
||||
|
||||
@ -186,18 +190,20 @@ 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.")
|
||||
|
||||
(defconst mood-line-format-default
|
||||
(mood-line-defformat
|
||||
:left
|
||||
(((mood-line-segment-modal) . " ")
|
||||
((mood-line-segment-buffer-status) . " ")
|
||||
((mood-line-segment-buffer-name) . " ")
|
||||
((mood-line-segment-anzu) . " ")
|
||||
((mood-line-segment-multiple-cursors) . " ")
|
||||
((mood-line-segment-cursor-position) . " ")
|
||||
(((mood-line-segment-modal) . " ")
|
||||
((or (mood-line-segment-buffer-status) " ") . " ")
|
||||
((mood-line-segment-buffer-name) . " ")
|
||||
((mood-line-segment-anzu) . " ")
|
||||
((mood-line-segment-multiple-cursors) . " ")
|
||||
((mood-line-segment-cursor-position) . " ")
|
||||
(mood-line-segment-scroll))
|
||||
:right
|
||||
(((mood-line-segment-vc) . " ")
|
||||
@ -211,7 +217,9 @@ An optional key :padding may be provided, the value of which will be used as
|
||||
(mood-line-defformat
|
||||
:left
|
||||
(((mood-line-segment-modal) . " ")
|
||||
((mood-line-segment-buffer-status) . " ")
|
||||
((or (mood-line-segment-buffer-status)
|
||||
(mood-line-segment-client)
|
||||
" ") . " ")
|
||||
((mood-line-segment-buffer-name) . " ")
|
||||
((mood-line-segment-anzu) . " ")
|
||||
((mood-line-segment-multiple-cursors) . " ")
|
||||
@ -288,6 +296,8 @@ 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
|
||||
@ -344,6 +354,10 @@ 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."
|
||||
@ -384,15 +398,6 @@ 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
|
||||
@ -504,6 +509,18 @@ 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
|
||||
@ -573,12 +590,10 @@ 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))
|
||||
(t " "))
|
||||
(if (buffer-narrowed-p)
|
||||
(propertize (mood-line--get-glyph :buffer-narrowed)
|
||||
'face 'mood-line-buffer-status-narrowed)
|
||||
" ")))
|
||||
'face 'mood-line-buffer-status-read-only)))
|
||||
(when (buffer-narrowed-p)
|
||||
(propertize (mood-line--get-glyph :buffer-narrowed)
|
||||
'face 'mood-line-buffer-status-narrowed))))
|
||||
|
||||
;; ---------------------------------- ;;
|
||||
;; Buffer name segment
|
||||
@ -690,10 +705,6 @@ 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
|
||||
|
Loading…
Reference in New Issue
Block a user