From 683ab9a8a17b0550b7d97a4359a9570c30495c70 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sat, 1 Feb 2020 23:52:59 +0000 Subject: [PATCH] fix(workspaces): Don't restore magit buffers on startup Persp-mode doesn't quite manage to restore magit buffers correctly, so I've opted to have it ignore any and all magit buffers when performing it's auto-save. It is possible to configure it to know how to save and load the magit-status buffer for example, but the snippet for it from persp-mode's readme doesn't fully restore the buffer as is. And magit has many different kinds of buffers, so I've simply opted for having all ignored. --- modules/workspaces/siren-persp-mode.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/workspaces/siren-persp-mode.el b/modules/workspaces/siren-persp-mode.el index 20ae716..871d06f 100644 --- a/modules/workspaces/siren-persp-mode.el +++ b/modules/workspaces/siren-persp-mode.el @@ -58,6 +58,9 @@ (setq persp-auto-resume-time -1 persp-auto-save-opt 0)) + (defun siren-persp-mode-filter-magit-buffers (buf) + (string-match "^magit.*:" (buffer-name buf))) + (defun siren-persp-mode-ibuffer (arg) (interactive "P") (with-persp-buffer-list () (ibuffer arg))) @@ -79,6 +82,9 @@ (message "perspectives: %s" output))) :config + (add-to-list 'persp-common-buffer-filter-functions + 'siren-persp-mode-filter-magit-buffers) + (add-hook 'persp-activated-functions #'siren-persp-mode-show-current-perspective-name))