File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -1981,16 +1981,18 @@ If prefix ARG, delete all persistent scratches."
1981
1981
(message " Successfully deleted %S " (abbreviate-file-name file))))))
1982
1982
1983
1983
(defun +scratch-replace-with-persistent-scratch (&optional arg project-p)
1984
- " Replace the *scratch* buffer with a persistent one."
1984
+ " Replace the *scratch* buffer with a persistent one.
1985
+
1986
+ ARG and PROJECT-P are passed to `+scratch-open-buffer' ."
1985
1987
(interactive " P" )
1986
1988
(when-let ((buf (current-buffer ))
1987
1989
(s (get-buffer " *scratch*" )))
1988
1990
; ; Load the default persistent scratch buffer
1989
1991
(+scratch-open-buffer arg project-p 'same-window )
1990
1992
; ; Kill the Emacs' default scratch buffer
1991
1993
(kill-buffer s)
1992
- ; ; Switch to the previous buffer
1993
- (when (and (buffer-live-p buf) (string-match-p ( rx bol ( not " " )) (buffer-name buf)))
1994
+ ; ; Switch to the previous buffer, unless it has been killed (we was in *scratch*) or it is a hidden buffer
1995
+ (when (and (buffer-live-p buf) (string-match-p " ^[^ ] " (buffer-name buf)))
1994
1996
(switch-to-buffer buf))))
1995
1997
1996
1998
(with-eval-after-load 'project
You can’t perform that action at this time.
0 commit comments