mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-27 11:09:52 +00:00
Optimize package segment.
Leverage paradox--update-mode-line.
This commit is contained in:
parent
0dfbb0c108
commit
f9984246d2
1 changed files with 24 additions and 56 deletions
|
@ -71,12 +71,6 @@
|
||||||
(defvar objed--obj-state)
|
(defvar objed--obj-state)
|
||||||
(defvar objed--object)
|
(defvar objed--object)
|
||||||
(defvar objed-modeline-setup-func)
|
(defvar objed-modeline-setup-func)
|
||||||
(defvar package-archive-contents)
|
|
||||||
(defvar package-menu--new-package-list)
|
|
||||||
(defvar paradox--current-filter)
|
|
||||||
(defvar paradox--upgradeable-packages-any?)
|
|
||||||
(defvar paradox--upgradeable-packages-number)
|
|
||||||
(defvar paradox-display-buffer-name)
|
|
||||||
(defvar persp-nil-name)
|
(defvar persp-nil-name)
|
||||||
(defvar symbol-overlay-keywords-alist)
|
(defvar symbol-overlay-keywords-alist)
|
||||||
(defvar symbol-overlay-temp-symbol)
|
(defvar symbol-overlay-temp-symbol)
|
||||||
|
@ -161,7 +155,6 @@
|
||||||
(declare-function org-narrow-to-block 'org)
|
(declare-function org-narrow-to-block 'org)
|
||||||
(declare-function org-narrow-to-element 'org)
|
(declare-function org-narrow-to-element 'org)
|
||||||
(declare-function org-narrow-to-subtree 'org)
|
(declare-function org-narrow-to-subtree 'org)
|
||||||
(declare-function paradox--cas 'paradox-core)
|
|
||||||
(declare-function parrot-create 'parrot)
|
(declare-function parrot-create 'parrot)
|
||||||
(declare-function pdf-cache-number-of-pages 'pdf-cache)
|
(declare-function pdf-cache-number-of-pages 'pdf-cache)
|
||||||
(declare-function persp-add-buffer 'persp-mode)
|
(declare-function persp-add-buffer 'persp-mode)
|
||||||
|
@ -2057,60 +2050,35 @@ we don't want to remove that so we just return the original."
|
||||||
(add-hook 'fancy-battery-mode-hook #'doom-modeline-override-fancy-battery-modeline)
|
(add-hook 'fancy-battery-mode-hook #'doom-modeline-override-fancy-battery-modeline)
|
||||||
(add-hook 'doom-modeline-mode-hook #'doom-modeline-override-fancy-battery-modeline)
|
(add-hook 'doom-modeline-mode-hook #'doom-modeline-override-fancy-battery-modeline)
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; package information
|
||||||
|
;;
|
||||||
|
|
||||||
(doom-modeline-def-segment package
|
(doom-modeline-def-segment package
|
||||||
"Show package information via `paradox'."
|
"Show package information via `paradox'."
|
||||||
(let ((total-lines (int-to-string (length tabulated-list-entries)))
|
(let ((active (doom-modeline--active)))
|
||||||
(active (doom-modeline--active)))
|
|
||||||
(concat
|
(concat
|
||||||
(concat
|
(let ((front (format-mode-line 'mode-line-front-space)))
|
||||||
" ("
|
(if active
|
||||||
(propertize (format "%%%sl" (length total-lines))
|
front
|
||||||
'face (if active 'doom-modeline-buffer-file 'mode-line-inactive))
|
(propertize front 'face 'mode-line-inactives)))
|
||||||
"/" total-lines ") ")
|
|
||||||
|
|
||||||
(when doom-modeline-icon
|
(when (and doom-modeline-icon doom-modeline-major-mode-icon)
|
||||||
|
(concat " "
|
||||||
(let ((icon (doom-modeline-icon-for-mode 'paradox-menu-mode)))
|
(let ((icon (doom-modeline-icon-for-mode 'paradox-menu-mode)))
|
||||||
(concat
|
|
||||||
" "
|
|
||||||
(propertize icon 'face `(:inherit
|
(propertize icon 'face `(:inherit
|
||||||
,(if doom-modeline-icon (get-text-property 0 'face icon))
|
,(let ((props (get-text-property 0 'face icon)))
|
||||||
|
(if doom-modeline-major-mode-color-icon
|
||||||
|
props
|
||||||
|
(remove :inherit props)))
|
||||||
:inherit
|
:inherit
|
||||||
,(if active 'mode-line 'mode-line-inactive))))))
|
,(if active 'mode-line 'mode-line-inactive))))))
|
||||||
|
|
||||||
(when paradox-display-buffer-name
|
(let ((info (format-mode-line 'mode-line-buffer-identification)))
|
||||||
(propertize (format " %%%sb" (length (buffer-name)))
|
(if active
|
||||||
'face (if active 'doom-modeline-buffer-file 'mode-line-inactive)))
|
info
|
||||||
|
(propertize info 'face 'mode-line-inactive))))))
|
||||||
" "
|
|
||||||
|
|
||||||
(when paradox--current-filter
|
|
||||||
(propertize (concat "[" paradox--current-filter "]")
|
|
||||||
'face (if active 'paradox-mode-line-face 'mode-line-inactive)))
|
|
||||||
(when paradox--upgradeable-packages-any?
|
|
||||||
(concat
|
|
||||||
(propertize " Upgrade:"
|
|
||||||
'face (if active 'paradox-mode-line-face 'mode-line-inactive))
|
|
||||||
(propertize (int-to-string paradox--upgradeable-packages-number)
|
|
||||||
'face (if active 'doom-modeline-buffer-file 'mode-line-inactive))))
|
|
||||||
(when package-menu--new-package-list
|
|
||||||
(concat
|
|
||||||
(propertize " New:"
|
|
||||||
'face (if active 'paradox-mode-line-face 'mode-line-inactive))
|
|
||||||
(propertize (int-to-string (paradox--cas "new"))
|
|
||||||
'face (if active 'doom-modeline-buffer-file 'mode-line-inactive))))
|
|
||||||
(concat
|
|
||||||
(propertize " Installed:"
|
|
||||||
'face (if active 'paradox-mode-line-face 'mode-line-inactive))
|
|
||||||
(propertize (int-to-string (+ (paradox--cas "installed")
|
|
||||||
(paradox--cas "dependency")
|
|
||||||
(paradox--cas "unsigned")))
|
|
||||||
'face (if active 'doom-modeline-buffer-file 'mode-line-inactive)))
|
|
||||||
(when paradox--current-filter
|
|
||||||
(concat
|
|
||||||
(propertize " Total:"
|
|
||||||
'face (if active 'paradox-mode-line-face 'mode-line-inactive))
|
|
||||||
(propertize (int-to-string (length package-archive-contents))
|
|
||||||
'face (if active 'doom-modeline-buffer-file 'mode-line-inactive)))))))
|
|
||||||
|
|
||||||
(provide 'doom-modeline-segments)
|
(provide 'doom-modeline-segments)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue