From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 03 14:18:07 2024 Received: (at submit) by debbugs.gnu.org; 3 Feb 2024 19:18:07 +0000 Received: from localhost ([127.0.0.1]:47078 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWLWh-0003Xr-0L for submit@debbugs.gnu.org; Sat, 03 Feb 2024 14:18:07 -0500 Received: from lists.gnu.org ([2001:470:142::17]:59500) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWLWe-0003XL-0d for submit@debbugs.gnu.org; Sat, 03 Feb 2024 14:18:05 -0500 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 1rWLWM-0008Qc-M0 for bug-gnu-emacs@gnu.org; Sat, 03 Feb 2024 14:17:46 -0500 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rWLWK-0001F4-OA for bug-gnu-emacs@gnu.org; Sat, 03 Feb 2024 14:17:46 -0500 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2cf4fafa386so39684181fa.1 for ; Sat, 03 Feb 2024 11:17:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zonu-me.20230601.gappssmtp.com; s=20230601; t=1706987861; x=1707592661; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=vbYNyuAvKRlj+5QfhjZejXc7lKgV0Mg8sRrBqVMcKmY=; b=NevdRXgGZq9HW29IxCa8HRFZ0naarQr9Iff42sbatOSdqKirF0csBFjgNY9AgWk1fv m5xYWisLIQcw6buFk7p7CLKNa2digP2mQd7phv7V9fgRE0D3lD+PgTGycVoD6ybBm9+w GTZog0KCHUzsKneTzQJQVTuLyLY2IxSeuXdl8amNfkC3IBRXX18wRqcVPjm5GlVPvC4q KrrZ2ulcZRc1o+PzSEfXTzfiuFSlSDgeMiAGMOJgNBE1+WCtF3TnKl6QgEghf28DoLM4 reuVn5RhZK7mFcmE9AXRIW5YcTyKmc8qFiy6KP3CSVCIzh9nZTz9xK/eb3oIqlUf2h7x eacA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706987861; x=1707592661; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=vbYNyuAvKRlj+5QfhjZejXc7lKgV0Mg8sRrBqVMcKmY=; b=dthqoEY/LDPUhh5s//aNnHd0OkJx4yc7awMQkhOgV2GcvdK0x1tIRDc5QI+R8XlFBm Q4ufMbEnlZAYyaB8cn3lJXJSO7bnWeDCJrOaeUjvrs08+8Q3uPu+AA5NxAxzKhxKsvxh xOyKbjcY5wIZQcoyyiM82+VXpnYn2hKIkK31hO0qXaquRXfup5rLncqHpD4MwOIsVYe+ 889WO9rX+irX2IJE7SkRdr9EuBEo6npsOkkiaEciYYlw2xo27GxcFSu1lmMKq0z6yLEp ADabguKcayOW7zMkCME9L1qir9Xr5ttquT0lF2ow2Lb3PVebYL/qlu2andsds/xfs/rC Ox0A== X-Gm-Message-State: AOJu0YyoB0PpvQ5vg9VFNTXUTMdvsJG9Vf//O1Immpz9bNae9FYAZph+ tT/AtpqfGNiMl9wjKouooQ20E9g2+1L8Ef9/zWBZj0B34ZW9H1qsGDikACn+lpd4Z18d1tUKMzF ctDFY+8OLFUlyNKKLrwwnUAnDVJsiEoOT5xOhpK8tcNXD0jOCfMY= X-Google-Smtp-Source: AGHT+IGIzKbqDvn/nu17TxPJ8S19sI0zeOQ1l7VAvlolfff9bS6TjSc9ms8NNDrCIQwad+nc2NU9dPkK0LgP6+lmsKI= X-Received: by 2002:a2e:3e07:0:b0:2d0:996e:b014 with SMTP id l7-20020a2e3e07000000b002d0996eb014mr1467532lja.32.1706987861229; Sat, 03 Feb 2024 11:17:41 -0800 (PST) MIME-Version: 1.0 From: Kenta USAMI Date: Sun, 4 Feb 2024 04:17:29 +0900 Message-ID: Subject: [PATCH] Fix browse-url-url-at-point so that scheme does not duplicate To: bug-gnu-emacs@gnu.org Content-Type: multipart/mixed; boundary="0000000000001af3e706107f1576" Received-SPF: none client-ip=2a00:1450:4864:20::230; envelope-from=zonuexe@zonu.me; helo=mail-lj1-x230.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000001af3e706107f1576 Content-Type: multipart/alternative; boundary="0000000000001af3e606107f1574" --0000000000001af3e606107f1574 Content-Type: text/plain; charset="UTF-8" Hi, 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://". You can check this by executing M-: (browse-url-url-at-point). Because thing-at-point-bounds-of-url-at-point function cannot correctly recognize URL bounds in the text. I considered changing the thing-at-point-bounds-of-url-at-point algorithm, but it would be a pain to change it without negatively impacting the current behavior. Ideally, thing-at-point-bounds-of-url-at-point will be fixed eventually, but for now, the attached patch should easily fix the problem. --0000000000001af3e606107f1574 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

In the text below, move = point to the second half of the URL and=C2=A0
execute M-x browse-= url-at-point.

```
```

Firefox and Chromium-based browsers appear to open th= e URL "https//www.gnu.org/software/emacs/download.html".
It se= ems that the ":" following https is deleted, but the browser actu= ally normalizes=C2=A0
the URL with the duplicate scheme "htt= p://https://".

You can check this by exec= uting M-: (browse-url-url-at-point).

Beca= use thing-at-point-bounds-of-url-at-point function cannot correctly recogni= ze=C2=A0
URL bounds in the text.

I= considered changing the thing-at-point-bounds-of-url-at-point algorithm, b= ut it would be a pain to change it without negatively impacting the current= behavior.
Ideally, thing-at-point-bounds-of-url-at-point will be fixed = eventually, but for now, the attached patch should easily fix the problem.<= br>
--0000000000001af3e606107f1574-- --0000000000001af3e706107f1576 Content-Type: application/octet-stream; name="0001-Fix-browse-url-url-at-point-so-that-scheme-does-not-.patch" Content-Disposition: attachment; filename="0001-Fix-browse-url-url-at-point-so-that-scheme-does-not-.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_ls6ev8s60 RnJvbSAwOTA4MjMwNWRiZTg3NjIwNjU3Y2Y5ZDZjM2ZlMGMwNThkZWVlODAwIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBVU0FNSSBLZW50YSA8dGFkc2FuQHpvbnUubWU+CkRhdGU6IFN1 biwgNCBGZWIgMjAyNCAwMzoyMDoyNCArMDkwMApTdWJqZWN0OiBbUEFUQ0hdIEZpeCBicm93c2Ut dXJsLXVybC1hdC1wb2ludCBzbyB0aGF0IHNjaGVtZSBkb2VzIG5vdCBkdXBsaWNhdGUKCi0tLQog bGlzcC9uZXQvYnJvd3NlLXVybC5lbCB8IDYgKysrKy0tCiAxIGZpbGUgY2hhbmdlZCwgNCBpbnNl cnRpb25zKCspLCAyIGRlbGV0aW9ucygtKQoKZGlmZiAtLWdpdCBhL2xpc3AvbmV0L2Jyb3dzZS11 cmwuZWwgYi9saXNwL25ldC9icm93c2UtdXJsLmVsCmluZGV4IDM1OTQ1M2NhNDMuLmJjMmE3ZGI5 YTggMTAwNjQ0Ci0tLSBhL2xpc3AvbmV0L2Jyb3dzZS11cmwuZWwKKysrIGIvbGlzcC9uZXQvYnJv d3NlLXVybC5lbApAQCAtNjg4LDggKzY4OCwxMCBAQCBicm93c2UtdXJsLWRlZmF1bHQtc2NoZW1l CiAoZGVmdW4gYnJvd3NlLXVybC11cmwtYXQtcG9pbnQgKCkKICAgKG9yICh0aGluZy1hdC1wb2lu dCAndXJsIHQpCiAgICAgICA7OyBhc3N1bWUgdGhhdCB0aGUgdXNlciBpcyBwb2ludGluZyBhdCBz b21ldGhpbmcgbGlrZSBnbnUub3JnL2dudQotICAgICAgKGxldCAoKGYgKHRoaW5nLWF0LXBvaW50 ICdmaWxlbmFtZSB0KSkpCi0gICAgICAgIChhbmQgZiAoY29uY2F0IGJyb3dzZS11cmwtZGVmYXVs dC1zY2hlbWUgIjovLyIgZikpKSkpCisgICAgICAod2hlbi1sZXQgKChmICh0aGluZy1hdC1wb2lu dCAnZmlsZW5hbWUgdCkpKQorCShpZiAoc3RyaW5nLW1hdGNoLXAgYnJvd3NlLXVybC1idXR0b24t cmVnZXhwIGYpCisJICAgIGYKKwkgIChjb25jYXQgYnJvd3NlLXVybC1kZWZhdWx0LXNjaGVtZSAi Oi8vIiBmKSkpKSkKIAogOzsgSGF2aW5nIHRoaXMgYXMgYSBzZXBhcmF0ZSBmdW5jdGlvbiBjYWxs ZWQgYnkgdGhlIGJyb3dzZXItc3BlY2lmaWMKIDs7IGZ1bmN0aW9ucyBhbGxvd3MgdGhlbSB0byBi ZSBzdGFuZC1hbG9uZSBjb21tYW5kcywgbWFraW5nIGl0IGVhc2llcgotLSAKMi40My4wCgo= --0000000000001af3e706107f1576-- From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 03 14:49:56 2024 Received: (at 68913) by debbugs.gnu.org; 3 Feb 2024 19:49:56 +0000 Received: from localhost ([127.0.0.1]:47120 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWM1U-0004Nw-A3 for submit@debbugs.gnu.org; Sat, 03 Feb 2024 14:49:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWM1S-0004Nl-PF for 68913@debbugs.gnu.org; Sat, 03 Feb 2024 14:49:55 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rWM1B-00072Y-Ea; Sat, 03 Feb 2024 14:49:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=CERCg9I/5b6uJhkrHTOwiyfmoEjzxXKyWuAv2AR5ghk=; b=QClZkTp9FXik ym271kBCXlyexJUqVJyDUy5AERulg1ijM/7jbGqgYdG1AIai0s17y3OgPmwWB2ee3L1EJs2D4jz4A 6rFMZg1hB8wmCLXnkyT1juzKaCi9Zfa86uyJMnwYEkfK70dCi8FgaH5fe65zFGvG7nbBGOAb8V9LS Ouz1vYdyKsOKRfOl+TbI67+SXGlKuSBeHd+wY+ud4Ku1EWJ1jGimPSe3TNPloELjuWYNXAcA5zOAW 2UCJFDiBqiFRkDe3i/NNgU9jfacRfbV/G6rhDgntUhhpC0cgIbfLAqw47fldwCcXUzro5nLibnDm/ kALtZ7h9FkN9qzKwHulkDg==; Date: Sat, 03 Feb 2024 21:49:33 +0200 Message-Id: <86o7cx2ur6.fsf@gnu.org> From: Eli Zaretskii To: Kenta USAMI In-Reply-To: (message from Kenta USAMI on Sun, 4 Feb 2024 04:17:29 +0900) Subject: Re: bug#68913: [PATCH] Fix browse-url-url-at-point so that scheme does not duplicate References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68913 Cc: 68913@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > 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. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 03 15:48:58 2024 Received: (at 68913) by debbugs.gnu.org; 3 Feb 2024 20:48:58 +0000 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 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 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) MIME-Version: 1.0 References: <86o7cx2ur6.fsf@gnu.org> In-Reply-To: <86o7cx2ur6.fsf@gnu.org> From: Kenta USAMI Date: Sun, 4 Feb 2024 05:48:27 +0900 Message-ID: Subject: Re: bug#68913: [PATCH] Fix browse-url-url-at-point so that scheme does not duplicate To: Eli Zaretskii Content-Type: multipart/alternative; boundary="0000000000006041aa0610805a51" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68913 Cc: 68913@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --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-- From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 03 16:00:19 2024 Received: (at 68913) by debbugs.gnu.org; 3 Feb 2024 21:00:19 +0000 Received: from localhost ([127.0.0.1]:47146 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWN7a-00068K-Ou for submit@debbugs.gnu.org; Sat, 03 Feb 2024 16:00:19 -0500 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]:46429) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWN7Z-000686-2S for 68913@debbugs.gnu.org; Sat, 03 Feb 2024 16:00:17 -0500 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2cf2fdd518bso38980311fa.1 for <68913@debbugs.gnu.org>; Sat, 03 Feb 2024 13:00:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zonu-me.20230601.gappssmtp.com; s=20230601; t=1706993999; x=1707598799; 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=S9OC+ItJN8H3DZKBvz1vaSOD1be1aJvsOY2HWD7xj0c=; b=Da+AMSlNIgwh9ykIyHC3DPeAW+0O1Dk1EDFEgO9wo2BN/1ZQGOhoRbB8FTxkl0r0j+ AZ9khCwtHcb/DjvGbAWydiLhHvNiP+otblZIk2bLZCeMKdorVRurUnNVX7Kz+Ic5kx22 yS/beGw195XvSlpCK/xpGrNRbSihYdq8lMYfh3j12hiiGAOtPk8sYxG+65LE64qsCAiM UkhyIM8PVdxiEuClQpP1/1y80GG+tAoX8+I9a8nljQ1q/w4QwGmSZ/py23d0reIJVDG3 ASRrPpJQeUvAh5dc9QKgsjty8DeS83b7wIi1oSZT0w9TPvGZWmy6akMNkPes6D8Epw4+ BMwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706993999; x=1707598799; 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=S9OC+ItJN8H3DZKBvz1vaSOD1be1aJvsOY2HWD7xj0c=; b=N5rs0yn5mZ5uDYlowWKKOdm+2z5PO6nm5jMUyLTmtMQ4V8IpkzUs5zaI54EmOSm0Ei B9/G4nCrZcHK9TI+bYb9F3PcTrEU/ywagqOpiH0MVcss5cHPPOt0gBDUkbIZ4nBoHgns P1p57uBf43tbZIqAwPFn27XLks5vZnDFAcioFDQroS5jnrrEmKWlF8FgjSCATbq2tvsH DT3BQC0Qy1iSZLQzyYnuW+eAlfC3rEV+eDcGraFiXBT5ndrmwrLiUUsNKN/UmFGK/ZfT OWxwVQyAkroq3yhZNwLtaCUlMDhMDdrXdNUa0tp0uz1bxjt8QEtrpJPbp8RdBhXsEdGe Fvxg== X-Gm-Message-State: AOJu0YzE9qbEgU5oOvasg7qKqX3rvmiERYLPfEjgR+w6g9ZUWeNYmib8 ttTxKULJaYdafz/NHvKs9R1dqQxWqgEyftvFqu0VeZ1vMEruPyEffb6Mgx08en9PsZlj8xO1WD+ 9BZOwO18Afty94WnkgnCdGe+sT/2b8EP6cwachRZUgudlaEt+7JBtoQ== X-Google-Smtp-Source: AGHT+IEzUFZ4mnogK3zOkavpCTnouM4qwub3BsxCZO0340zg61loVha6BwQK9IAplYl4/jvEmFqDH6C81pHnDDJaHig= X-Received: by 2002:a05:651c:150d:b0:2d0:69c4:c701 with SMTP id e13-20020a05651c150d00b002d069c4c701mr8186610ljf.31.1706993999412; Sat, 03 Feb 2024 12:59:59 -0800 (PST) MIME-Version: 1.0 References: <86o7cx2ur6.fsf@gnu.org> In-Reply-To: From: Kenta USAMI Date: Sun, 4 Feb 2024 05:59:48 +0900 Message-ID: Subject: Re: bug#68913: [PATCH] Fix browse-url-url-at-point so that scheme does not duplicate To: Eli Zaretskii Content-Type: multipart/mixed; boundary="000000000000f821f50610808245" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68913 Cc: 68913@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000f821f50610808245 Content-Type: multipart/alternative; boundary="000000000000f821f40610808243" --000000000000f821f40610808243 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I forgot that MUA can insert newlines on long lines. Resend the test code to the URL and attachment below. https://gitlab.com/-/snippets/3650077 2024=E5=B9=B42=E6=9C=884=E6=97=A5(=E6=97=A5) 5:48 Kenta USAMI : > 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=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.or= g/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. >> > --000000000000f821f40610808243 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I forgot that MUA can insert newlines on long lines.<= br>
Resend the test code to the URL and attachment below.
https://gitlab.com/-/snippets/36= 50077

2024=E5=B9=B42=E6=9C=884=E6=97=A5(=E6=97=A5) 5:48 Kenta USAMI = <zonuexe@zonu.me>:
I'= ;m using Emacs 29.2 on macOS.
GNU Emacs 29.2 (build 2, aarch64-apple-dar= win23.3.0, NS appkit-2487.40 Version 14.3 (Build 23D56))
=C2=A0of 2024-0= 1-26

This problem is most noticeable 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 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 (= )
=C2=A0 (let* ((text "
[![Emacs](https://www.gnu.org/software/emacs/images/ema= cs.png)](https://www.gnu.org/software/emacs/download.html)
")=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(expected "https://www.gnu.org= /software/emacs/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-poin= t))))
=C2=A0 =C2=A0 (should (string=3D expected actual))))

=
Evaluate the expression directly in the buffer or save it to a file an= d check it with the command below.

$ emacs --b= atch -l foo.el -f ert-run-tests-batch-and-exit

2024=E5=B9=B42=E6=9C=88= 4=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.
--000000000000f821f40610808243-- --000000000000f821f50610808245 Content-Type: application/octet-stream; name="foo.el" Content-Disposition: attachment; filename="foo.el" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_ls6k3o2t0 KHJlcXVpcmUgJ2VydCkKKHJlcXVpcmUgJ2Jyb3dzZS11cmwpCgooZXJ0LWRlZnRlc3QgdGVzdC1i cm93c2UtdXJsLXVybC1hdC1wb2ludCAoKQogIChsZXQqICgodGV4dCAiClshW0VtYWNzXShodHRw czovL3d3dy5nbnUub3JnL3NvZnR3YXJlL2VtYWNzL2ltYWdlcy9lbWFjcy5wbmcpXShodHRwczov L3d3dy5nbnUub3JnL3NvZnR3YXJlL2VtYWNzL2Rvd25sb2FkLmh0bWwpCiIpCiAgICAgICAgIChl eHBlY3RlZCAiaHR0cHM6Ly93d3cuZ251Lm9yZy9zb2Z0d2FyZS9lbWFjcy9kb3dubG9hZC5odG1s IikKICAgICAgICAgKGFjdHVhbCAod2l0aC10ZW1wLWJ1ZmZlcgogICAgICAgICAgICAgICAgICAg KGluc2VydCB0ZXh0KQogICAgICAgICAgICAgICAgICAgKGdvdG8tY2hhciA3NikKICAgICAgICAg ICAgICAgICAgIChicm93c2UtdXJsLXVybC1hdC1wb2ludCkpKSkKICAgIChzaG91bGQgKHN0cmlu Zz0gZXhwZWN0ZWQgYWN0dWFsKSkpKQoK --000000000000f821f50610808245-- From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 08 07:07:28 2024 Received: (at 68913-done) by debbugs.gnu.org; 8 Feb 2024 12:07:28 +0000 Received: from localhost ([127.0.0.1]:59290 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rY3Bg-0002X2-7V for submit@debbugs.gnu.org; Thu, 08 Feb 2024 07:07:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44740) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rY3Be-0002Wo-Oc for 68913-done@debbugs.gnu.org; Thu, 08 Feb 2024 07:07:27 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rY3BK-0003km-Pd; Thu, 08 Feb 2024 07:07:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=vv8jWlY+qFmuPL46pF4kzlYjVrS8VWptY+XBAT2+VZk=; b=i55nQoIwrfng UpeSoMa3l74JNETr73o0UU7LG4QIB3FvFTlGFfmPLjzR3nbRYgX7029bDd2/OPHjLQmF1jyvCoQr/ /LgFS4c1x8U45Vz/x4WhHOXWCJzCOFmm241/yTGYzyptfnlqMWPiis6hs8bG86lI2T8nU0ytawWt1 xQXmn7IuY1nhjHBKGTpQhMBC12kiCoO80UR+nKup0UeGJXASco844OhH77IgtA2jACuntlXa46pIh ujiP/+jbt+qZ90jGastppjKW/Ta6JUPQQFmHN/hkLsuWCh9zNW05DQK4h3DK8eZL8fJ87hBhvROtn aKXvbKrD2OOLnAnRX6csZA==; Date: Thu, 08 Feb 2024 14:07:03 +0200 Message-Id: <86ttmjw460.fsf@gnu.org> From: Eli Zaretskii To: Kenta USAMI In-Reply-To: (message from Kenta USAMI on Sun, 4 Feb 2024 05:48:27 +0900) Subject: Re: bug#68913: [PATCH] Fix browse-url-url-at-point so that scheme does not duplicate References: <86o7cx2ur6.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68913-done Cc: 68913-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Kenta USAMI > Date: Sun, 4 Feb 2024 05:48:27 +0900 > Cc: 68913@debbugs.gnu.org > > 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. Thanks, I installed your patch on the master branch, and I'm closing this bug. From unknown Sun Jun 15 10:50:53 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 07 Mar 2024 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator