From 0bb2e4c86f986c35bf6760ae5c8e5ad4b9eace7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Vanicat?= Date: Wed, 26 May 2010 17:09:35 +0200 Subject: [PATCH 1/2] Removing a duplicate switch-to-buffer We don't need to change buffer twice when we use a new buffer --- magit.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/magit.el b/magit.el index 07b605e5..77868e78 100644 --- a/magit.el +++ b/magit.el @@ -2495,11 +2495,10 @@ insert a line to tell how to insert more of them" (setq topdir (magit-get-top-dir dir)))) (when topdir (let ((buf (or (magit-find-buffer 'status topdir) - (switch-to-buffer - (get-buffer-create - (concat "*magit: " - (file-name-nondirectory - (directory-file-name topdir)) "*")))))) + (get-buffer-create + (concat "*magit: " + (file-name-nondirectory + (directory-file-name topdir)) "*"))))) (switch-to-buffer buf) (magit-mode-init topdir 'status #'magit-refresh-status) (magit-status-mode t))))) From ab90bdf1590d6589759366a444fc6fb7a9a84056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Vanicat?= Date: Wed, 26 May 2010 17:15:50 +0200 Subject: [PATCH 2/2] [magit-status] Use generate-new-buffer for creating a new buffer Closes #13: We used to use get-buffer-create, but it will reuse a buffer with the same name, when we want to create a new one with an unique name. --- magit.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magit.el b/magit.el index 77868e78..bc822967 100644 --- a/magit.el +++ b/magit.el @@ -2495,7 +2495,7 @@ insert a line to tell how to insert more of them" (setq topdir (magit-get-top-dir dir)))) (when topdir (let ((buf (or (magit-find-buffer 'status topdir) - (get-buffer-create + (generate-new-buffer (concat "*magit: " (file-name-nondirectory (directory-file-name topdir)) "*")))))