[Emacs] Update config and comments for Elfeed and pdf-tools

This commit is contained in:
Lucien Cartier-Tilet 2021-10-20 13:58:20 +02:00
parent 83df228404
commit b5bc6f2f02
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -1,4 +1,4 @@
#+title: Vanilla Emacs Configuration #+title: Emacs Configuration
#+setupfile: ~/org/config/headers #+setupfile: ~/org/config/headers
#+options: auto-id:t #+options: auto-id:t
#+html_head: <meta name="description" content="Phundraks Emacs Configuration" /> #+html_head: <meta name="description" content="Phundraks Emacs Configuration" />
@ -1141,16 +1141,23 @@ docker-compose from Emacs.
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Packages-Configuration-Applications-Elfeedoip0fl6184j0 :CUSTOM_ID: Packages-Configuration-Applications-Elfeedoip0fl6184j0
:END: :END:
Elfeed is a nice Atom and RSS reader for Emacs. The only thing I want
to change for now is the default search filter: I want to see not only
unread news but read news as well, a bit like my emails; and where the
database is to be stored.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package elfeed (use-package elfeed
:defer t :defer t
:straight (:build t) :straight (:build t)
:custom :custom
(elfeed-search-filter "@6-months-ago") ((elfeed-search-filter "@6-months-ago")
:config (elfeed-db-directory (expand-file-name ".elfeed-db"
(elfeed-goodies/setup)) user-emacs-directory))))
#+end_src #+end_src
Elfeed-goodies is a package which enhances the Elfeed experience.
Aside from running its setup command as soon as possible, I also set
in this code block all my keybinds for Elfeed here.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package elfeed-goodies (use-package elfeed-goodies
:defer t :defer t
@ -1189,6 +1196,7 @@ docker-compose from Emacs.
"«" #'elfeed-search-first-entry "«" #'elfeed-search-first-entry
"»" #'elfeed-search-last-entry "»" #'elfeed-search-last-entry
"b" #'elfeed-search-browse-url "b" #'elfeed-search-browse-url
"c" #'elfeed-db-compact
"f" '(nil :which-key "filter") "f" '(nil :which-key "filter")
"fc" #'elfeed-search-clear-filter "fc" #'elfeed-search-clear-filter
"fl" #'elfeed-search-live-filter "fl" #'elfeed-search-live-filter
@ -1199,11 +1207,15 @@ docker-compose from Emacs.
"tT" #'elfeed-search-tag-all "tT" #'elfeed-search-tag-all
"tU" #'elfeed-search-untag-all "tU" #'elfeed-search-untag-all
"u" '(nil :which-key "update") "u" '(nil :which-key "update")
"uf" #'elfeed-search-fetch "us" #'elfeed-search-fetch
"uF" #'elfeed-search-update "uS" #'elfeed-search-update
"uu" #'elfeed-update
"uU" #'elfeed-search-update--force
"y" #'elfeed-search-yank)) "y" #'elfeed-search-yank))
#+end_src #+end_src
Last but not least, my Elfeed configuration is stored in an org file
thanks to ~elfeed-org~.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package elfeed-org (use-package elfeed-org
:defer t :defer t
@ -1899,6 +1911,11 @@ reader?
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Packages-Configuration-Applications-PDF-Toolsvqb1fl6184j0 :CUSTOM_ID: Packages-Configuration-Applications-PDF-Toolsvqb1fl6184j0
:END: :END:
~pdf-tools~ enables PDF support for Emacs, much better than its built-in
support with DocView. Aside from the classical settings such as
keybinds, I also enable the midnight colors by default; think of it as
an equivalent of Zathuras recolor feature which kind of enables a
dark mode for PDFs.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package pdf-tools (use-package pdf-tools
:defer t :defer t
@ -1906,24 +1923,17 @@ reader?
:straight (:build t) :straight (:build t)
:mode (("\\.pdf\\'" . pdf-view-mode)) :mode (("\\.pdf\\'" . pdf-view-mode))
:hook (pdf-tools-enabled . pdf-view-midnight-minor-mode) :hook (pdf-tools-enabled . pdf-view-midnight-minor-mode)
:config :general
(progn (:keymaps 'pdf-view-mode-map
(with-eval-after-load 'pdf-view :states '(normal emacs)
(setq pdf-view-midnight-colors '("#d8dee9" . "#2e3440")))
(general-define-key
:keymaps 'pdf-view-mode-map
"SPC" nil "SPC" nil
"," nil) "," nil)
(general-define-key (:states 'normal
:states 'normal
:keymaps 'pdf-view-mode-map :keymaps 'pdf-view-mode-map
"SPC" nil
"," nil
"y" #'pdf-view-kill-ring-save "y" #'pdf-view-kill-ring-save
"t" #'evil-collection-pdf-view-next-line-or-next-page "t" #'evil-collection-pdf-view-next-line-or-next-page
"s" #'evil-collection-pdf-view-previous-line-or-previous-page) "s" #'evil-collection-pdf-view-previous-line-or-previous-page)
(general-define-key (:states '(normal motion)
:states 'motion
:keymaps 'pdf-view-mode-map :keymaps 'pdf-view-mode-map
:prefix "," :prefix ","
"a" '(nil :which-key "annotations") "a" '(nil :which-key "annotations")
@ -1949,9 +1959,15 @@ reader?
"ss" #'pdf-occur "ss" #'pdf-occur
"o" 'pdf-outline "o" 'pdf-outline
"m" 'pdf-view-midnight-minor-mode))) "m" 'pdf-view-midnight-minor-mode)
:config
(with-eval-after-load 'pdf-view
(setq pdf-view-midnight-colors '("#d8dee9" . "#2e3440"))))
#+end_src #+end_src
One thing ~pdf-tools~ doesnt handle is restoring the PDF to the last
point it was visited --- in other words, open the PDF where I last
left it.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package pdf-view-restore (use-package pdf-view-restore
:after pdf-tools :after pdf-tools