Skip to content

Commit 16c971f

Browse files
AzkaeMatthewZMD
authored andcommitted
fix file selection when the previous buffer was not closed
1 parent 57a1e8c commit 16c971f

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

aidermacs-output.el

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ Kills all pre-edit buffers that were created to store original file content."
159159
Creates temporary buffers containing the original content of all tracked files.
160160
This is skipped if `aidermacs-show-diff-after-change' is nil."
161161
(when aidermacs-show-diff-after-change
162+
(aidermacs--cleanup-temp-buffers)
162163
(when-let* ((files aidermacs--tracked-files))
163164
(let ((attempts 0)
164165
(max-attempts 3))
@@ -434,15 +435,20 @@ This is skipped if `aidermacs-show-diff-after-change' is nil."
434435
(font-lock-mode 1)
435436
(setq buffer-read-only t))
436437

437-
(define-key aidermacs-file-diff-selection-mode-map (kbd "q")
438-
(lambda ()
439-
(interactive)
440-
(kill-buffer)
441-
(aidermacs--cleanup-temp-buffers)))
438+
(defun aidermacs--file-diff-selection-quit ()
439+
"Quit file selection"
440+
(interactive)
441+
(kill-buffer)
442+
(aidermacs--cleanup-temp-buffers))
443+
444+
(define-key aidermacs-file-diff-selection-mode-map (kbd "q") 'aidermacs--file-diff-selection-quit)
442445

443446
(defun aidermacs--show-file-selection-buffer (files)
444447
"Display a buffer with a list of FILES that were edited.
445448
User can select a file to view its diff."
449+
(when-let (buf (get-buffer "*aidermacs-edited-files*"))
450+
(kill-buffer buf))
451+
446452
(let ((buf (get-buffer-create "*aidermacs-edited-files*"))
447453
(pre-edit-file-buffers aidermacs--pre-edit-file-buffers))
448454
(with-current-buffer buf

0 commit comments

Comments
 (0)