summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-05-20 22:21:38 +0800
committerJSDurand <mmemmew@gmail.com>2021-05-20 22:21:38 +0800
commit402cadf8ee35a54e1f9493f6cf20189d30a5b004 (patch)
tree3ea9d0a793023e9af4aa2d33face730ee24126f7
parent2655155da480004b4bcb33e277d3ca68dd16c3f2 (diff)
Fix a bug of switch-to-buffer-same-mode.
* ibuffer.el (switch-to-buffer-same-mode): Fix a bug.
-rw-r--r--ibuffer.el33
1 files changed, 16 insertions, 17 deletions
diff --git a/ibuffer.el b/ibuffer.el
index 7f172ac..8d77296 100644
--- a/ibuffer.el
+++ b/ibuffer.el
@@ -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*"