GNU bug report logs -
#67600
[PATCH] Add dashes to 'thing-at-point-email-regexp'
Previous Next
Reported by: Philip Kaludercic <philipk <at> posteo.net>
Date: Sun, 3 Dec 2023 12:53:02 UTC
Severity: normal
Tags: patch
Done: Philip Kaludercic <philipk <at> posteo.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Tuesday December 12, 2023] Eli Zaretskii wrote:
>> I see what you mean now. But the problem is that even without the
>> slashes in the regexp, the filename you gave matches:
>>
>> (string-match "<?[-+_~a-zA-Z0-9][-+_.~:a-zA-Z0-9]*@[-a-zA-Z0-9]+[-.a-zA-Z0-9]*>?"
>> "/ssh:userwith <at> host:/what/ever/it/can/be") ;; => 1
>>
>> the matched string is ssh:userwith <at> host. So the old regexp will still
>> return false positives when the point is on userwith <at> host I think.
>>
>> With the slashes, the matched string is /ssh:userwith <at> host. If we drop
>> the slash from the first character class i.e.,
>>
>> (string-match "<?[-+_~a-zA-Z0-9][-+_.~:a-zA-Z0-9/]*@[-a-zA-Z0-9]+[-.a-zA-Z0-9]*>?"
>> "/ssh:userwith <at> host:/what/ever/it/can/be") ;; => 1
>
> Yes, but now it matches without the leading slash, i.e. not entirely.
> But see bug#67688. My bother is that this change could perhaps
> increase the probability of such mis-guesses. Not sure it matters,
> I'm just asking.
Thanks for the pointer but changing the email address regexp will have
no effect on the return value of (thing-at-point 'filename), and this is
what ffap does (along with other heuristics), and others will do when
they want to get the filename at point.
But IME, the filename thing-at-point matches are really limited compared
to the additional heuristics that ffap employs to match filename but
they still aren't perfect: filenames with spaces in them are only picked
up by ffap only when the point is over the "first word".
This bug report was last modified 1 year and 157 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.