bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67600: [PATCH] Add dashes to 'thing-at-point-email-regexp'


From: Visuwesh
Subject: bug#67600: [PATCH] Add dashes to 'thing-at-point-email-regexp'
Date: Tue, 12 Dec 2023 19:55:37 +0530
User-agent: Gnus/5.13 (Gnus v5.13)

[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@host:/what/ever/it/can/be") ;; => 1
>> 
>> the matched string is ssh:userwith@host.  So the old regexp will still
>> return false positives when the point is on userwith@host I think.
>> 
>> With the slashes, the matched string is /ssh:userwith@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@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".





reply via email to

[Prev in Thread] Current Thread [Next in Thread]