mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-23 19:19:50 +00:00
[Performance] Improve the performance of pdf-pages segment.
This commit is contained in:
parent
748824e692
commit
80d0d40a34
1 changed files with 13 additions and 7 deletions
|
@ -1831,15 +1831,21 @@ mouse-1: Toggle Debug on Quit"
|
||||||
;; pdf pages
|
;; pdf pages
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
(defvar-local doom-modeline--pdf-pages nil)
|
||||||
|
(defun doom-modeline-update-pdf-pages ()
|
||||||
|
(setq doom-modeline--pdf-pages
|
||||||
|
(propertize
|
||||||
|
(format " P%d/%d "
|
||||||
|
(eval `(pdf-view-current-page))
|
||||||
|
(pdf-cache-number-of-pages))
|
||||||
|
'face (if (doom-modeline--active)
|
||||||
|
'mode-line
|
||||||
|
'mode-line-inactive))))
|
||||||
|
(add-hook 'pdf-view-change-page-hook #'doom-modeline-update-pdf-pages)
|
||||||
|
|
||||||
(doom-modeline-def-segment pdf-pages
|
(doom-modeline-def-segment pdf-pages
|
||||||
(when (eq major-mode 'pdf-view-mode)
|
(when (eq major-mode 'pdf-view-mode)
|
||||||
(propertize
|
doom-modeline--pdf-pages))
|
||||||
(format " P%d/%d "
|
|
||||||
(eval `(pdf-view-current-page))
|
|
||||||
(pdf-cache-number-of-pages))
|
|
||||||
'face (if (doom-modeline--active)
|
|
||||||
'mode-line
|
|
||||||
'mode-line-inactive))))
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue