From 229b3e5be1df7c753410e840d6ea9c36f822fefd Mon Sep 17 00:00:00 2001 From: James Thomas Date: Sat, 16 Sep 2023 05:50:58 +0530 Subject: [PATCH] Exclude current buffer from eww-switch-to-buffer Exclude the current buffer from the completion list of eww-switch-to-buffer; to avoid an extra cycling keystroke (Bug#65914). * lisp/net/eww.el (eww-switch-to-buffer): --- lisp/net/eww.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 4ddda216afc..e43ef2bfe8b 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -2062,7 +2062,8 @@ eww-switch-to-buffer (let ((completion-extra-properties '(:annotation-function (lambda (buf) (with-current-buffer buf - (format " %s" (eww-current-url))))))) + (format " %s" (eww-current-url)))))) + (curbuf (current-buffer))) (pop-to-buffer-same-window (read-buffer "Switch to EWW buffer: " (cl-loop for buf in (nreverse (buffer-list)) @@ -2070,9 +2071,10 @@ eww-switch-to-buffer return buf) t (lambda (bufn) - (with-current-buffer - (if (consp bufn) (cdr bufn) (get-buffer bufn)) - (derived-mode-p 'eww-mode))))))) + (setq bufn (if (consp bufn) (cdr bufn) (get-buffer bufn))) + (and (with-current-buffer bufn + (derived-mode-p 'eww-mode)) + (not (eq bufn curbuf)))))))) (defun eww-toggle-fonts () "Toggle whether to use monospaced or font-enabled layouts." -- 2.34.1