GNU bug report logs -
#65346
30.0.50; *lisp/net/eww.el: new function 'eww-open-in-new-buffer-background'
Previous Next
Reported by: Lin Sun <sunlin7 <at> yahoo.com>
Date: Wed, 16 Aug 2023 19:41:01 UTC
Severity: normal
Found in version 30.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
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 65346 in the body.
You can then email your comments to 65346 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65346
; Package
emacs
.
(Wed, 16 Aug 2023 19:41:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Lin Sun <sunlin7 <at> yahoo.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 16 Aug 2023 19:41:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
In a EWW buffer, the user can use the 'eww-open-in-new-buffer' or "M-RET" to
open a URL in a new buffer and focus on the new buffer.
Sometimes people want to open the URLs in the background first and read them
later, so here is the 'eww-open-in-new-buffer-background' function,
binding to "C-<return>".
Example: using the eww to open the hack news and browse the topics,
open some topics in background with "C-<return>", and read them later.
Please help review the patch. Thanks.
Best Regards
Lin
[0001-lisp-net-eww.el-new-function-eww-open-in-new-buffer-.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65346
; Package
emacs
.
(Thu, 17 Aug 2023 07:50:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 65346 <at> debbugs.gnu.org (full text, mbox):
> Date: Wed, 16 Aug 2023 19:39:30 +0000
> From: Lin Sun via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> In a EWW buffer, the user can use the 'eww-open-in-new-buffer' or "M-RET" to
> open a URL in a new buffer and focus on the new buffer.
>
> Sometimes people want to open the URLs in the background first and read them
> later, so here is the 'eww-open-in-new-buffer-background' function,
> binding to "C-<return>".
>
> Example: using the eww to open the hack news and browse the topics,
> open some topics in background with "C-<return>", and read them later.
"Background" is a problematic word for this, since that's not what you
mean: you mean not to select the window displaying the URL.
And I don't think we need a separate command for that: how about doing
this in eww-open-in-new-buffer instead, if the user invokes it with a
prefix argument C-u?
And finally, what happens if the following condition, tested by
eww-open-in-new-buffer, is fulfilled:
(when (or (eq eww-browse-url-new-window-is-tab t)
(and (eq eww-browse-url-new-window-is-tab 'tab-bar)
tab-bar-mode))
In this case, AFAIU the URL is opened in a new tab.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65346
; Package
emacs
.
(Thu, 17 Aug 2023 22:52:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 65346 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Eli,
> "Background" is a problematic word for this, since that's not what you
> mean: you mean not to select the window displaying the URL.
>
> And I don't think we need a separate command for that: how about doing
> this in eww-open-in-new-buffer instead, if the user invokes it with a
> prefix argument C-u?
>
> And finally, what happens if the following condition, tested by
> eww-open-in-new-buffer, is fulfilled:
>
> (when (or (eq eww-browse-url-new-window-is-tab t)
> (and (eq eww-browse-url-new-window-is-tab 'tab-bar)
> tab-bar-mode))
>
> In this case, AFAIU the URL is opened in a new tab.
Thank you for the comment, and agree with you, so I rewrote the
function `eww-open-in-new-buffer' with "C-u" support (also with an
optional argument "url"), then there is no "background" description.
I also tested the new patch with tab-bar-mode on and off, it works for
both scenarios.
Please help review again. Thanks.
Best regards
Lin
[0001-lisp-net-eww.el-eww-open-in-new-buffer-able-to-stay-.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65346
; Package
emacs
.
(Fri, 18 Aug 2023 02:17:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 65346 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> "Background" is a problematic word for this, since that's not what you
> mean: you mean not to select the window displaying the URL.
Right - but isn't that the wording known from other browsers?
> And I don't think we need a separate command for that: how about doing
> this in eww-open-in-new-buffer instead, if the user invokes it with a
> prefix argument C-u?
That's not very convenient, though. How about adding an option that
toggles the meaning of the prefix arg?
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65346
; Package
emacs
.
(Fri, 18 Aug 2023 05:53:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 65346 <at> debbugs.gnu.org (full text, mbox):
> From: Lin Sun <sunlin7 <at> yahoo.com>
> Date: Thu, 17 Aug 2023 22:51:04 +0000
> Cc: 65346 <at> debbugs.gnu.org
>
> Thank you for the comment, and agree with you, so I rewrote the
> function `eww-open-in-new-buffer' with "C-u" support (also with an
> optional argument "url"), then there is no "background" description.
>
> I also tested the new patch with tab-bar-mode on and off, it works for
> both scenarios.
>
> Please help review again. Thanks.
Thanks. However, the way you implemented my suggestion is not what I
had in mind.
> -(defun eww-open-in-new-buffer ()
> - "Fetch link at point in a new EWW buffer."
> - (interactive)
> - (let ((url (eww-suggested-uris)))
> - (if (null url) (user-error "No link at point")
> - (when (or (eq eww-browse-url-new-window-is-tab t)
> - (and (eq eww-browse-url-new-window-is-tab 'tab-bar)
> - tab-bar-mode))
> - (let ((tab-bar-new-tab-choice t))
> - (tab-new)))
> - ;; clone useful to keep history, but
> - ;; should not clone from non-eww buffer
> - (with-current-buffer
> - (if (eq major-mode 'eww-mode) (clone-buffer)
> - (generate-new-buffer "*eww*"))
> - (unless (equal url (eww-current-url))
> - (eww-mode)
> - (eww (if (consp url) (car url) url)))))))
> +(defun eww--open-url-in-new-buffer (url)
> + "Open the URL in a new EWW buffer."
> + ;; clone useful to keep history, but
> + ;; should not clone from non-eww buffer
> + (with-current-buffer
> + (if (eq major-mode 'eww-mode) (clone-buffer)
> + (generate-new-buffer "*eww*"))
> + (unless (equal url (eww-current-url))
> + (eww-mode)
> + (eww (if (consp url) (car url) url)))))
> +
> +(defun eww-open-in-new-buffer (stay &optional url)
> + "Fetch URL in a new EWW buffer.
This changes the API of a public function in incompatible ways, which
we try very hard not to do. Instead, the signature or
eww-open-in-new-buffer should be like this:
(defun eww-open-in-new-buffer (&optional no-select)
and the new NO-SELECT argument should be set non-nil by C-u.
> + (user-error "No avaliable link")))
This also changes the text of the error message in this case. Was
that really necessary? The original text was more accurate, I think.
Also, this new feature needs a NEWS entry and a suitable addition to
the EWW manual.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65346
; Package
emacs
.
(Fri, 18 Aug 2023 06:08:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 65346 <at> debbugs.gnu.org (full text, mbox):
> From: Michael Heerdegen <michael_heerdegen <at> web.de>
> Cc: Lin Sun <sunlin7 <at> yahoo.com>, 65346 <at> debbugs.gnu.org
> Date: Fri, 18 Aug 2023 04:15:57 +0200
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > "Background" is a problematic word for this, since that's not what you
> > mean: you mean not to select the window displaying the URL.
>
> Right - but isn't that the wording known from other browsers?
Not AFAIK, no. And in Emacs, "background" has several other meanings,
which could confuse.
> > And I don't think we need a separate command for that: how about doing
> > this in eww-open-in-new-buffer instead, if the user invokes it with a
> > prefix argument C-u?
>
> That's not very convenient, though. How about adding an option that
> toggles the meaning of the prefix arg?
Fine by me.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65346
; Package
emacs
.
(Fri, 18 Aug 2023 19:04:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 65346 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Fri, Aug 18, 2023 at 5:52 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
> This changes the API of a public function in incompatible ways, which
> we try very hard not to do. Instead, the signature or
> eww-open-in-new-buffer should be like this:
>
> (defun eww-open-in-new-buffer (&optional no-select)
>
> and the new NO-SELECT argument should be set non-nil by C-u.
>
> > + (user-error "No avaliable link")))
>
> This also changes the text of the error message in this case. Was
> that really necessary? The original text was more accurate, I think.
>
> Also, this new feature needs a NEWS entry and a suitable addition to
> the EWW manual.
The attached patch included changes for the function, error message,
NEWS and EWW manual.
Please help review it.
Thanks. Regards
[0001-lisp-net-eww.el-eww-open-in-new-buffer-able-to-stay-.patch (text/x-patch, attachment)]
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Sun, 20 Aug 2023 08:50:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Lin Sun <sunlin7 <at> yahoo.com>
:
bug acknowledged by developer.
(Sun, 20 Aug 2023 08:50:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 65346-done <at> debbugs.gnu.org (full text, mbox):
> From: Lin Sun <sunlin7 <at> yahoo.com>
> Date: Fri, 18 Aug 2023 19:03:08 +0000
> Cc: 65346 <at> debbugs.gnu.org
>
> On Fri, Aug 18, 2023 at 5:52 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
> > This changes the API of a public function in incompatible ways, which
> > we try very hard not to do. Instead, the signature or
> > eww-open-in-new-buffer should be like this:
> >
> > (defun eww-open-in-new-buffer (&optional no-select)
> >
> > and the new NO-SELECT argument should be set non-nil by C-u.
> >
> > > + (user-error "No avaliable link")))
> >
> > This also changes the text of the error message in this case. Was
> > that really necessary? The original text was more accurate, I think.
> >
> > Also, this new feature needs a NEWS entry and a suitable addition to
> > the EWW manual.
>
> The attached patch included changes for the function, error message,
> NEWS and EWW manual.
> Please help review it.
Thanks, installed on master, and closing the bug.
Please in the future include a more detailed log of the changes in the
commit log message, and please follow our conventions for that as
described in CONTRIBUTE. I did it for you this time, but it required
quite a lot of manual work.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65346
; Package
emacs
.
(Sun, 20 Aug 2023 14:30:02 GMT)
Full text and
rfc822 format available.
Message #31 received at 65346-done <at> debbugs.gnu.org (full text, mbox):
Hi Eli,
On Sun, Aug 20, 2023 at 8:49 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
>
> Thanks, installed on master, and closing the bug.
>
> Please in the future include a more detailed log of the changes in the
> commit log message, and please follow our conventions for that as
> described in CONTRIBUTE. I did it for you this time, but it required
> quite a lot of manual work.
Thank you so much, really appreciate it ! Best Regards
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65346
; Package
emacs
.
(Sun, 20 Aug 2023 17:28:02 GMT)
Full text and
rfc822 format available.
Message #34 received at 65346 <at> debbugs.gnu.org (full text, mbox):
> +(defun eww-open-in-new-buffer (&optional no-select url)
> + "Fetch URL in a new EWW buffer.
> +
> +If the NO-SELECT is not `nil', the forcus will stay on current buffer.
> +
> +If the URL is `nil', it will try `eww-suggested-uris' under current cursor."
> + (interactive "P")
> + (if-let ((url (or url (eww-suggested-uris))))
> + (if (or (eq eww-browse-url-new-window-is-tab t)
> + (and (eq eww-browse-url-new-window-is-tab 'tab-bar)
> + tab-bar-mode))
> + (let ((tab-bar-new-tab-choice t))
> + (tab-new)
> + (eww--open-url-in-new-buffer url)
> + (when no-select
> + (tab-bar-switch-to-prev-tab)))
tab-bar-switch-to-prev-tab is a wrong function, please use
tab-bar-switch-to-recent-tab instead.
Also please add a new command to open a tab in background.
Then new command could be bound to the standard RET modifier
used in all web browsers to open a tab in background.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65346
; Package
emacs
.
(Sun, 27 Aug 2023 16:41:01 GMT)
Full text and
rfc822 format available.
Message #37 received at 65346 <at> debbugs.gnu.org (full text, mbox):
> From: Juri Linkov <juri <at> linkov.net>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, 65346 <at> debbugs.gnu.org
> Date: Sun, 20 Aug 2023 19:44:03 +0300
>
> > +(defun eww-open-in-new-buffer (&optional no-select url)
> > + "Fetch URL in a new EWW buffer.
> > +
> > +If the NO-SELECT is not `nil', the forcus will stay on current buffer.
> > +
> > +If the URL is `nil', it will try `eww-suggested-uris' under current cursor."
> > + (interactive "P")
> > + (if-let ((url (or url (eww-suggested-uris))))
> > + (if (or (eq eww-browse-url-new-window-is-tab t)
> > + (and (eq eww-browse-url-new-window-is-tab 'tab-bar)
> > + tab-bar-mode))
> > + (let ((tab-bar-new-tab-choice t))
> > + (tab-new)
> > + (eww--open-url-in-new-buffer url)
> > + (when no-select
> > + (tab-bar-switch-to-prev-tab)))
>
> tab-bar-switch-to-prev-tab is a wrong function, please use
> tab-bar-switch-to-recent-tab instead.
Thanks, done.
> Also please add a new command to open a tab in background.
> Then new command could be bound to the standard RET modifier
> used in all web browsers to open a tab in background.
I didn't do that; patches welcome.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 25 Sep 2023 11:24:14 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 228 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.