From: Robert Pluim <rpluim@gmail.com>
To: Aaron Madlon-Kay <aaron@madlon-kay.com>
Cc: 61519@debbugs.gnu.org
Subject: bug#61519: 30.0.50; thing-at-point misdetects emails with numerals in user part
Date: Wed, 15 Feb 2023 12:15:48 +0100 [thread overview]
Message-ID: <87a61fp4bf.fsf@gmail.com> (raw)
In-Reply-To: <AC3F2646-E8F7-4904-8EB7-0B5DFD95CDDB@madlon-kay.com> (Aaron Madlon-Kay's message of "Wed, 15 Feb 2023 08:04:26 +0900")
>>>>> On Wed, 15 Feb 2023 08:04:26 +0900, Aaron Madlon-Kay <aaron@madlon-kay.com> said:
Aaron> 1. Launch Emacs with `emacs -Q`
Aaron> 2. Enter an email address with a numeral in the user part, like
Aaron> foo0bar@example.com
Aaron> 3. With point inside the domain part of the email address, evaluate
Aaron> `(thing-at-point 'email)`
Aaron> 4. Result will be `bar@example.com` (expected `foo0bar@example.com`)
Aaron> The cause of this is the implementation of `thing-at-point-looking-at'
Aaron> where it backs up one character at a time to find the start of the
Aaron> email. The value for `thing-at-point-email-regexp' allows numbers in
Aaron> the user part only from the *second* character, so as the function
Aaron> backs up it will mistakenly find the `0` in `0bar@example.com` to be
Aaron> outside of the email address.
That regexp has a few other issues, but breaking out the full rfc 822
parser for this would be overkill. Could you try the following patch?
Robert
--
diff --git i/lisp/thingatpt.el w/lisp/thingatpt.el
index 9363a474cb5..f3367290dee 100644
--- i/lisp/thingatpt.el
+++ w/lisp/thingatpt.el
@@ -645,7 +645,7 @@ thing-at-point-looking-at
;; Email addresses
(defvar thing-at-point-email-regexp
- "<?[-+_.~a-zA-Z][-+_.~:a-zA-Z0-9]*@[-.a-zA-Z0-9]+>?"
+ "<?[-+_~a-zA-Z0-9][-+_.~:a-zA-Z0-9]*@[-a-zA-Z0-9]+[-.a-zA-Z0-9]*>?"
"A regular expression probably matching an email address.
This does not match the real name portion, only the address, optionally
with angle brackets.")
next prev parent reply other threads:[~2023-02-15 11:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-14 23:04 bug#61519: 30.0.50; thing-at-point misdetects emails with numerals in user part Aaron Madlon-Kay
2023-02-15 11:15 ` Robert Pluim [this message]
2023-02-23 14:40 ` Robert Pluim
2023-03-10 15:35 ` Robert Pluim
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=87a61fp4bf.fsf@gmail.com \
--to=rpluim@gmail.com \
--cc=61519@debbugs.gnu.org \
--cc=aaron@madlon-kay.com \
/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.