all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Visuwesh <visuweshm@gmail.com>
Cc: philipk@posteo.net, 67600@debbugs.gnu.org
Subject: bug#67600: [PATCH] Add dashes to 'thing-at-point-email-regexp'
Date: Tue, 12 Dec 2023 15:35:06 +0200	[thread overview]
Message-ID: <83r0jrtugl.fsf@gnu.org> (raw)
In-Reply-To: <87a5qftv02.fsf@gmail.com> (message from Visuwesh on Tue, 12 Dec 2023 18:53:25 +0530)

> From: Visuwesh <visuweshm@gmail.com>
> Cc: philipk@posteo.net,  67600@debbugs.gnu.org
> Date: Tue, 12 Dec 2023 18:53:25 +0530
> 
> >>     (file-remote-p "/ssh:userwith/@host:/") ;; => nil
> >>     (file-remote-p "/ssh:userwith@host/:/") ;; => nil
> >>     (file-remote-p "/ssh:userwith@host:/") ;; => /ssh:userwith@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@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@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.





  reply	other threads:[~2023-12-12 13:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-03 12:52 bug#67600: [PATCH] Add dashes to 'thing-at-point-email-regexp' Philip Kaludercic
2023-12-03 13:14 ` Eli Zaretskii
2023-12-12  7:21   ` Philip Kaludercic
2023-12-12 12:06     ` Eli Zaretskii
2023-12-12 12:21       ` Visuwesh
2023-12-12 12:27         ` Eli Zaretskii
2023-12-12 12:41           ` Visuwesh
2023-12-12 13:08             ` Eli Zaretskii
2023-12-12 13:23               ` Visuwesh
2023-12-12 13:35                 ` Eli Zaretskii [this message]
2023-12-12 14:25                   ` Visuwesh
2023-12-16 10:41       ` Philip Kaludercic
2023-12-16 13:38         ` Eli Zaretskii
2023-12-16 14:50           ` Philip Kaludercic
2023-12-16 14:59             ` Eli Zaretskii
2023-12-17 12:11               ` Philip Kaludercic

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=83r0jrtugl.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=67600@debbugs.gnu.org \
    --cc=philipk@posteo.net \
    --cc=visuweshm@gmail.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.