emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 118e05f570 2/2: New user option browse-url-guess-default-sche


From: Eli Zaretskii
Subject: Re: master 118e05f570 2/2: New user option browse-url-guess-default-scheme
Date: Sun, 10 Jul 2022 19:21:08 +0300

> +(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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]