From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#67600: [PATCH] Add dashes to 'thing-at-point-email-regexp' Date: Tue, 12 Dec 2023 18:53:25 +0530 Message-ID: <87a5qftv02.fsf@gmail.com> References: <87v89fh2iz.fsf@posteo.net> <83plzn77i2.fsf@gnu.org> <87wmtjnaxd.fsf@posteo.net> <831qbrvd5g.fsf@gnu.org> <87il53txv7.fsf@gmail.com> <83y1dztxlq.fsf@gnu.org> <87edfrtwxg.fsf@gmail.com> <83ttontvom.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13561"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: philipk@posteo.net, 67600@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 12 14:24:11 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rD2k6-0003GU-4B for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Dec 2023 14:24:10 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rD2jk-0002jV-Qj; Tue, 12 Dec 2023 08:23:48 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rD2jj-0002j7-75 for bug-gnu-emacs@gnu.org; Tue, 12 Dec 2023 08:23:47 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rD2ji-00034E-Ui for bug-gnu-emacs@gnu.org; Tue, 12 Dec 2023 08:23:46 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rD2jy-0004Zc-2F for bug-gnu-emacs@gnu.org; Tue, 12 Dec 2023 08:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Dec 2023 13:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67600 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 67600-submit@debbugs.gnu.org id=B67600.170238743217566 (code B ref 67600); Tue, 12 Dec 2023 13:24:02 +0000 Original-Received: (at 67600) by debbugs.gnu.org; 12 Dec 2023 13:23:52 +0000 Original-Received: from localhost ([127.0.0.1]:55540 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rD2jo-0004ZE-BQ for submit@debbugs.gnu.org; Tue, 12 Dec 2023 08:23:52 -0500 Original-Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:51279) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rD2jl-0004Yx-HA for 67600@debbugs.gnu.org; Tue, 12 Dec 2023 08:23:50 -0500 Original-Received: by mail-pg1-x541.google.com with SMTP id 41be03b00d2f7-5c1a75a4b6cso2763069a12.2 for <67600@debbugs.gnu.org>; Tue, 12 Dec 2023 05:23:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702387408; x=1702992208; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=y9j8Cv0uCI8hfB6vxxO88LjNk3P2fdb4V7dCnejKEYg=; b=U+agcuDDscWlCXKa6ICMYpcUpiot5tkwLaU4pgQhnEclSrz6oKkas4K1ZV20d6B0uT pTafxmZ15LdLeWDwCIl+lXtHdn+5jREfKZ2bWDQCjlEAks5ZgSAANa8seqsIT4fEChOu fpqQXi3Q56su/aMXTBf9hdAvxaod14aPL+G/9X1jy2jy4o4IlsNPybVpEYL3y8vt3mJZ oWEf8urRzPw0yX+g0WsnzGjGQJdNzVglaEKkvdnBmr9Zhyw8z/lg+5xS8WwIYWeH8rGm Ezwie2ypUGak+m9WdDNjVdRsx1/Y2eYBDe4YdYMkzCsG4FNX+SrAGZDAQlamwPSR65/V 1JZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702387408; x=1702992208; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=y9j8Cv0uCI8hfB6vxxO88LjNk3P2fdb4V7dCnejKEYg=; b=KagnSH0Y5NyAor09uTKRNLG46btQOkxlsYFnXvSlZ+uS17OBEvWk0raRj9QZoDHMgJ zJCRJZeTmZ3E6MkpUyHOpqOI1hMHCyDueljH81qTbeTvrdRheTM0gme41CQbNtMRoU06 Lxf8kFTXtqs0EBx2ouzxmuM2mkAAGVCptmHrfv3o2wSOAWkh4kAsa09XHC3Pfyepi9Li aZS3iWEIXCD7vt1pO32FJ3sJx6L8Ul45coxaCdvqo8BZYSEBLCHuJA0elLgFubQKd3Lc aCfFVhm3MDUieZOvvuvZ0TPnbAUAIXL0NjpCh7g9MpHUlP1iSlrqPpjgtAe6vDTlr12P HzSQ== X-Gm-Message-State: AOJu0YxRKkxvWfu7p3uMlCOVefmWQdqhdcJf3JEXSA1gAvcEddxlkzoV 9FSWeUe2gkxvV/qrHoU5ulo= X-Google-Smtp-Source: AGHT+IFTSlV4W82VnKSOL3nlbpbUOzE5V7QT3tXnZUQdAMGa2jnUJmzGgdV7wsqBJmfN3cXDcXQOWw== X-Received: by 2002:a05:6a21:609:b0:18c:3260:e223 with SMTP id ll9-20020a056a21060900b0018c3260e223mr2625934pzb.18.1702387408058; Tue, 12 Dec 2023 05:23:28 -0800 (PST) Original-Received: from localhost ([49.204.128.180]) by smtp.gmail.com with ESMTPSA id u23-20020a62d457000000b006ce781f6f85sm8431174pfl.43.2023.12.12.05.23.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 05:23:27 -0800 (PST) In-Reply-To: <83ttontvom.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 12 Dec 2023 15:08:41 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:276039 Archived-At: [Tuesday December 12, 2023] Eli Zaretskii wrote: >> From: Visuwesh >> Cc: philipk@posteo.net, 67600@debbugs.gnu.org >> Date: Tue, 12 Dec 2023 18:11:47 +0530 >> >> [Tuesday December 12, 2023] Eli Zaretskii wrote: >> >> >> I am running Emacs with the same change before Philip created this bug >> >> report and so far I haven't had false positives for email addresses >> >> because files with a @ in its name is rare. In practise, I think this >> >> patch is harmless in that regard. >> > >> > Remote files that have user@host in their names do have that >> > character. >> >> AFAIU, user cannot have slashes in them as per the POSIX standards [1] >> and likewise with hostname so remote files should not pose a problem. >> Of course this assumes that you're only looking at methods like ssh, >> doas, sudo, etc. It seems like tramp disallows slashes in user and host >> anyway, try: >> >> (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 "?" > "/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 "?" "/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 "?" "/ssh:userwith@host:/what/ever/it/can/be") ;; => 1 then the matched string is again ssh:userwith@host. And this regexp still matches the sr.ht list email addresses (this is the regexp I use in my Emacs checkout).