mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-24 03:00:10 +00:00
Format codes and comments.
This commit is contained in:
parent
fac54da782
commit
5b507e4b98
1 changed files with 28 additions and 32 deletions
|
@ -323,12 +323,11 @@ active.")
|
||||||
|
|
||||||
(defun doom-modeline-def-modeline (name lhs &optional rhs)
|
(defun doom-modeline-def-modeline (name lhs &optional rhs)
|
||||||
"Defines a modeline format and byte-compiles it.
|
"Defines a modeline format and byte-compiles it.
|
||||||
|
NAME is a symbol to identify it (used by `doom-modeline' for retrieval).
|
||||||
|
LHS and RHS are lists of symbols of modeline segments defined with
|
||||||
|
`doom-modeline-def-segment'.
|
||||||
|
|
||||||
NAME is a symbol to identify it (used by `doom-modeline' for retrieval).
|
Example:
|
||||||
LHS and RHS are lists of symbols of modeline segments defined with
|
|
||||||
`doom-modeline-def-segment'.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
(doom-modeline-def-modeline 'minimal
|
(doom-modeline-def-modeline 'minimal
|
||||||
'(bar matches \" \" buffer-info)
|
'(bar matches \" \" buffer-info)
|
||||||
'(media-info major-mode))
|
'(media-info major-mode))
|
||||||
|
@ -352,16 +351,14 @@ active.")
|
||||||
|
|
||||||
(defun doom-modeline (key)
|
(defun doom-modeline (key)
|
||||||
"Return a mode-line configuration associated with KEY (a symbol).
|
"Return a mode-line configuration associated with KEY (a symbol).
|
||||||
|
Throws an error if it doesn't exist."
|
||||||
Throws an error if it doesn't exist."
|
|
||||||
(let ((fn (intern-soft (format "doom-modeline-format--%s" key))))
|
(let ((fn (intern-soft (format "doom-modeline-format--%s" key))))
|
||||||
(when (functionp fn)
|
(when (functionp fn)
|
||||||
`(:eval (,fn)))))
|
`(:eval (,fn)))))
|
||||||
|
|
||||||
(defun doom-modeline-set-modeline (key &optional default)
|
(defun doom-modeline-set-modeline (key &optional default)
|
||||||
"Set the modeline format. Does nothing if the modeline KEY doesn't exist.
|
"Set the modeline format. Does nothing if the modeline KEY doesn't exist.
|
||||||
|
If DEFAULT is non-nil, set the default mode-line for all buffers."
|
||||||
If DEFAULT is non-nil, set the default mode-line for all buffers."
|
|
||||||
(when-let ((modeline (doom-modeline key)))
|
(when-let ((modeline (doom-modeline key)))
|
||||||
(setf (if default
|
(setf (if default
|
||||||
(default-value 'mode-line-format)
|
(default-value 'mode-line-format)
|
||||||
|
@ -613,7 +610,6 @@ If TRUNCATE-TAIL is t also truncate the parent directory of the file."
|
||||||
|
|
||||||
(defun doom-modeline--buffer-file-name (file-path _true-file-path &optional truncate-project-root-parent truncate-project-relative-path hide-project-root-parent)
|
(defun doom-modeline--buffer-file-name (file-path _true-file-path &optional truncate-project-root-parent truncate-project-relative-path hide-project-root-parent)
|
||||||
"Propertized variable `buffer-file-name' given by FILE-PATH.
|
"Propertized variable `buffer-file-name' given by FILE-PATH.
|
||||||
|
|
||||||
If TRUNCATE-PROJECT-ROOT-PARENT is non-nil will be saved by truncating project
|
If TRUNCATE-PROJECT-ROOT-PARENT is non-nil will be saved by truncating project
|
||||||
root parent down fish-shell style.
|
root parent down fish-shell style.
|
||||||
|
|
||||||
|
@ -755,10 +751,9 @@ buffer where knowing the current project directory is important."
|
||||||
|
|
||||||
(defun doom-modeline-fix-buffer-file-name ()
|
(defun doom-modeline-fix-buffer-file-name ()
|
||||||
"Fix buffer file name in mode-line.
|
"Fix buffer file name in mode-line.
|
||||||
|
Show buffer name if it doesn't equal the file name.
|
||||||
Show buffer name if it doesn't equal the file name.
|
Format: \"buffer-file-name[buffer-name]\".
|
||||||
Format: \"buffer-file-name[buffer-name]\".
|
Except the same buffer names in different directories."
|
||||||
Except the same buffer names in different directories."
|
|
||||||
(when-let ((file-name (doom-modeline-buffer-file-name))
|
(when-let ((file-name (doom-modeline-buffer-file-name))
|
||||||
(buffer-name (buffer-name))
|
(buffer-name (buffer-name))
|
||||||
(buffer-file-name buffer-file-name))
|
(buffer-file-name buffer-file-name))
|
||||||
|
@ -1115,8 +1110,10 @@ Requires `anzu', also `evil-anzu' if using `evil-mode' for compatibility with
|
||||||
|
|
||||||
(doom-modeline-def-segment matches
|
(doom-modeline-def-segment matches
|
||||||
"Displays: 1. the currently recording macro, 2. A current/total for the
|
"Displays: 1. the currently recording macro, 2. A current/total for the
|
||||||
current search term (with anzu), 3. The number of substitutions being conducted
|
current search term (with `anzu'), 3. The number of substitutions being conducted
|
||||||
with `evil-ex-substitute', and/or 4. The number of active `iedit' regions."
|
with `evil-ex-substitute', and/or 4. The number of active `iedit' regions,
|
||||||
|
5. The current/total for the highlight term (with `symbol-overlay'), 6. The number
|
||||||
|
of active `multiple-cursors'."
|
||||||
(let ((meta (concat (doom-modeline--macro-recording)
|
(let ((meta (concat (doom-modeline--macro-recording)
|
||||||
(doom-modeline--anzu)
|
(doom-modeline--anzu)
|
||||||
(doom-modeline--evil-substitute)
|
(doom-modeline--evil-substitute)
|
||||||
|
@ -1149,7 +1146,7 @@ with `evil-ex-substitute', and/or 4. The number of active `iedit' regions."
|
||||||
(defvar doom-modeline--bar-inactive nil)
|
(defvar doom-modeline--bar-inactive nil)
|
||||||
(doom-modeline-def-segment bar
|
(doom-modeline-def-segment bar
|
||||||
"The bar regulates the height of the mode-line in GUI Emacs.
|
"The bar regulates the height of the mode-line in GUI Emacs.
|
||||||
Returns \"\" to not break --no-window-system."
|
Returns \"\" to not break --no-window-system."
|
||||||
(if (display-graphic-p)
|
(if (display-graphic-p)
|
||||||
(if (doom-modeline--active)
|
(if (doom-modeline--active)
|
||||||
doom-modeline--bar-active
|
doom-modeline--bar-active
|
||||||
|
@ -1181,7 +1178,6 @@ with `evil-ex-substitute', and/or 4. The number of active `iedit' regions."
|
||||||
;; HACK: `ace-window-display-mode' should respect the ignore buffers.
|
;; HACK: `ace-window-display-mode' should respect the ignore buffers.
|
||||||
(defun doom-modeline-aw-update ()
|
(defun doom-modeline-aw-update ()
|
||||||
"Update ace-window-path window parameter for all windows.
|
"Update ace-window-path window parameter for all windows.
|
||||||
|
|
||||||
Ensure all windows are labeled so the user can select a specific
|
Ensure all windows are labeled so the user can select a specific
|
||||||
one. The ignored buffers are excluded unless `aw-ignore-on' is nil."
|
one. The ignored buffers are excluded unless `aw-ignore-on' is nil."
|
||||||
(let ((ignore-window-parameters t))
|
(let ((ignore-window-parameters t))
|
||||||
|
@ -1227,8 +1223,8 @@ one. The ignored buffers are excluded unless `aw-ignore-on' is nil."
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(doom-modeline-def-segment workspace-number
|
(doom-modeline-def-segment workspace-number
|
||||||
"The current workspace name or number. Requires `eyebrowse-mode' to be
|
"The current workspace name or number.
|
||||||
enabled."
|
Requires `eyebrowse-mode' to be enabled."
|
||||||
(if (and (bound-and-true-p eyebrowse-mode)
|
(if (and (bound-and-true-p eyebrowse-mode)
|
||||||
(< 1 (length (eyebrowse--get 'window-configs))))
|
(< 1 (length (eyebrowse--get 'window-configs))))
|
||||||
(let* ((num (eyebrowse--get 'current-slot))
|
(let* ((num (eyebrowse--get 'current-slot))
|
||||||
|
|
Loading…
Reference in a new issue