unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 118e05f570 2/2: New user option browse-url-guess-default-scheme
@ 2022-07-10 16:21 Eli Zaretskii
  2022-07-10 16:33 ` Bob Rogers
  2022-07-10 16:59 ` Stefan Kangas
  0 siblings, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2022-07-10 16:21 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: emacs-devel

> +(defcustom browse-url-guess-default-scheme "http"
> +  "URL scheme to use when `browse-url' (and related commands) has to guess.
> +
> +For example, when point is on an URL fragment like
> +\"www.example.org\", `browse-url' will assume that this is an
> +\"http\" URL by default (i.e. \"http://www.example.org\").
> +
> +Note that if you set this to \"https\", websites that do not yet
> +support HTTPS may not load correctly in your web browser.  Such
> +websites are increasingly rare, but they do still exist."
> +  :type 'string
> +  :version "29.1")
> +
>  (defun browse-url-url-at-point ()
>    (or (thing-at-point 'url t)
>        ;; assume that the user is pointing at something like gnu.org/gnu
>        (let ((f (thing-at-point 'filename t)))
> -        (and f (concat "http://" f)))))
> +        (and f (concat browse-url-guess-default-scheme "://" f)))))

I think browse-url-guess-default-scheme is not the best name, given
how the value is used.  The "guess" part has no place there: it's just
the default protocol to use when browse-url is _unable_ to guess.  The
doc string is misleading for the same reason: it talks about "having
to guess", but there's no guessing here.  What actually happens is
that when a URL has no scheme, browse-url uses the value as the
default scheme.

So I think the option should be renamed browse-url-default-scheme, and
the doc string amended to not mention any guessing.

Thanks.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-10 18:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-10 16:21 master 118e05f570 2/2: New user option browse-url-guess-default-scheme Eli Zaretskii
2022-07-10 16:33 ` Bob Rogers
2022-07-10 16:59   ` Stefan Kangas
2022-07-10 17:40     ` Bob Rogers
2022-07-10 18:15       ` Stefan Kangas
2022-07-10 16:59 ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).