From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Newsgroups: gmane.emacs.bugs Subject: bug#35564: [PATCH v2] Tweak dired warning about "wildcard" characters Date: Thu, 13 Jun 2019 08:19:33 +0200 Message-ID: <87tvcum2h6.fsf@gmail.com> References: <87zho2cd4f.fsf@gmail.com> <87wohvf22u.fsf@gmail.com> <87muinyoup.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="98486"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 35564@debbugs.gnu.org, Stefan Monnier To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 13 08:23:09 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hbJ8e-000PTj-F6 for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Jun 2019 08:23:08 +0200 Original-Received: from localhost ([::1]:37182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbJ8b-00081g-QP for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Jun 2019 02:23:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35469) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbJ5f-0005O2-7J for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2019 02:20:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbJ5e-0005FU-6m for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2019 02:20:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49082) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hbJ5e-0005F8-0E for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2019 02:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hbJ5d-00034a-PS for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2019 02:20:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jun 2019 06:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35564 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 35564-submit@debbugs.gnu.org id=B35564.156040678511776 (code B ref 35564); Thu, 13 Jun 2019 06:20:01 +0000 Original-Received: (at 35564) by debbugs.gnu.org; 13 Jun 2019 06:19:45 +0000 Original-Received: from localhost ([127.0.0.1]:34393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hbJ5N-00033s-2A for submit@debbugs.gnu.org; Thu, 13 Jun 2019 02:19:45 -0400 Original-Received: from mail-wm1-f45.google.com ([209.85.128.45]:38843) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hbJ5K-00033Z-VE for 35564@debbugs.gnu.org; Thu, 13 Jun 2019 02:19:43 -0400 Original-Received: by mail-wm1-f45.google.com with SMTP id s15so8769183wmj.3 for <35564@debbugs.gnu.org>; Wed, 12 Jun 2019 23:19:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=zsvdYWX22aonVYDP5Kud9jJV2HTd1eM5798IUxtqloY=; b=HIJ5+jG/JnzLmi3yMsX/S2YQRSwy8pbjRI+6vmAhskYnwYLxBpnaZU171p1lx1PkTn DHVRzWy91n9wtd5IE68hQyycrJSWWBLCxAQHULlp+FvaX57HuF7x1IcXnZz25RQRfgSl ccSDbzuFVWIM/gn1gBW3MVarj2BcFiVujq1+MWZwmB8rrsvyJgJC1jPb9TvsJ+DFUYQh KHi8Ky3khvsbpSyqUCVooFy9I4tuwizTnFZVVPfSB+TZ+bmmfQJYJ7IJvWPBrSSOH4xV E0dIlOSrB3+LGDVqlrF6XmPX6LEwLpRS+hCKMffYmULlzd30lmjypgtt1bW4QtzNnUpW 6FMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=zsvdYWX22aonVYDP5Kud9jJV2HTd1eM5798IUxtqloY=; b=KsqUWbNe7VPNZiTfkJH5ux+tSny6kIpOzml2jucovxjzYmwpDVKlez0nO9Wh89lSJH FQIPfQO9lxky/a0YWx5NdkeBgNbTIKRWISLCRHjjDpqiaubtI9QenzT07snvS41Yn/kd 2XGK5Y1CZqqeJP0ukRCBkJKGCVqMaSGk9rk9VoXG/oLMEkxsQcrbOVdzmYNqo6U1zDAS kICPvxMR0NgwXURO9+A5hmi7cQK45fWpNzyhp/EUfxwxIN0Xrxp9v3izEK/EvPEzTHlB FBicLR9jpBrKFgA7pHfpL3dxeaDXHrh+rO8DritVY9x6ryAZ8bkKmC2ifxIeozhxOEjM ZgEQ== X-Gm-Message-State: APjAAAW2OM90YPtsmsuulYLKbHUYEFg9SFT1Thn7ubYdR6+yIt4Vn7uI p6POp1RKfN3HBvFQ0FKIDxo= X-Google-Smtp-Source: APXvYqxZwQeW7C+qfo+ZN9j5bAIK60hfciZsExRfa3l2T9yfYDaiEB/8zU7u0ySkDSJxT0pBflla8A== X-Received: by 2002:a1c:6242:: with SMTP id w63mr2225489wmb.161.1560406776977; Wed, 12 Jun 2019 23:19:36 -0700 (PDT) Original-Received: from my-little-tumbleweed (71.142.13.109.rev.sfr.net. [109.13.142.71]) by smtp.gmail.com with ESMTPSA id r2sm1786231wma.26.2019.06.12.23.19.35 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 12 Jun 2019 23:19:36 -0700 (PDT) In-Reply-To: <87muinyoup.fsf@gmail.com> (Noam Postavsky's message of "Wed, 12 Jun 2019 08:23:10 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:160477 Archived-At: Noam Postavsky writes: > I think this might be better expressed in regexp: I guess it is; I just tend to get superstitious about messing with match data. > Although this gives different results for things like: > > (dired--isolated-char-p "?`foo`" 0) > > Do we care about that? (if yes, then that's a missing test case) I think we do care; if I look at what the existing code says, (dired--star-or-qmark-p "?`foo`" "?") ;; =3D> nil Off the top of my head, this is the best I can come up with to satisfy this edge case: (defun dired--isolated-char-p (command pos) "Assert whether the character at POS is isolated within COMMAND. A character is isolated if: - it is surrounded by whitespace, the start of the command, or the end of the command, - it is surrounded by `\\=3D`' characters." (let ((start (max 0 (1- pos))) (char (string (aref command pos)))) (and (or (string-match (rx-to-string '(seq (or bos blank) (group char) (or eos blank))) command start) (string-match (rx-to-string '(seq ?` (group char) ?`)) command start)) (=3D pos (match-beginning 1))))) > And perhaps the regexp above (if it's correct) can be integrated into > this search? (maybe not though, since negation isn't straightforward in > regexps) I will look into that. Stefan Monnier writes: > Can't we use `(... ,.. ..) instead of `eval`? > > > Stefan That works too from what I tested, although it's not necessary anymore with the new version above. Thank you both for the review! I will come back with an updated patch (with the new test case) Some Time Later=E2=84=A2.