From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kenta USAMI Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <86o7cx2ur6.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000006041aa0610805a51" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20337"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68913@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 03 21:49:27 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rWMx4-00054z-NP for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Feb 2024 21:49:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rWMwY-0004RF-BK; Sat, 03 Feb 2024 15:48:56 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rWMwV-0004Qt-Hp for bug-gnu-emacs@gnu.org; Sat, 03 Feb 2024 15:48:51 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rWMwV-00019I-8H for bug-gnu-emacs@gnu.org; Sat, 03 Feb 2024 15:48:51 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rWMwg-0005r4-G6 for bug-gnu-emacs@gnu.org; Sat, 03 Feb 2024 15:49:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Kenta USAMI Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Feb 2024 20:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68913 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 68913-submit@debbugs.gnu.org id=B68913.170699333822488 (code B ref 68913); Sat, 03 Feb 2024 20:49:02 +0000 Original-Received: (at 68913) by debbugs.gnu.org; 3 Feb 2024 20:48:58 +0000 Original-Received: from localhost ([127.0.0.1]:47141 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWMwc-0005qb-Ak for submit@debbugs.gnu.org; Sat, 03 Feb 2024 15:48:58 -0500 Original-Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]:55331) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWMwa-0005py-5r for 68913@debbugs.gnu.org; Sat, 03 Feb 2024 15:48:57 -0500 Original-Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2cf3a095ba6so35004321fa.2 for <68913@debbugs.gnu.org>; Sat, 03 Feb 2024 12:48:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zonu-me.20230601.gappssmtp.com; s=20230601; t=1706993318; x=1707598118; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=DgxsK3AMLvaxE2WpWGDQQvgGiZfjV/uYYzabz70qpMI=; b=t7zgdD/O5vM5ck0GquVIHdn/jY793eueGxqTk/tsoADhVeGOfvgOV+SiwcmfSywWth JZq8Qt3cWpvhW1j+45OjhF1cWmM/GUUoQBmM7DbCP1Xulp6I8d6QicBs/QEwbGiE9rcX rVpGNM1i9m+her1L6S+zySbJLqyY+uPXHTR5PVveMJ+6tJpPWZi/S4ybzwPAnOOlm6wu GJ4dUQArVubAt9kf+6rxFpV0jcVkkSWIphKCmhRVQL2/06cW7e1plLJ34Lpn5DLcDUiL sr4lqaZcH6H6H7hNBkT8tPLl4pBnseXvRXUFANNP7fqjCduPmIdW1Jd4eJjzmDScB1M6 lDrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706993318; x=1707598118; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DgxsK3AMLvaxE2WpWGDQQvgGiZfjV/uYYzabz70qpMI=; b=lE0GGJLnrZ2iIGfWiYkPaDEOcVId3OICFUyYBj6vb/TjmVmLBD9n9kk9vWOyh2P09o DrFSCiCEWJjoHPRvBxSoaHbb+LN54i9lbaAPZ2Pv8ebpzH6aoiDin+fb6WS5TE9fvCKi YHeXK1mm+Veb4iiscWrC11E44CX3FY2Fms2S+VBz2xvPvIF2weIoJN/VZYD9HmIpc77e tIw6Z5xSKClyBEpSxXpcUG1BBk4UwLMSdrMmAaN/GOfcuVeDBvOF8Lgg013dXCrLychG fnShnh0RlHoVA1dhJ9o8nx/AB3pNR9Ccyd8F7KqO4/BXKFcyIpZ4hIWwXJAz2jM9cnUc M3LA== X-Gm-Message-State: AOJu0YziGKmoQFzELE02wW5WcH4PfP0fftKSQZDPTJcxWrJHcEcXRNUf 0kH+WvXXP56XAhAhAftL7KJHrpkRKHsTytxJOqplPu+XNfj5CBkomjERSUCSfkg2hmOp4EhPY8L aTXzY/AWOdOzWvWj1ZF3ePGbqSk+QtwwQTplY5w== X-Google-Smtp-Source: AGHT+IGH4fyPj7FPLghb+mjnlPSuIi4JnALsPz6NFJp7XkcxXrrUr7G9UfsTxJu0wjqNWQjsTawc5i8LI72nqKnBWKM= X-Received: by 2002:a05:651c:454:b0:2cf:1395:5d69 with SMTP id g20-20020a05651c045400b002cf13955d69mr3132567ljg.52.1706993318374; Sat, 03 Feb 2024 12:48:38 -0800 (PST) In-Reply-To: <86o7cx2ur6.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:279381 Archived-At: --0000000000006041aa0610805a51 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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/s= oftware/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=3D 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=E5=B9=B42=E6=9C=884=E6=97=A5(=E6=97=A5) 4:49 Eli Zaretskii : > > From: Kenta USAMI > > 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. > --0000000000006041aa0610805a51 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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))
=C2=A0of 2024-01-26

This problem is most noti= ceable when using markdown-mode and goto-address-mode,=C2=A0
but = it also seems to occur even if goto-address-mode is disabled in text-mode o= r fundamental-mode.

You can see the problem by eva= luating the Lisp code below.

;;; foo.el
<= div>(require 'ert)
(require 'browse-url)

(ert-deftest tes= t-browse-url-url-at-point ()
=C2=A0 (let* ((text "
[![Emacs](https://www.gnu.org/software/emacs/ima= ges/emacs.png)](https://www.gnu.org/software/emacs/download.html)
&q= uot;)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(expected "https://www.gnu.org/software/e= macs/download.html")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(actual = (with-temp-buffer
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(insert text)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char 76)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(browse-url-url-at-point))))
= =C2=A0 =C2=A0 (should (string=3D expected actual))))

Eval= uate the expression directly in the buffer or save it to a file and check i= t with the command below.

$ emacs --batch -l f= oo.el -f ert-run-tests-batch-and-exit

2024=E5=B9=B42=E6=9C=884=E6=97= =A5(=E6=97=A5) 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&quo= t;.
> It seems that the ":" following https is deleted, but the br= owser actually
> normalizes
> the URL with the duplicate scheme "http://https://".

In what version of Emacs did you see that?=C2=A0 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?=C2=A0 Also, is the part inside [...] that
precedes the URL important for reproducing the problem?

Thanks.
--0000000000006041aa0610805a51--