From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" 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:04:40 -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> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6865"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Spencer Baugh , 62732@debbugs.gnu.org, sbaugh@catern.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 12 15:05:24 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 1qJZX2-0001Uy-3o for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 12 Jul 2023 15:05:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJZWk-0001cL-Kr; Wed, 12 Jul 2023 09:05:06 -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 1qJZWh-0001Yv-2j for bug-gnu-emacs@gnu.org; Wed, 12 Jul 2023 09:05: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 1qJZWg-0001QM-Q0 for bug-gnu-emacs@gnu.org; Wed, 12 Jul 2023 09:05:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qJZWf-0006uk-QV for bug-gnu-emacs@gnu.org; Wed, 12 Jul 2023 09:05:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 12 Jul 2023 13:05: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.168916709926567 (code B ref 62732); Wed, 12 Jul 2023 13:05:01 +0000 Original-Received: (at 62732) by debbugs.gnu.org; 12 Jul 2023 13:04:59 +0000 Original-Received: from localhost ([127.0.0.1]:51900 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJZWa-0006uJ-53 for submit@debbugs.gnu.org; Wed, 12 Jul 2023 09:04:59 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:64048) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJZWX-0006u6-Vg for 62732@debbugs.gnu.org; Wed, 12 Jul 2023 09:04:54 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 664421000C4; Wed, 12 Jul 2023 09:04:48 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 48E6710008C; Wed, 12 Jul 2023 09:04:47 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1689167087; bh=IKiclIWtN6rLYr5x8YQ5YzmbsHMAWcIgI6DjxavSbUI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=A5hMJa9Yp+/BVG4OvZ4FJL9X9GVcFw6e8pjB72clhJukuaHGsoQccI9EB2q+fVYU3 tygZ7DJ8T9a/C5AqyK53cPgIBpk2C8S6MrqNjljFNCmFzveiPX/GJYpRXIn+N04JSA Vi/tP8xsM03uEvF3Um5oUhmC5E7R06+5mNnmBQ7PA3cwMTWLpEjFJogqR6Z8MYLS0V mNlQdOu+2C/eTvAfljfwgLwYubHBzBFk/8ItGXl2qF7Fk30Hlqhs0Uemhk+Ee9l9S6 4IBQ4PsktCOZZK6p64mpK6ZjZ3vNTaSEMiqy4syJHSgWZgQD+DUR/5040+oDLwhFVC t6AX0X3K6mWiQ== Original-Received: from pastel (69-165-150-192.dsl.teksavvy.com [69.165.150.192]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 94D9E1202C3; Wed, 12 Jul 2023 09:04:46 -0400 (EDT) In-Reply-To: <83pm4y79dw.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 11 Jul 2023 18:31:07 +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:264961 Archived-At: 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. (1) is my least favorite because it makes it impossible/difficult to create a "directory buffer" if `file-directory-p` returns nil and vice versa, even tho I can imagine scenarios where this could be useful (such as the scenario mentioned by Spencer where we want to create a "directory buffer" for an archive that Emacs's file-name-handlers don't understand). (3) is my favorite because it doesn't need an extra argument and instead uses an existing piece of information: if I pass "/a/b/c/" then it seems clear that I mean this to be a "directory buffer" rather than a "file buffer". Representing the information "this is meant to be a directory" in the file name via a trailing / is a standard practice in ELisp (and POSIX in general), embodied by things like `file-name-as-directory` and `directory-file-name`, so it seems only natural (or even a mere a bug fix) to let `create-file-buffer` make use of that info instead of throwing it away. But I prefer any one of those 3 choices over the status quo, so I'll stop arguing here. Just let me know which one I should install. Stefan Eli Zaretskii [2023-07-11 18:31:07] wrote: >> From: Spencer Baugh >> Cc: Stefan Monnier , sbaugh@catern.com, >> 62732@debbugs.gnu.org >> Date: Tue, 11 Jul 2023 08:31:51 -0400 >> >> Eli Zaretskii writes: >> > My comments assumed that indeed we will (almost) always want to tell >> > create-file-buffer this is a directory. >> >> One contribution, not intended to be exhaustive of all use cases, and >> not intended to be definitively a good idea: a user could want opened >> tar files with their file listing view to have a trailing slash, even >> though they aren't actually directories. > > But users don't call create-file-buffer, do they? So this is not > user-level option, at least not directly so. > >> And with my approach that is possibly just by running >> file-name-as-directory over the name before passing it to >> create-file-buffer. > > If you worry about users, they can be told to append a slash by hand, > when they mean a directory and that directory does not yet exist. We > do this elsewhere in Emacs.