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." Executes `autoscratch-rename-hook' afterwards."
(interactive) (interactive)
(rename-buffer (unless (eq major-mode "autoscratch-mode")
(generate-new-buffer-name (rename-buffer
(format "*%s-scratch*" (generate-new-buffer-name
(replace-regexp-in-string (format "*%s-scratch*"
"-mode" "" (replace-regexp-in-string
(format "%s" major-mode)))) "-mode" ""
(run-hooks 'autoscratch-rename-hook))) (format "%s" major-mode))))
(run-hooks 'autoscratch-rename-hook))))
(defun autoscratch-buffer () (defun autoscratch-buffer ()
"Create and switch to a new autoscratch buffer." "Create and switch to a new autoscratch buffer."