Spacemacs and Elfeed

I’ve recently re-installed Spacemacs because I’ve missed the Vim editing style quite a lot. Unfortunately, it has given me a lot of trouble getting it to the point of being configured the way that I want it to be configured - as in, the way I have my emacs configured.

You’d think that wouldn’t be such a problem, but it can be. Spacemacs layers are pre-configured and sometimes they are quite a hassle to edit if you don’t know lisp. Usually they have workarounds, and most are configured such that they are configured almost exactly as they are in the default way as they would be in emacs default anyway, but sometimes not.

Case and point: Elfeed. Elfeed is an RSS reader, and it is brilliant. I use it in emacs all the time. It’s absolutely wonderful, fast, and generally I get most of my news and stuff I want to read from it on most days. Why? Because I can search through all my feeds and avoid all the heavy, spammy, laggy stuff they load on pages these days. I can read the nice text and if I want to view it on the page (which I often do if I like the article), I simply hit a key and it opens automatically in the browser for me. It’s simple, neat, fast, and effective.

Unfortunately, the Spacemacs Elfeed Layer has a few changes which are not easy to remove. For instance, it adds a nice enough side buffer with the stories on the left hand screen with a buffer of the story on the right for reading, but it becomes a problem on a small screen because then the words don’t properly wrap around - which then forces you to turn on line wrap each time you hit a new story (because it changes into a new buffer for each new story).

Not knowing enough lisp, it was a difficult enough challenge to fix this problem - a problem which I had encountered over four months previously. Fortunately, at the time, I produced a little hack as a solution at the time:


(add-hook 'elfeed-show-mode-hook
	    (lambda ()
	      (let ((inhibit-read-only t)
		    (inhibit-modification-hooks t))
		(setq-local truncate-lines nil)
		(setq-local shr-width 85)
		(set-buffer-modified-p nil))
	      (set-face-attribute 'variable-pitch (selected-frame) :font "monofur for Powerline-21")
	      (setq-local left-margin-width 15)
	      (setq-local right-margin-width 15)

	      ))

Unfortunately, after re-installing a few months later, this no longer really seems to work (N.B. I also now use Operator Mono as a font).

Fortunately, this did partly work:


(setq elfeed-show-mode-hook
      (lambda ()
      (set-face-attribute 'variable-pitch (selected-frame) :font (font-spec :family "Century Schoolbook" :size 12))
      (setq fill-column 120)
      (setq elfeed-show-entry-switch #'my-show-elfeed)))

(defun my-show-elfeed (buffer)
  (with-current-buffer buffer
    (setq buffer-read-only nil)
    (goto-char (point-min))
;;    (re-search-forward "\n\n") - Commented out for it to work in Spacemacs
    (fill-individual-paragraphs (point) (point-max))
    (setq buffer-read-only t))
  (switch-to-buffer buffer))

Which is how I actually originally derived my hack all those months ago. However, there is one core problem which I discovered: you have to comment out (or remove) the re-search forward line as this will utterly break the keystroke setup for Spacemacs elfeed. Then it works well enough for now except it does return you to the search buffer after each time you hit “C-j” for the next story. It also removes the side panel buffer, but as I don’t have that in emacs, I don’t really miss it anyway.

All in all, I’m getting closer and closer to setting up Spacemacs the way I have my emacs set up. I won’t be using Spacemacs until I’m satisfied and as happy as I am with my emacs setup. I love my emacs setup and I don’t want to change very much. But it is true that every time I start editing text in Spacemacs, Vim controls just speed up any process by ten. As much as I love emacs, adding a vim layer to it was an idea of brilliance.

Share Comments
comments powered by Disqus