GNU bug report logs - #65914
Exclude current buffer from eww-switch-to-buffer

Previous Next

Package: emacs;

Reported by: James Thomas <jimjoe <at> gmx.net>

Date: Wed, 13 Sep 2023 10:46:01 UTC

Severity: wishlist

Tags: patch

Fixed in version 30.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 65914 in the body.
You can then email your comments to 65914 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#65914; Package emacs. (Wed, 13 Sep 2023 10:46:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to James Thomas <jimjoe <at> gmx.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 13 Sep 2023 10:46:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: James Thomas <jimjoe <at> gmx.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Exclude current buffer from eww-switch-to-buffer
Date: Wed, 13 Sep 2023 16:15:03 +0530
Tags: patch, notabug

This patch excludes the current buffer from the completion list of the
above command. The main motivation is avoiding one cycling keystroke in
icomplete.

For eg. a use-case of cycling visits between the last 3 visited eww
buffers:
Currently (to visit each buffer in succession), after pressing s, one
would have to cycle thrice in icomplete before pressing C-j. With this
patch, it would only need to be done twice (a mnemonic to remember the
number of times to cycle could be 'the last 2 *other* buffers' rather
than 'the last 3 buffers' it is currently).

Moreover, if you remember that the target eww buffer was the last n-th
buffer you opened, you may now simply cycle n times. Eg. n is 1 for the
previous buffer.


* lisp/net/eww.el (eww-switch-to-buffer):

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."

--




Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 15 Sep 2023 10:52:02 GMT) Full text and rfc822 format available.

Removed tag(s) notabug. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 15 Sep 2023 11:49:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65914; Package emacs. (Fri, 15 Sep 2023 12:06:02 GMT) Full text and rfc822 format available.

Message #12 received at 65914 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: James Thomas <jimjoe <at> gmx.net>
Cc: 65914 <at> debbugs.gnu.org
Subject: Re: bug#65914: Exclude current buffer from eww-switch-to-buffer
Date: Fri, 15 Sep 2023 05:05:23 -0700
James Thomas <jimjoe <at> gmx.net> writes:

> Tags: patch, notabug

[BTW, we typically don't use the "notabug" for patches.]

> This patch excludes the current buffer from the completion list of the
> above command. The main motivation is avoiding one cycling keystroke in
> icomplete.
>
> For eg. a use-case of cycling visits between the last 3 visited eww
> buffers:
> Currently (to visit each buffer in succession), after pressing s, one
> would have to cycle thrice in icomplete before pressing C-j. With this
> patch, it would only need to be done twice (a mnemonic to remember the
> number of times to cycle could be 'the last 2 *other* buffers' rather
> than 'the last 3 buffers' it is currently).
>
> Moreover, if you remember that the target eww buffer was the last n-th
> buffer you opened, you may now simply cycle n times. Eg. n is 1 for the
> previous buffer.

Thanks, I would like to install this patch.

Could you please send the patch as an attachment instead?  We prefer
that patches are created with a command like `git format-patch -1'.

Please also include:

- The bug number of this bug in the commit message, like so: Bug#65914

- A ChangeLog entry, as described in the CONTRIBUTE file.

That would make it easier for us to review and install this patch.
Thanks in advance.

> * lisp/net/eww.el (eww-switch-to-buffer):
>
> 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."
>
> --




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65914; Package emacs. (Sat, 16 Sep 2023 00:33:01 GMT) Full text and rfc822 format available.

Message #15 received at 65914 <at> debbugs.gnu.org (full text, mbox):

From: James Thomas <jimjoe <at> gmx.net>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 65914 <at> debbugs.gnu.org
Subject: Re: bug#65914: Exclude current buffer from eww-switch-to-buffer
Date: Sat, 16 Sep 2023 06:01:53 +0530
[Message part 1 (text/plain, inline)]
Stefan Kangas wrote:

> Thanks, I would like to install this patch.
>
> Could you please send the patch as an attachment instead?  We prefer
> that patches are created with a command like `git format-patch -1'.
>
> Please also include:
>
> - The bug number of this bug in the commit message, like so: Bug#65914
>
> - A ChangeLog entry, as described in the CONTRIBUTE file.
>
> That would make it easier for us to review and install this patch.
> Thanks in advance.

PFA:

[Message part 2 (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
--

Reply sent to Stefan Kangas <stefankangas <at> gmail.com>:
You have taken responsibility. (Sun, 01 Oct 2023 16:55:02 GMT) Full text and rfc822 format available.

Notification sent to James Thomas <jimjoe <at> gmx.net>:
bug acknowledged by developer. (Sun, 01 Oct 2023 16:55:02 GMT) Full text and rfc822 format available.

Message #20 received at 65914-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: James Thomas <jimjoe <at> gmx.net>
Cc: 65914-done <at> debbugs.gnu.org
Subject: Re: bug#65914: Exclude current buffer from eww-switch-to-buffer
Date: Sun, 1 Oct 2023 09:53:39 -0700
Version: 30.1

James Thomas <jimjoe <at> gmx.net> writes:

> Stefan Kangas wrote:
>
>> Thanks, I would like to install this patch.
>>
>> Could you please send the patch as an attachment instead?  We prefer
>> that patches are created with a command like `git format-patch -1'.
>>
>> Please also include:
>>
>> - The bug number of this bug in the commit message, like so: Bug#65914
>>
>> - A ChangeLog entry, as described in the CONTRIBUTE file.
>>
>> That would make it easier for us to review and install this patch.
>> Thanks in advance.
>
> PFA:

Installed on master [1: 5d9dbf17cf6].

Thanks again for the patch!

[1: 5d9dbf17cf6]: 2023-10-01 18:51:18 +0200
  Exclude current buffer from eww-switch-to-buffer
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=5d9dbf17cf6123ad24d8f9193818ac64606e3a45




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 30 Oct 2023 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 195 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.