aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew White <mehw.is.me@inventati.org>2021-06-24 15:14:24 +0000
committerMatthew White <mehw.is.me@inventati.org>2021-10-21 01:27:37 +0200
commitb3e9de8cd76622d56f549e1cd9353a45ddecb4d6 (patch)
treefb2701a8c6c389c31a6700b76945b6d0e135cdfa
parent47ad2af21ea9507644ebf5af9e2e76f0a2d8b9c8 (diff)
persp-new: enable initial-major-mode only if needed
Like 'command-line' does, enable the 'initial-major-mode' in the scratch buffer only when the buffer is in 'fundamental-mode'.
-rw-r--r--CHANGELOG.md1
-rw-r--r--perspective.el3
2 files changed, 3 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fa139f1..2d61c0b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -65,6 +65,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
+- `persp-new`: enable `initial-major-mode` only if the scratch buffer is in `fundamental-mode`.
- `persp-new`: properly substitute command keys when inserting `initial-scratch-message` into scratch buffers.
- `persp-new`: do not recreate existing perspectives. This prevents from resetting perspectives to a state where in the perspective there's only the scratch buffer.
- `persp-reset-windows`: set `switch-to-buffer-preserve-window-point` to `nil` before calling `delete-window`, that up to Emacs 27.2 updates `window-prev-buffers` of all windows, unless the former is turned off.
diff --git a/perspective.el b/perspective.el
index 361f126..bffda68 100644
--- a/perspective.el
+++ b/perspective.el
@@ -557,7 +557,8 @@ buffer called \"*scratch* (NAME)\"."
(or (gethash name (perspectives-hash))
(make-persp :name name
(switch-to-buffer (persp-scratch-buffer name))
- (funcall initial-major-mode)
+ (when (eq major-mode 'fundamental-mode)
+ (funcall initial-major-mode))
(when (and (zerop (buffer-size))
initial-scratch-message)
(insert (substitute-command-keys initial-scratch-message))