From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix. Date: Sun, 25 Jul 2021 07:19:12 +0200 Message-ID: <87wnpfynqn.fsf@gnus.org> References: <20210724171858.1726.43078@vcs0.savannah.gnu.org> <20210724171900.4A26D20D0A@vcs0.savannah.gnu.org> <87h7gjo8sh.fsf@gmx.de> <871r7n1r6a.fsf@gnus.org> <87zgubmt3z.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36372"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jul 25 07:20:22 2021 Return-path: Envelope-to: ged-emacs-devel@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 1m7WYo-0009JA-Bs for ged-emacs-devel@m.gmane-mx.org; Sun, 25 Jul 2021 07:20:22 +0200 Original-Received: from localhost ([::1]:60736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7WYn-0007Gi-0N for ged-emacs-devel@m.gmane-mx.org; Sun, 25 Jul 2021 01:20:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7WXp-0006an-S0 for emacs-devel@gnu.org; Sun, 25 Jul 2021 01:19:21 -0400 Original-Received: from quimby.gnus.org ([2a01:4f9:2b:f0f::2]:58626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7WXn-0001KL-Dz; Sun, 25 Jul 2021 01:19:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=KtfgP5MQosb8sVr1hO6x87qp2bDdgypaJMHbpJfnxPc=; b=ma83H46Bns0CzcDNg5H0P2u0cY w7yfGjg+5PwcZl17+vqB3zIIfkw17p90pqPs2hJnyBuQs2PJKeMC1C1QotPlPPvZay1/a3wNz96yk hOaalkdxUulwdQZ8R4GFvASJH2ODg1qcxNKKGJPwmB0CrBy7Kw4off2hE6+XmjdxU85g=; Original-Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m7WXg-0005Qc-UZ; Sun, 25 Jul 2021 07:19:15 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAD1BMVEVOMzaMdFkeFhSe x+f///8MknxzAAAAAWJLR0QEj2jZUQAAAAd0SU1FB+UHGQUMAyYbOMkAAAGfSURBVDjLdZOLccQw CEQFaUCcG8CkgWjUf29hV8inm0xIzh89ASvArX2Y0TqfXfUkHRREwxtvG+2HAk3rl9YL1Ktzj6s/ wNvjHAnC1xKvTq9Iy9W08oi2HjOHwkcfkH+UFWAIUIEVAF5xw8d9Z8wVgCZQprrjcpGhpKdQ1UrO GxKF4DBL7gHSROEaXkfLlTw8xXtfh3oxVmxzYwWtu20PWhN73eaaWBQVe4NmYiHwe60jMEGoSPYn sn+yy7Wq3BbIiymL59VnWx3FfTVI/Zq0noKujlEQvLZxzwK5eQp85wLbI6PIyP1Wr1PliZT7+1cF aCOLNOewLCHzP0ADSSAfYQ5Ah2mjxH6AzG7pM6j1AFCVUsbkOd8AcgfEL4/r7eGSYNo1BILnGwSS wonSThBBgGo2Srs2cIMq1KmvHqRQgruz6jh7f2afzVMcL/+7vk4QFtWjYO9iAzM+dmk1YTWJ37Pn IOVQuGFu9tSEf/0od7b6fmoukQFDu6aP800v5HBuvq1HrA+yPHDNLykrxhWNE1CbxWEn0L8g1ofz D/i0X9tSYET9NyIbAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIxLTA3LTI1VDA1OjEyOjAzKzAwOjAw FlNi2wAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMS0wNy0yNVQwNToxMjowMyswMDowMGcO2mcAAAAA SUVORK5CYII= X-Now-Playing: Pigface's _Fook_: "Auto Hag" In-Reply-To: <87zgubmt3z.fsf@gmx.de> (Michael Albinus's message of "Sat, 24 Jul 2021 21:04:00 +0200") Received-SPF: pass client-ip=2a01:4f9:2b:f0f::2; envelope-from=larsi@gnus.org; helo=quimby.gnus.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:271581 Archived-At: Michael Albinus writes: > It's rather a nice to have. Sometimes, I have a list of file name > fragments, and I hope to avoid the checks for being non-empty strings > ... > > But I can do this in my code. Thinking about it a bit more, I can see use cases where ignoring nil/"" would be useful (without making the function less difficult to reason about). (And it's analogous to `concat', besides.) So I think I'll go ahead and make that change... >>> Furthermore, we have >>> >>> (directory-append "foo/" "/bar") => "foo//bar" >>> >>> I would expect "foo/bar", meaning that all leading slashes in COMPONENTS >>> are removed. >> >> Well, I think that's over into DWIM-land again (which is what >> expand-file-name does, and this function deliberately doesn't do). > > expand-file-name and file-name-as-directory are functions which call a > handler, for example Tramp. directory-append is much cheaper, and if it > could do this string handling, I could avoid those functions. It would > be more performant. The reason `directory-append' is useful as a function at all (instead of just using `concat') is that we're very vague about the difference between a directory name and a file name in Emacs. That is, we treat "/tmp/" and "/tmp" as equivalent in more than 99% of cases when dealing with directories. This has naturally led to people setting `foo-directory' variables etc to something ending with a slash or not arbitrarily, which again means that you can't just use `concat' to construct file names. But "/bar.txt" does not happen naturally as a leaf file name, so I think it'd be counter-productive to have `directory-append' do anything particular about the start of file name components. By the way -- I'm not sure that `directory-append' is the best function name here... `file-name-concat' would perhaps be more natural? But it's really about directories... `directory-name-concat'? Hm. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no