avoid renaming self, which happened from time to time

This commit is contained in:
Thomas von Dein
2017-07-30 14:04:01 +02:00
parent 82c1d1be3f
commit 9c602ea4e5

View File

@@ -134,13 +134,14 @@ New name is '*autoscratch-<new-major-mode><N>*
Executes `autoscratch-rename-hook' afterwards."
(interactive)
(rename-buffer
(generate-new-buffer-name
(format "*%s-scratch*"
(replace-regexp-in-string
"-mode" ""
(format "%s" major-mode))))
(run-hooks 'autoscratch-rename-hook)))
(unless (eq major-mode "autoscratch-mode")
(rename-buffer
(generate-new-buffer-name
(format "*%s-scratch*"
(replace-regexp-in-string
"-mode" ""
(format "%s" major-mode))))
(run-hooks 'autoscratch-rename-hook))))
(defun autoscratch-buffer ()
"Create and switch to a new autoscratch buffer."