dwdwdan · 2022-11-28 14:04
I'm using emacsclient, and i normally invoke it with `emacsclient -c -n` (via a keyboard shortcut) and then navigate to the file I want to edit. When I close emacs using my window manager, it kills the buffers. Is their a way to prevent this? i.e. for the buffers to stay open? As a slightly unrelated question, is there a way to keep the layout of buffers when I quit as well?
georgist · 2022-11-28 14:24
Run emacs as a deamon in the background and then connect to it, your buffers are still there, yeah you have to open them layout isn't preserved, someone else can answer that bit.
dwdwdan · 2022-11-28 14:36
My issue is that it isn’t showing up in the buffer list after I close and reopen emacsclient, I.e. I can open Emacsclient and navigate to `.bash_history`, close eMacs, then reopen. There isn’t a buffer in the helm switch buffer menu listed for `.bash_history`
georgist · 2022-11-28 14:52
Are you connecting to the daemon or starting a fresh emacs each time?
dwdwdan · 2022-11-28 14:53
Connected to the daemon. The daemon starts with my WM. It does have some org files in the buffer list which I load for my agenda
ETA: could it be that my WM is closing eMacs ‘wrong’ in some way?
tdavey · 2022-11-28 15:04
As for persisting the buffers and preserving the layout, desktop.el?
tassleoff · 2022-11-28 22:54
I have the following configuration:
(defconst +session-dir+ (expand-file-name "~/.emacs.d/session/"))
(require 'desktop)
(setq desktop-save t
desktop-load-locked-desktop t
desktop-path `(,+session-dir+)
desktop-dirname +session-dir+
desktop-base-file-name ".desktop"
desktop-base-lock-name ".desktop.lock")
(desktop-save-mode t)
;; save history between sessions
(require 'savehist)
(setq history-length 100
savehist-file (concat +session-dir+ ".history"))
(savehist-mode t)
;; save point between file visits
(require 'saveplace)
(setq save-place-limit 100
save-place-file (concat +session-dir+ ".point"))
(setq-default save-place t)