ui/doom-modeline: refactor eldoc segment
This commit is contained in:
parent
afb31659a3
commit
c118f22184
2 changed files with 24 additions and 17 deletions
4
TODO.org
4
TODO.org
|
@ -100,9 +100,9 @@
|
||||||
+ [ ] tools/upload: add ~+upload/open-remote-file~ command to open current file on the remote (with TRAMP)
|
+ [ ] tools/upload: add ~+upload/open-remote-file~ command to open current file on the remote (with TRAMP)
|
||||||
+ [ ] Generalize ~doom-visual-bell~ by basing its background off a face
|
+ [ ] Generalize ~doom-visual-bell~ by basing its background off a face
|
||||||
|
|
||||||
** 2.0.2 [64/66]
|
** 2.0.2 [65/66]
|
||||||
+ [ ] Update screenshots
|
+ [ ] Update screenshots
|
||||||
+ [ ] Fix ~0/0~ displaying in modeline (caused by leftover anzu state)
|
+ [X] ui/doom-modeline: fix ~0/0~ display in modeline (leftover anzu state)
|
||||||
+ [X] send-to-REPL workflow: does it still work? (see ~:repl~ & ~+eval/repl-send-region~)
|
+ [X] send-to-REPL workflow: does it still work? (see ~:repl~ & ~+eval/repl-send-region~)
|
||||||
+ [X] completion/ivy: restore ag searching (for compressed files)
|
+ [X] completion/ivy: restore ag searching (for compressed files)
|
||||||
Now ~:ag~, ~:rg~, ~:agcwd~ and ~:rgcwd~
|
Now ~:ag~, ~:rg~, ~:agcwd~ and ~:rgcwd~
|
||||||
|
|
|
@ -40,16 +40,19 @@
|
||||||
anzu-minimum-input-length 1
|
anzu-minimum-input-length 1
|
||||||
anzu-search-threshold 250)
|
anzu-search-threshold 250)
|
||||||
|
|
||||||
(make-variable-buffer-local 'anzu--state)
|
;; Avoid anzu conflicts across buffers
|
||||||
|
(mapc #'make-variable-buffer-local
|
||||||
|
'(anzu--total-matched anzu--current-position anzu--state
|
||||||
|
anzu--cached-count anzu--cached-positions anzu--last-command
|
||||||
|
anzu--last-isearch-string anzu--overflow-p))
|
||||||
|
|
||||||
(defun +doom-modeline|reset-anzu ()
|
(defun +doom-modeline|reset-anzu ()
|
||||||
(setq anzu--state nil))
|
(anzu--reset-status))
|
||||||
;; Ensure anzu state is cleared when searches & iedit are done
|
;; Ensure anzu state is cleared when searches & iedit are done
|
||||||
(add-hook! '(kill-buffer-hook find-file-hook) #'+doom-modeline|reset-anzu)
|
(add-hook! :append '(kill-buffer isearch-mode-end +evil-esc-hook)
|
||||||
(after! evil
|
#'+doom-modeline|reset-anzu)
|
||||||
(add-hook '+evil-esc-hook #'+doom-modeline|reset-anzu t)
|
(after! iedit
|
||||||
(advice-add #'evil-ex-search-abort :after #'+doom-modeline|reset-anzu)
|
(add-hook 'iedit-mode-end-hook #'+doom-modeline|reset-anzu)))
|
||||||
(after! evil-multiedit
|
|
||||||
(add-hook 'iedit-mode-end-hook #'+doom-modeline|reset-anzu))))
|
|
||||||
|
|
||||||
|
|
||||||
;;; Flash the mode-line on error
|
;;; Flash the mode-line on error
|
||||||
|
@ -456,10 +459,14 @@ lines are selected, or the NxM dimensions of a block selection."
|
||||||
(propertize
|
(propertize
|
||||||
(let ((here anzu--current-position)
|
(let ((here anzu--current-position)
|
||||||
(total anzu--total-matched))
|
(total anzu--total-matched))
|
||||||
(pcase anzu--state
|
(cond ((eq anzu--state 'replace-query)
|
||||||
('replace-query (format " %d replace " total))
|
(format " %d replace " total))
|
||||||
('replace (format " %d/%d " here total))
|
((eq anzu--state 'replace)
|
||||||
(_ (format " %s/%d%s " here total (if anzu--overflow-p "+" "")))))
|
(format " %d/%d " here total))
|
||||||
|
(anzu--overflow-p
|
||||||
|
(format " %s+ " total))
|
||||||
|
(t
|
||||||
|
(format " %s/%d " here total))))
|
||||||
'face (if (active) 'doom-modeline-panel))))
|
'face (if (active) 'doom-modeline-panel))))
|
||||||
|
|
||||||
(defsubst +doom-modeline--evil-substitute ()
|
(defsubst +doom-modeline--evil-substitute ()
|
||||||
|
@ -517,9 +524,9 @@ with `evil-ex-substitute', and/or 4. The number of active `iedit' regions."
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(def-modeline-segment! eldoc
|
(def-modeline-segment! eldoc
|
||||||
"Used with `eldoc-eval' to show the eldoc string in the modeline, while using
|
"Display eldoc documentation in the mode-line while using the minibuffer (e.g.
|
||||||
`eval-expression'."
|
`eval-expression')."
|
||||||
(and (boundp 'str) str))
|
(bound-and-true-p str))
|
||||||
|
|
||||||
;; These bars regulate the height of the mode-line in GUI Emacs.
|
;; These bars regulate the height of the mode-line in GUI Emacs.
|
||||||
(def-modeline-segment! bar
|
(def-modeline-segment! bar
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue