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

Previous Next

Package: emacs;

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: philipk <at> posteo.net, 67600 <at> debbugs.gnu.org
Subject: bug#67600: [PATCH] Add dashes to 'thing-at-point-email-regexp'
Date: Tue, 12 Dec 2023 15:35:06 +0200
> From: Visuwesh <visuweshm <at> gmail.com>
> Cc: philipk <at> posteo.net,  67600 <at> debbugs.gnu.org
> Date: Tue, 12 Dec 2023 18:53:25 +0530
> 
> >>     (file-remote-p "/ssh:userwith/@host:/") ;; => nil
> >>     (file-remote-p "/ssh:userwith <at> host/:/") ;; => nil
> >>     (file-remote-p "/ssh:userwith <at> host:/") ;; => /ssh:userwith <at> host:
> >
> > Why are you talking about slashes in user and host names?  There are
> > slashes in remote file names outside of those two.  Are you saying
> > that slashes in thing-at-point-email-regexp will only ever match if
> > they are in the user or host names?  That's not what I see:
> >
> >   (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")
> >       => 0
> 
> 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.




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.