dbordak / telephone-line

A new implementation of Powerline for Emacs
GNU General Public License v3.0
550 stars 51 forks source link

PDF-Tools pdf page-numbers in Telephone-line Bar #69

Closed WorldsEndless closed 6 years ago

WorldsEndless commented 6 years ago

I created the short functionality to include PDF page numbers for users of pdf-tools, and talk about it here:

http://tech.toryanderson.com/2018/05/27/display-pdf-pages-with-telephone-line/

Basically, code is added in two places. First a function, which is added into telephone line:

(use-package pdf-tools
  :config
  (add-hook 'pdf-view-mode-hook 'auto-revert-mode)
  (defun pdf-view-page-number-mode ()
    (string
     (nth (1- (pdf-view-current-page))
      (pdf-cache-pagelabels))
     (number-to-string (pdf-view-current-page))
     (number-to-string (pdf-cache-number-of-pages)))))

Then add to telephone line:

(use-package telephone-line
  :ensure t
  :config  
  (setq telephone-line-lhs '((accent telephone-line-vc-segment telephone-line-erc-modified-channels-segment telephone-line-process-segment)
                         (nil telephone-line-projectile-segment telephone-line-buffer-segment)
                         (nil pdf-view-page-number-mode)))
    (telephone-line-mode t))

I hope that helps others trying to combine these two great packages.