From: Kenta USAMI <zonuexe@zonu.me>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 68913@debbugs.gnu.org
Subject: bug#68913: [PATCH] Fix browse-url-url-at-point so that scheme does not duplicate
Date: Sun, 4 Feb 2024 05:48:27 +0900 [thread overview]
Message-ID: <CAJB2i6YyzpsSmXfiU_VcpC7GYiVzFPAh+Sj2CotajObgWjKWyw@mail.gmail.com> (raw)
In-Reply-To: <86o7cx2ur6.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 2124 bytes --]
I'm using Emacs 29.2 on macOS.
GNU Emacs 29.2 (build 2, aarch64-apple-darwin23.3.0, NS appkit-2487.40
Version 14.3 (Build 23D56))
of 2024-01-26
This problem is most noticeable when using markdown-mode and
goto-address-mode,
but it also seems to occur even if goto-address-mode is disabled in
text-mode or fundamental-mode.
You can see the problem by evaluating the Lisp code below.
;;; foo.el
(require 'ert)
(require 'browse-url)
(ert-deftest test-browse-url-url-at-point ()
(let* ((text "
[![Emacs](
https://www.gnu.org/software/emacs/images/emacs.png)](https://www.gnu.org/software/emacs/download.html
)
")
(expected "https://www.gnu.org/software/emacs/download.html")
(actual (with-temp-buffer
(insert text)
(goto-char 76)
(browse-url-url-at-point))))
(should (string= expected actual))))
Evaluate the expression directly in the buffer or save it to a file and
check it with the command below.
$ emacs --batch -l foo.el -f ert-run-tests-batch-and-exit
2024年2月4日(日) 4:49 Eli Zaretskii <eliz@gnu.org>:
> > From: Kenta USAMI <zonuexe@zonu.me>
> > Date: Sun, 4 Feb 2024 04:17:29 +0900
> >
> > In the text below, move point to the second half of the URL and
> > execute M-x browse-url-at-point.
> >
> > ```
> > [![Emacs](
> >
> https://www.gnu.org/software/emacs/images/emacs.png)](https://www.gnu.org/software/emacs/download.html
> > )
> > ```
> >
> > Firefox and Chromium-based browsers appear to open the URL "https//
> > www.gnu.org/software/emacs/download.html".
> > It seems that the ":" following https is deleted, but the browser
> actually
> > normalizes
> > the URL with the duplicate scheme "http://https://".
>
> In what version of Emacs did you see that? And on what OS?
>
> Also, please post a complete recipe: do I type the above into the
> *scratch* buffer, or into some other buffer, and what should be the
> major-mode of that buffer? Also, is the part inside [...] that
> precedes the URL important for reproducing the problem?
>
> Thanks.
>
[-- Attachment #2: Type: text/html, Size: 3241 bytes --]
next prev parent reply other threads:[~2024-02-03 20:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-03 19:17 bug#68913: [PATCH] Fix browse-url-url-at-point so that scheme does not duplicate Kenta USAMI
2024-02-03 19:49 ` Eli Zaretskii
2024-02-03 20:48 ` Kenta USAMI [this message]
2024-02-03 20:59 ` Kenta USAMI
2024-02-08 12:07 ` 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=CAJB2i6YyzpsSmXfiU_VcpC7GYiVzFPAh+Sj2CotajObgWjKWyw@mail.gmail.com \
--to=zonuexe@zonu.me \
--cc=68913@debbugs.gnu.org \
--cc=eliz@gnu.org \
/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.