Conform many modules to new conventions

This commit is contained in:
Henrik Lissner 2019-07-23 12:30:47 +02:00
parent 20e2aa0b18
commit c795a988e6
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
26 changed files with 161 additions and 165 deletions

View file

@ -46,7 +46,7 @@
;; Hooks
;;;###autoload
(defun +rss|elfeed-wrap ()
(defun +rss-elfeed-wrap-h ()
"Enhances an elfeed entry's readability by wrapping it to a width of
`fill-column'."
(let ((inhibit-read-only t)
@ -57,7 +57,7 @@
(set-buffer-modified-p nil)))
;;;###autoload
(defun +rss|cleanup ()
(defun +rss-cleanup-h ()
"Clean up after an elfeed session. Kills all elfeed and elfeed-org files."
(interactive)
;; `delete-file-projectile-remove-from-cache' slows down `elfeed-db-compact'
@ -75,7 +75,7 @@
(kill-buffer buf)))
(dolist (b search-buffers)
(with-current-buffer b
(remove-hook 'kill-buffer-hook #'+rss|cleanup :local)
(remove-hook 'kill-buffer-hook #'+rss-cleanup-h :local)
(kill-buffer b)))
(mapc #'kill-buffer show-buffers)))
@ -99,7 +99,7 @@
collect url)))
;;;###autoload
(defun +rss-put-sliced-image (spec alt &optional flags)
(defun +rss-put-sliced-image-fn (spec alt &optional flags)
"TODO"
(cl-letf (((symbol-function #'insert-image)
(lambda (image &optional alt _area _slice)
@ -108,7 +108,7 @@
(shr-put-image spec alt flags)))
;;;###autoload
(defun +rss-render-image-tag-without-underline (dom &optional url)
(defun +rss-render-image-tag-without-underline-fn (dom &optional url)
"TODO"
(let ((start (point)))
(shr-tag-img dom url)

View file

@ -36,21 +36,21 @@ easier to scroll through.")
(make-directory elfeed-db-directory t)
;; Ensure elfeed buffers are treated as real
(defun +rss-buffer-p (buf)
(string-match-p "^\\*elfeed" (buffer-name buf)))
(add-to-list 'doom-real-buffer-functions #'+rss-buffer-p nil #'eq)
(add-hook 'doom-real-buffer-functions
(defun +rss-buffer-p (buf)
(string-match-p "^\\*elfeed" (buffer-name buf))))
;; Enhance readability of a post
(add-hook 'elfeed-show-mode-hook #'+rss|elfeed-wrap)
(add-hook 'elfeed-show-mode-hook #'+rss-elfeed-wrap-h)
(add-hook! 'elfeed-search-mode-hook
(add-hook 'kill-buffer-hook #'+rss|cleanup nil t))
(add-hook 'kill-buffer-hook #'+rss-cleanup-h nil t))
;; Large images are annoying to scroll through, because scrolling follows the
;; cursor, so we force shr to insert images in slices.
(when +rss-enable-sliced-images
(setq-hook! 'elfeed-show-mode-hook
shr-put-image-function #'+rss-put-sliced-image
shr-external-rendering-functions '((img . +rss-render-image-tag-without-underline))))
shr-put-image-function #'+rss-put-sliced-image-fn
shr-external-rendering-functions '((img . +rss-render-image-tag-without-underline-fn))))
;; Keybindings
(after! elfeed-show
@ -68,7 +68,7 @@ easier to scroll through.")
:when (featurep! +org)
:after elfeed
:config
(setq rmh-elfeed-org-files
(let ((default-directory org-directory))
(let ((default-directory org-directory))
(setq rmh-elfeed-org-files
(mapcar #'expand-file-name +rss-elfeed-files)))
(elfeed-org))