From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#62732: 29.0.60; uniquify-trailing-separator-p affects any buffer whose name matches a dir in CWD Date: Wed, 12 Jul 2023 09:57:02 -0400 Message-ID: References: <87h6tpn8d5.fsf@catern.com> <87edotn7sx.fsf@catern.com> <87edlhm6wq.fsf@catern.com> <87o7kklf9c.fsf@catern.com> <83r0pf9b7d.fsf@gnu.org> <83fs5v8tsw.fsf@gnu.org> <83edlf89qp.fsf@gnu.org> <83v8eq7j3i.fsf@gnu.org> <83pm4y79dw.fsf@gnu.org> <83y1jl5jrq.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="5913"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: sbaugh@catern.com, Stefan Monnier , 62732@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 12 15:58:16 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 1qJaMC-0001KF-6R for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 12 Jul 2023 15:58:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJaM0-0007Sb-SL; Wed, 12 Jul 2023 09:58:04 -0400 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 1qJaLy-0007Rw-Ub for bug-gnu-emacs@gnu.org; Wed, 12 Jul 2023 09:58:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qJaLy-0004Fs-Kj for bug-gnu-emacs@gnu.org; Wed, 12 Jul 2023 09:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qJaLx-0008TI-P8 for bug-gnu-emacs@gnu.org; Wed, 12 Jul 2023 09:58:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 12 Jul 2023 13:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62732 X-GNU-PR-Package: emacs Original-Received: via spool by 62732-submit@debbugs.gnu.org id=B62732.168917023132502 (code B ref 62732); Wed, 12 Jul 2023 13:58:01 +0000 Original-Received: (at 62732) by debbugs.gnu.org; 12 Jul 2023 13:57:11 +0000 Original-Received: from localhost ([127.0.0.1]:52701 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJaL8-0008SA-N1 for submit@debbugs.gnu.org; Wed, 12 Jul 2023 09:57:11 -0400 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:42673) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJaL5-0008Rq-Qf for 62732@debbugs.gnu.org; Wed, 12 Jul 2023 09:57:08 -0400 In-Reply-To: <83y1jl5jrq.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 12 Jul 2023 16:42:01 +0300") 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:264964 Archived-At: Eli Zaretskii writes: >> From: Stefan Monnier >> Cc: Spencer Baugh , sbaugh@catern.com, >> 62732@debbugs.gnu.org >> Date: Wed, 12 Jul 2023 09:04:40 -0400 >> >> I'm not sure what to make of this discussion. >> >> The issue at hand is the following: `create-file-buffer` needs to know >> if the filename it receives is for a directory or not so it can decide >> whether the buffer name should end in / or not according to >> `uniquify-trailing-separator-p`. >> >> I can see 3 ways to provide this info: >> >> 1- use `file-directory-p`. >> 2- add a boolean `directory` argument to `create-file-buffer`. >> 3- use the presence of a trailing directory separator in the filename. >> >> Those 3 are very close to each other, in practice, so we're pretty much >> in bikeshed territory. >> >> My preference is (3) first, (2) second, and (1) last. > > I prefer (1), because it avoids requesting the callers to remember to > ensure that every directory ends in a slash. > > The trailing-slash semantics is indeed pretty much standard, but only > in interactive usage (where it is made easier by the file-name > completion machinery, both in Emacs and in other programs that ask > users to type file names). And even in interactive usage it is > problematic: recall the many complaints when we started requiring the > slash in copy-file and such likes. Here we are talking about a > low-level function, not an interactive command, which then places this > burden on the callers, and I worry that many of them will not pay > attention to this subtlety, and will cause subtle bugs, because AFAIK > the uniquify modes where that is important are rarely used, and thus > such problems could go undetected for many years. Not to prelong the discussion any further, but one more detail: This uniquify-trailing-separator-p variable really IMO should be a dired variable, since it only affects dired buffer naming (at least in core Emacs, for now). This behavior has really nothing to do with uniquify. So IMO it should never have been a uniquify variable in the first place, and in an earlier version of my patch I moved the variable to dired and obsoleted the old one. I dropped that move because it wasn't particularly necessary and could be done in a followup, but of these three options, 2 and 3 work much better with moving this variable to dired, because only 2 and 3 let dired control this without affecting other packages. Option 1 forces the same behavior on every package. I guess we could still have that as a dired variable, but it seems weirder. (As a dired variable, it could control just "does dired pass a directory name or a file name to create-file-buffer?", and create-file-buffer could always include the trailing slash when it sees a directory name)