diff options
author | JSDurand <mmemmew@gmail.com> | 2021-05-20 22:21:38 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2021-05-20 22:21:38 +0800 |
commit | 402cadf8ee35a54e1f9493f6cf20189d30a5b004 (patch) | |
tree | 3ea9d0a793023e9af4aa2d33face730ee24126f7 | |
parent | 2655155da480004b4bcb33e277d3ca68dd16c3f2 (diff) |
Fix a bug of switch-to-buffer-same-mode.
* ibuffer.el (switch-to-buffer-same-mode): Fix a bug.
-rw-r--r-- | ibuffer.el | 33 |
1 files changed, 16 insertions, 17 deletions
@@ -39,19 +39,20 @@ If the optional ARG is non-nil, then produce an IBUFFER buffer (interactive "P") (cond ((null arg) - (let ((def (buffer-name - (car - (delete nil - (mapcar - (lambda (buf) - (and - (provided-mode-derived-p - (buffer-local-value 'major-mode buf) - (buffer-local-value 'major-mode (current-buffer))) - (not (= (aref (buffer-name buf) 0) 32)) - (not (eq buf (current-buffer))) - buf)) - (buffer-list))))))) + (let* ((mode (buffer-local-value 'major-mode (current-buffer))) + (def (buffer-name + (car + (delete nil + (mapcar + (lambda (buf) + (and + (provided-mode-derived-p + (buffer-local-value 'major-mode buf) + mode) + (not (= (aref (buffer-name buf) 0) 32)) + (not (eq buf (current-buffer))) + buf)) + (buffer-list))))))) (switch-to-buffer (read-buffer (format "Switch to buffer with major mode %S:" @@ -62,11 +63,9 @@ If the optional ARG is non-nil, then produce an IBUFFER buffer (buffer-local-value 'major-mode (cond ((consp name-or-cons) - (car name-or-cons)) + (cdr name-or-cons)) ((get-buffer name-or-cons)))) - (buffer-local-value - 'major-mode - (current-buffer)))))))) + mode)))))) ((ibuffer nil (format "*Buffers for %S*" |