I want to modify elfeed using this article: https://cundy.me/post/elfeed/
I cannot load the following code:
(defun concatenate-authors (authors-list) "Given AUTHORS-LIST, list of plists; return string of all authors concatenated." (mapconcat (lambda (author) (plist-get author :name)) authors-list ", ")) (defun my-search-print-fn (entry) "Print ENTRY to the buffer." (let* ((date (elfeed-search-format-date (elfeed-entry-date entry))) (title (or (elfeed-meta entry :title) (elfeed-entry-title entry) "")) (title-faces (elfeed-search--faces (elfeed-entry-tags entry))) (feed (elfeed-entry-feed entry)) (feed-title (when feed (or (elfeed-meta feed :title) (elfeed-feed-title feed)))) (entry-authors (concatenate-authors (elfeed-meta entry :authors))) (tags (mapcar #'symbol-name (elfeed-entry-tags entry))) (tags-str (mapconcat (lambda (s) (propertize s 'face 'elfeed-search-tag-face)) tags ",")) (title-width (- (window-width) 10 elfeed-search-trailing-width)) (title-column (elfeed-format-column title (elfeed-clamp elfeed-search-title-min-width title-width elfeed-search-title-max-width) :left)) (authors-width 50) (authors-column (elfeed-format-column entry-authors (elfeed-clamp elfeed-search-title-min-width authors-width 100) :left))) (insert (propertize date 'face 'elfeed-search-date-face) " ") (insert (propertize title-column 'face title-faces 'kbd-help title) " ") (insert (propertize authors-column 'face 'elfeed-search-date-face 'kbd-help entry-authors) " ") ;; (when feed-title ;; (insert (propertize entry-authors ;; 'face 'elfeed-search-feed-face) " ")) (when entry-authors (insert (propertize feed-title 'face 'elfeed-search-feed-face) " ")) ;; (when tags ;; (insert "(" tags-str ")")) )) (setq elfeed-search-print-entry-function #'my-search-print-fn) I put this code in dotspacemacs/user-init and dotspacemacs/user-config and tested it separately... the code does not work.
However, when I reload my config (SPC f e R) the code loads just fine and my elfeed gets modified. But ONLY when I reload my config... it's not working after a normal restart or start up of emacs. What's wrong?
dotspacemacs/user-configyou should reload your dotfile usingSPC f e R, or alternatively restart Spacemacs. Do you mean it did not work even after restarting Spacemacs?SPC f e R, I guess your init file loads successfully, incl. theuser-configanduser-initsections. So I guess yourelfeed-search-print-entry-functionvariable gets redefined when starting and (auto)loading elfeed. Please, after restarting Spacemacs, check the value ofelfeed-search-print-entry-functionbefore starting and after starting 'elfeed'. If they are different then wrap yoursetqform as follows(with-eval-after-load 'elfeed-search (setq elfeed-search-print-entry-function #'my-search-print-fn)).