pinwheel: Restore claude and emacs panes with tmux-resurrect

This commit is contained in:
Alexander Heldt committed 2026-11-03 14:22:55 +01:00
1 parent 65c16f2ea6
commit 44afaf3936
5 files changed
+140 -1

No files matched your search

+35
View File
@@ -332,6 +332,41 @@ https://github.com/justbur/emacs-which-key
(setq history-length 25)
(savehist-mode 1)
#+END_SRC
** Remember open buffers per tmux pane
Used by `tmux-panes` to reopen buffers when tmux-resurrect restores a pane
#+BEGIN_SRC emacs-lisp
(defun tmux-panes--state-file ()
(when-let* ((pane (getenv "TMUX_PANE")))
(expand-file-name (concat "tmux-panes/" (substring pane 1) "/emacs")
(or (getenv "XDG_STATE_HOME") "~/.local/state"))))
(defun tmux-panes-save-buffers ()
(when-let* ((file (tmux-panes--state-file)))
(make-directory (file-name-directory file) t)
(let ((buffers (delq nil (mapcar (lambda (buffer)
(when-let* ((name (buffer-file-name buffer)))
(cons name (with-current-buffer buffer (point)))))
(buffer-list)))))
(with-temp-file file
(prin1 buffers (current-buffer))))))
(defun tmux-panes-restore-buffers ()
(when-let* ((file (getenv "TMUX_PANES_RESTORE")))
(setenv "TMUX_PANES_RESTORE" nil)
(when (file-readable-p file)
(let ((buffers (with-temp-buffer
(insert-file-contents file)
(read (current-buffer)))))
(dolist (entry (reverse buffers))
(when (file-exists-p (car entry))
(find-file (car entry))
(goto-char (cdr entry)))))
(delete-file file)))
(tmux-panes-save-buffers))
(add-hook 'emacs-startup-hook #'tmux-panes-restore-buffers)
(run-with-idle-timer 30 t #'tmux-panes-save-buffers)
#+END_SRC
** Vertico
#+BEGIN_SRC emacs-lisp
(use-package vertico