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 04:17:29 +0900 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0000000000001af3e706107f1576" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29012"; mail-complaints-to="usenet@ciao.gmane.io" To: 68913@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 03 20:19:23 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 1rWLXu-0007JA-P3 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Feb 2024 20:19:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rWLXV-0008VP-Pa; Sat, 03 Feb 2024 14:18:57 -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 1rWLXP-0008VH-Ix for bug-gnu-emacs@gnu.org; Sat, 03 Feb 2024 14:18:52 -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 1rWLXP-0001M5-BH for bug-gnu-emacs@gnu.org; Sat, 03 Feb 2024 14:18:51 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rWLXa-0003ZB-Gi for bug-gnu-emacs@gnu.org; Sat, 03 Feb 2024 14:19: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 19:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 68913 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.170698788713635 (code B ref -1); Sat, 03 Feb 2024 19:19:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Feb 2024 19:18:07 +0000 Original-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 Original-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 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 1rWLWM-0008Qc-M0 for bug-gnu-emacs@gnu.org; Sat, 03 Feb 2024 14:17:46 -0500 Original-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 Original-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) 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-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:279378 Archived-At: --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 MDA6MDA6MDAgMjAwMQpGcm9tOiBVU0FNSSBLZW50YSA8dGFk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