2018-04-12 16:03:48 +02:00
|
|
|
;;; tools/pdf/+modeline.el -*- lexical-binding: t; -*-
|
|
|
|
|
2018-05-29 15:34:45 +02:00
|
|
|
(def-modeline-segment! +pdf-pages
|
2018-04-12 16:03:48 +02:00
|
|
|
"Current and total page indicator for PDF documents."
|
2018-07-25 15:37:24 +02:00
|
|
|
(format "P %d/%d" (pdf-view-current-page) (pdf-cache-number-of-pages)))
|
2018-04-12 16:03:48 +02:00
|
|
|
|
2018-09-26 12:55:22 +02:00
|
|
|
(if (featurep! :ui modeline)
|
2018-07-25 15:37:24 +02:00
|
|
|
(def-modeline-format! '+pdf
|
2019-01-02 15:16:05 +01:00
|
|
|
'(+modeline-matches " " +modeline-buffer-id " " +pdf-pages)
|
|
|
|
'(+modeline-major-mode (vc-mode (" " +modeline-vcs))))
|
2018-07-25 15:37:24 +02:00
|
|
|
(def-modeline! '+pdf
|
2018-09-26 12:55:22 +02:00
|
|
|
'(bar matches " " buffer-info " " +pdf-pages)
|
2018-07-25 15:37:24 +02:00
|
|
|
'(major-mode vcs)))
|
|
|
|
|
|
|
|
(defun +pdf|init-modeline ()
|
2018-09-26 12:55:22 +02:00
|
|
|
(funcall (if (featurep! :ui modeline)
|
2018-07-25 15:37:24 +02:00
|
|
|
#'set-modeline!
|
|
|
|
#'doom-set-modeline)
|
|
|
|
'+pdf))
|
|
|
|
(add-hook 'pdf-tools-enabled-hook #'+pdf|init-modeline)
|