From 9c602ea4e59eba485dbf5e8986b3e1d3ae78f51d Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Sun, 30 Jul 2017 14:04:01 +0200 Subject: [PATCH] avoid renaming self, which happened from time to time --- autoscratch-mode.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/autoscratch-mode.el b/autoscratch-mode.el index 3a12fd0..41b13f5 100644 --- a/autoscratch-mode.el +++ b/autoscratch-mode.el @@ -134,13 +134,14 @@ New name is '*autoscratch-* 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."