all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Teika Kazura <teika@gmx.com>
To: 56312@debbugs.gnu.org
Subject: bug#56312: 28.1; URI discrepancy between `thing-at-point' and `org-open-at-point'
Date: Thu, 30 Jun 2022 13:44:13 +0900 (JST)	[thread overview]
Message-ID: <20220630.134413.723335764427197892.teika@gmx.com> (raw)

Hello, Emacs world.

(An error reproduction code soon follows.)
When a cursor is on a url, (thing-at-point 'url) and (org-open-at-point) sometimes return different urls; more precisely, the delimiter sets of two seem to differ.

It's a corner case, and I don't think there exists a "correct" set of delimiters. But IMHO the behavior should be unified, by unifing the code. This makes Emacs' behavior more predictable / customizable, and code maintenance easier.

Since org-mode is now a part of Emacs, it possibly can rely on thing-at-point. (FYI: `browse-url-url-at-point' uses thing-at-point.)

How to reproduce it:
------------------------------------------------------------------------
#!/bin/bash

cat > /tmp/foo.txt << EOF
https://www.amazon.com/("false"-parethesis)Learning-Emacs-Third-Debra-Cameron/dp/0596006489/ref=sr_1_1?keywords=emacs+gnu&sr=8-1
EOF

cat > /tmp/foo.el <<EOF
(find-file "/tmp/foo.txt")
(set-buffer "foo.txt")
(require 'org)
(message "tap returns: *%s*" (thing-at-point 'url))
(org-open-at-point)
EOF

emacs -Q -l /tmp/foo.el

# Caution! rm -f will follow.
# rm -f /tmp/foo.txt /tmp/foo.el
-------------------------------------------------------------------------
In the above example, the url contains a special Japanese parenthesis U+ff08, not an ascii one. thing-at-point cuts before it, but (caution: your browser will be called) org-open-at-point opens the entire line.

As I said above, it's not likely that there is an absolutely "correct" delimiter set. In the above case, the Japanese parenthesis is a part of a valid URL [1]. But it also is a commonly used punctuation mark, so it's rational to treat it as a URL boundary.
(Sorry, I'm completely ignorant about the syntax table.)

[1] The above example is hypothetical, but there does exist such URLs in Japanese Amazon.

Thank you very much indeed for developing Emacs.
Best regards.

Teika

             reply	other threads:[~2022-06-30  4:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30  4:44 Teika Kazura [this message]
2022-06-30 10:25 ` bug#56312: 28.1; URI discrepancy between `thing-at-point' and `org-open-at-point' Lars Ingebrigtsen
2022-06-30 11:51   ` Teika Kazura

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=20220630.134413.723335764427197892.teika@gmx.com \
    --to=teika@gmx.com \
    --cc=56312@debbugs.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.