all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Daniel Mendler <mail@daniel-mendler.de>
Cc: 74730@debbugs.gnu.org
Subject: bug#74730: [PATCH] 30.0.92; eww-browse-with-external-browser and eww-follow-link should use browse-url-with-browser-kind
Date: Sun, 08 Dec 2024 15:32:31 +0200	[thread overview]
Message-ID: <86msh6fggg.fsf@gnu.org> (raw)
In-Reply-To: <8734iycos7.fsf@daniel-mendler.de> (message from Daniel Mendler on Sun, 08 Dec 2024 14:00:56 +0100)

> From: Daniel Mendler <mail@daniel-mendler.de>
> Cc: 74730@debbugs.gnu.org
> Date: Sun, 08 Dec 2024 14:00:56 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> > If we can make it so that existing customizations of
> >> > browse-url-secondary-browser-function will keep working as they did,
> >> > then the backward incompatibility issue will disappear, and such a
> >> > change becomes possible.  But in any case, the doc string of
> >> > browse-url-secondary-browser-function should be amended if we are
> >> > going to support its setting to eww.
> >> 
> >> Okay, I can do that.
> >> 
> >> > Also, are we sure all the relevant functions always have the
> >> > 'browse-url-browser-kind property? what about user-defined functions,
> >> > for example?
> >> 
> >> User-defined functions may not have the property. But we can be
> >> conservative and preserve the existing behavior in the case where the
> >> property is unavailable, treating the missing property like the value
> >> `external'. Only if the property is found and `internal', the
> >> `browse-url-with-browser-kind' will be used to make sure that an
> >> external browser is used. As I mentioned, alternatively one can be even
> >> more conservative and only use `browse-url-with-browser-kind' if
> >> `browse-url-secondary-browser-function' is set to `eww-browse-url'. That
> >> might be a little bit too restrictive, but it would be completely
> >> backward compatible.
> >
> > Looking forward to seeing an updated patch which preserves the current
> > behavior wrt browse-url-secondary-browser-function's customization.
> >
> > Thanks.
> 
> Updated patch attached.

Thanks, a few comments below.

>  (defcustom browse-url-secondary-browser-function 'browse-url-default-browser
>    "Function used to launch an alternative browser.
> -This is usually an external browser (that is, not eww or w3m),
> -used as the secondary browser choice, typically when a prefix
> -argument is given to a URL-opening command in those modes that
> -support this (for instance, eww/shr).
> +
> +This is browser is used as the secondary browser choice, typically
> +when a prefix argument is given to a URL-opening command in those
> +modes that support this (for instance `goto-addr-at-point', eww or shr).

This doc string should explain the assumptions about this and the
other variable, browse-url-browser-function: that either one or the
other invokes the external browser, and the other one should then NOT
do the same.  Users should be aware and understand the rules of the
game here, which are now slightly more complex than they were before,
so removing the previous assumption without replacing it with anything
makes the doc string less useful.

>  (defun eww-browse-with-external-browser (&optional url)
>    "Browse the current URL with an external browser.
> -The browser to used is specified by the
> -`browse-url-secondary-browser-function' variable."
> +Calls `browse-url-secondary-browser-function' if it does not correspond
> +to EWW.  Otherwise `browse-url' is used."
                      ^^^^^^^^^^^^^^^^^^^^
Passive tense alert!

>    (interactive nil eww-mode)
> -  (funcall browse-url-secondary-browser-function
> +  (funcall (if (memq browse-url-secondary-browser-function
> +                     '(eww eww-browse-url))
> +               #'browse-url
> +             browse-url-secondary-browser-function)

I think we should allow here (and document) more just 2 literal
functions hard-coded in this command.  Perhaps some special property
on the function's symbol?  Then these two specific functions can be
supported via the property, and what's more important, users and
applications could use other functions with the same semantics.

>  (defun eww-follow-link (&optional external mouse-event)
>    "Browse the URL under point.
>  If EXTERNAL is single prefix, browse the URL using
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
What does this mean? does it mean that EXTERNAL is non-nil in
interactive usage if the command is invoked with C-u?  If so, let's
say that.  (Yes, I know that problem came from the original doc
string.)

> @@ -2180,7 +2182,7 @@ eww-follow-link
>        ;; and `browse-url-mailto-function'.
>        (browse-url url))
>       ((and (consp external) (<= (car external) 4))
> -      (funcall browse-url-secondary-browser-function url)
> +      (eww-browse-with-external-browser url)

I'm not sure I agree.  The call to eww-browse-with-external-browser
will no longer ensure an external browser is used, after these
changes.  Why not call browse-url-default-browser instead?

In any case, the doc string should say that if no external browser
could be found, this will fall back to eww.





  reply	other threads:[~2024-12-08 13:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-07 22:02 bug#74730: [PATCH] 30.0.92; eww-browse-with-external-browser and eww-follow-link should use browse-url-with-browser-kind Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08  5:57 ` Eli Zaretskii
2024-12-08  6:13   ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08  7:03     ` Eli Zaretskii
2024-12-08  7:27   ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08 12:02     ` Eli Zaretskii
2024-12-08 13:00       ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08 13:32         ` Eli Zaretskii [this message]
2024-12-08 17:39           ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-12 10:42             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86msh6fggg.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=74730@debbugs.gnu.org \
    --cc=mail@daniel-mendler.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.