Search code examples
emacsemacsclient

Start emacsclient without a new frame


If I am running emacs --daemon with a bunch of buffers already in it, is there a way to start emacsclient so it just opens whatever was the top buffer when I last worked in it? If I use emacsclient -t or emacsclient -c it creates a new frame and places it on top, how can I avoid this behavior and just resume whatever I was doing?


Solution

  • Seems like I found an answer, although it is somewhat inelegant. In my .bash_profile, I put

    alias emacs='emacsclient -a "" -t -e \(kill-buffer\)'
    

    so, that a daemon process is started if it doesn't exist, emacs client connects to it, creates a new buffer and immediately kills it, thus leaving whatever buffer was on top before (I use emacs desktop saving) is now displayed on top.