What I would like to accomplish is this:
- Allow emacs daemon to start with my start up applications like normal
- When I open an emacs frame I would like only the first one to start with my rss news feed from
elfeed
- When I open another frame I would like it to just open to the scratch buffer
I start the emacs daemon upon start up on startup with emacs --daemon
added to my Autostart list. I have emacsclient -a "" -c "$@"
bound to my launcher on my dock.
In my .emacs
file I initialize elfeed
just fine but my way of trying to start it is:
(elfeed-update) ;; Update elfeed when daemon starts
(defun start-elfeed ()
"This function will start elfeed and update it."
(if (not (get-buffer "*elfeed-search*"))
(progn
(elfeed)
(switch-to-buffer "*elfeed-search*")
)))
(add-hook 'after-make-frame-functions 'start-elfeed)
Now when I start emacs without the daemon it starts up in the scratch
buffer and elfeed
has not started, even in a background buffer. When I start it with emacsclient -a "" -c "$@"
the daemon seems to start but a frame never pops up. In the terminal I get this error:
*ERROR*: Wrong number of arguments: (lambda nil "This function will start elfeed and update it." (if (not (get-buffer "*elfeed-search*")) (progn (elfeed) (switch-to-buffer "*elfeed-search*")))), 1
I am new to customizing emacs with elisp and could use some help here. Does that error mean that my start-elfeed
function has the wrong number of arguments or am I using the after-make-frame-functions
hook wrong?
Thank you for any pointers here.
Some other info:
- Distro: Xubuntu 14.04
- Emacs 24.5
Edit Nov 11 I changed my function to be like this now:
(defun start-elfeed (&optional frame)
"This function will start elfeed and update it. I think it needs FRAME Passed to it."
(if (not (get-buffer "*elfeed-search*"))
(progn
(elfeed)
(while (not (get-buffer "*elfeed-search*")))
(switch-to-buffer "*elfeed-search*")
)))
(add-hook 'server-visit-hook 'start-elfeed)
(add-hook 'after-make-frame-functions 'start-elfeed)
Now it calls (elfeed)
but I don't think it is finished when it continues on to the (switch-to-buffer "*elfeed-search*")
function. The *scratch*
buffer is still the initial buffer but now there is a buffer called *elfeed-search*
, with the RSS feeds in it. It seems like the switch-to-buffer
call is being skipped over.