aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgcv <gepardcv@gmail.com>2022-07-05 21:45:15 -0700
committergcv <gepardcv@gmail.com>2022-07-05 21:45:15 -0700
commite994fb3067d343732f9fc0ae209cecd5a6192237 (patch)
tree2a96fa7117e15a09ea66116982bd263a26f0bd76
parent6e8f2889d5240855f5af6a860754be3a3e2a8338 (diff)
Avoid killing the last buffer in a perspective by default.
Variable: `persp-avoid-killing-last-buffer-in-perspective`, default `t`; this was formerly the experimental feature flag `persp-feature-flag-prevent-killing-last-buffer-in-perspective` which defaulted to `nil`.
-rw-r--r--CHANGELOG.md1
-rw-r--r--perspective.el16
2 files changed, 13 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f874f26..e84d577 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed
+- Avoid killing the last buffer in a perspective by default (`persp-avoid-killing-last-buffer-in-perspective`, default `t`; this was formerly the experimental feature flag `persp-feature-flag-prevent-killing-last-buffer-in-perspective` which defaulted to `nil`).
- **Breaking change:** (Emacs 28+ only): no longer provide a default `persp-mode-prefix-key`. It was `C-x x` in the past, which conflicts with key bindings shipping with Emacs 28. Users of Emacs 28 must now pick their own prefix key. The default remains unchanged for users of Emacs 27 and earlier.
- `persp-remove-buffer`: do not kill/remove a perspective's last left buffer.
- `persp-switch-to-buffer*`: tag with `'buffer` category so Marginalia can add its annotations.
diff --git a/perspective.el b/perspective.el
index 89a7b34..28bb4e7 100644
--- a/perspective.el
+++ b/perspective.el
@@ -130,10 +130,18 @@ save state when exiting Emacs."
:group 'perspective-mode
:type 'boolean)
-(defcustom persp-feature-flag-prevent-killing-last-buffer-in-perspective nil
- "Experimental feature flag: prevent killing the last buffer in a perspective."
+(defcustom persp-avoid-killing-last-buffer-in-perspective t
+ "Avoid killing the last buffer in a perspective.
+
+This should not be set to nil unless there's a bug. This was
+formerly a feature flag (persp-feature-flag-prevent-killing-last-buffer-in-perspective),
+but it seems likely to stick around as a just-in-case for a while. It makes sense
+to upgrade this from an experimental feature flag to a toggle.
+TODO: Eventually eliminate this setting?"
:group 'perspective-mode
:type 'boolean)
+(defalias 'persp-avoid-killing-last-buffer-in-perspective
+ 'persp-feature-flag-prevent-killing-last-buffer-in-perspective)
;;; --- implementation
@@ -1102,7 +1110,7 @@ perspective and no others are killed."
(run-hooks 'persp-killed-hook)
(mapc 'persp-remove-buffer (persp-current-buffers))
(setf (persp-killed (persp-curr)) t))
- (when persp-feature-flag-prevent-killing-last-buffer-in-perspective
+ (when persp-avoid-killing-last-buffer-in-perspective
(add-hook 'kill-buffer-query-functions 'persp-maybe-kill-buffer))
(remhash name (perspectives-hash))
(when (boundp 'persp--xref-marker-ring) (remhash name persp--xref-marker-ring))
@@ -1375,7 +1383,7 @@ named collections of buffers and window configurations."
(add-hook 'after-make-frame-functions 'persp-init-frame)
(add-hook 'delete-frame-functions 'persp-delete-frame)
(add-hook 'ido-make-buffer-list-hook 'persp-set-ido-buffers)
- (when persp-feature-flag-prevent-killing-last-buffer-in-perspective
+ (when persp-avoid-killing-last-buffer-in-perspective
(add-hook 'kill-buffer-query-functions 'persp-maybe-kill-buffer))
(setq read-buffer-function 'persp-read-buffer)
(mapc 'persp-init-frame (frame-list))