From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Colin Woodbury" Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] lisp/files.el: Add `file-name-set-extension` Date: Wed, 09 Jun 2021 19:45:07 -0700 Message-ID: <8d754566-279f-46e4-9489-d29356a1189b@www.fastmail.com> References: <6ff4b7d7-03ac-48d1-8d49-de66431d4e5b@www.fastmail.com> <87lf82y9pv.fsf@tcd.ie> <3780a7f9-19f4-4216-baa9-ce00b3dbace9@www.fastmail.com> <6ba4668c-9b39-40e0-a155-f7e583fd33b6@www.fastmail.com> <87czteeyoc.fsf@igel.home> <9a92de1b-e313-468d-aa1f-7f969ed73688@www.fastmail.com> <87h7ipcs3j.fsf@igel.home> <392FB601-CF1D-482F-B373-B443C4131412@gmail.com> <26B660D9-AC76-4AFC-9FFD-2F5D4DCA16C1@acm.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=3229a06ba1a043f3bd87c9929bb695e6 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14804"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.5.0-alpha0-519-g27a961944e-fm-20210531.001-g27a96194 Cc: =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= , Philipp , emacs-devel@gnu.org To: "Stefan Monnier" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jun 10 04:46:13 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 1lrAhv-0003ar-B3 for ged-emacs-devel@m.gmane-mx.org; Thu, 10 Jun 2021 04:46:11 +0200 Original-Received: from localhost ([::1]:37590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrAht-00029C-9x for ged-emacs-devel@m.gmane-mx.org; Wed, 09 Jun 2021 22:46:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrAhI-0001PT-HQ for emacs-devel@gnu.org; Wed, 09 Jun 2021 22:45:32 -0400 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]:40259) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrAhG-0007UB-8c for emacs-devel@gnu.org; Wed, 09 Jun 2021 22:45:32 -0400 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 4ACD25C00A7; Wed, 9 Jun 2021 22:45:28 -0400 (EDT) Original-Received: from imap1 ([10.202.2.51]) by compute1.internal (MEProxy); Wed, 09 Jun 2021 22:45:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fosskers.ca; h= mime-version:message-id:in-reply-to:references:date:from:to:cc :subject:content-type; s=fm1; bh=ClBjlm1NAlaI5vMB4/hk0BFnCJQNlFS joghOoahVbr4=; b=sOlkyQ+jW5ElzV32v9k0KOPwsc0aSFQYRDYZBkhzlH3ccpk f8N/+ncgmb/ltYxp8r2uBhE6/OOraVn+lp9HlthCpe5TJ/skV/EQj1v+GB/hcyg7 M/KPOVsO5bxnX+T7ltF03kJvkYp3h5I+59FGvL8Rkg2ugq/Q8CZNWEIkUrfcYcO2 RvpFGGujM0Cm+QlBJXBmZw3OJJj6YTiHzCtiP1JhisamYVxJZmDY249t+hC7URBc t7gbjb9/rbaj+yMu9NUy9HiCsCG+NhFsglQPjgnYOlycSbIegblvFsVQ6IqVkD9i MGmZZotVPTZ2cnNEcqth44mrgj/i+UjriCMvyqw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=ClBjlm 1NAlaI5vMB4/hk0BFnCJQNlFSjoghOoahVbr4=; b=ainj4g/iBM8wLaF1Hfchbo j5w+Q97OD8ZBIiQDaEowTHWqSKgPcViNjXwiaU8InZyr0ihQoe0q3XsThQVBpWj5 Qq4cSSo9kKNqVX49dZ9xTYNWv0uAW63OKch9Ciupo9tl35ASoXSZk6VYSvI+wDiA uVq30fnt1iFz0at5wSUoKHwAyQ7cfkKcPiUCGui7+9eDRHLFCkIzqcVt/ibPZJXe RYJr61qP5jkRN7wJV2xByW60uIYRSrKjizpGAA71R50abaTwedrTDGzz+fhLdis6 G6yEr9lPhZ7GhgH9dYWbXv2iu8fBbLX4u3EMk32cu4BpsHzG2Liyi4wYzJ0AodVw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeduvddgieduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesmhdtreerreertdenucfhrhhomhepfdevohhl ihhnucghohhouggsuhhrhidfuceotgholhhinhesfhhoshhskhgvrhhsrdgtrgeqnecugg ftrfgrthhtvghrnhepffffgfehgeefgeevvddtgeeuuefhudefteegtdehkeegvdeifeev vdefgeeileejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homheptgholhhinhesfhhoshhskhgvrhhsrdgtrg X-ME-Proxy: Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id BF9F51300087; Wed, 9 Jun 2021 22:45:27 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: Received-SPF: none client-ip=66.111.4.27; envelope-from=colin@fosskers.ca; helo=out3-smtp.messagingengine.com 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=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:270625 Archived-At: --3229a06ba1a043f3bd87c9929bb695e6 Content-Type: multipart/alternative; boundary=343f98f81265491090666d17eff75312 --343f98f81265491090666d17eff75312 Content-Type: text/plain And while I'm at, I've tweaked one line to use `aref` to access the final character of the filename directly, which avoids a (albeit minor) string allocation. On Wed, 9 Jun 2021, at 17:42, Colin Woodbury wrote: > So be it! I've updated the patch. > > Colin > > On Wed, 9 Jun 2021, at 16:05, Stefan Monnier wrote: >> > As for the naming of `set-extension`, the best I can think of as an >> > alternative would be `with-extension` as a dual to `sans-extension`, >> >> `file-name-with-extension` sounds good to me (better than `...set...`). >> >> >> Stefan >> >> > > > *Attachments:* > * file-name-with-extension.patch --343f98f81265491090666d17eff75312 Content-Type: text/html Content-Transfer-Encoding: quoted-printable
And while = I'm at, I've tweaked one line to use `aref` to access the final characte= r of the filename directly, which avoids a (albeit minor) string allocat= ion.

On Wed, 9 Jun 2021, at 17:42, Colin W= oodbury wrote:
<= div>So be it! I've updated the patch.

Colin=

On Wed, 9 Jun 2021, at 16:05, Stefan Monni= er wrote:
> As for the naming of `set-extension`, the best I can think of as = an
> alternative would be `with-extension` as a dual to= `sans-extension`,

`file-name-with-extensio= n` sounds good to me (better than `...set...`).

=

        Stefan



Attachments:
  • file-name-with-extensi= on.patch

--343f98f81265491090666d17eff75312-- --3229a06ba1a043f3bd87c9929bb695e6 Content-Disposition: attachment;filename="file-name-with-extension.patch" Content-Type: text/x-patch; name="file-name-with-extension.patch" Content-Transfer-Encoding: BASE64 ZGlmZiAtLWdpdCBhL2xpc3AvZmlsZXMuZWwgYi9saXNwL2ZpbGVzLmVsCmluZGV4IDI0NTBk YWY1YmYuLmM2OTM4ZWIxYzggMTAwNjQ0Ci0tLSBhL2xpc3AvZmlsZXMuZWwKKysrIGIvbGlz cC9maWxlcy5lbApAQCAtNDg5Miw2ICs0ODkyLDIwIEBAIGV4dGVuc2lvbiwgdGhlIHZhbHVl IGlzIFwiXCIuIgogICAgICAgICAoaWYgcGVyaW9kCiAgICAgICAgICAgICAiIikpKSkpCiAK KyhkZWZ1biBmaWxlLW5hbWUtd2l0aC1leHRlbnNpb24gKGZpbGVuYW1lIGV4dGVuc2lvbikK KyAgIlNldCB0aGUgRVhURU5TSU9OIG9mIGEgRklMRU5BTUUuCitDb25zb2xpZGF0ZXMgbGVh ZGluZy90cmFpbGluZyBkb3RzIHNvIHRoYXQgZWl0aGVyIGBmb28nIG9yIGAuZm9vJworY2Fu IGJlIHBhc3NlZCBhcyBhbiBFWFRFTlNJT04uCisKK1NlZSBhbHNvIGBmaWxlLW5hbWUtc2Fu cy1leHRlbnNpb24nLiIKKyAgKGxldCogKChwYXR0ICJbIC5dKyIpCisgICAgICAgICAoZmls ZSAoc3RyaW5nLXRyaW0tcmlnaHQgZmlsZW5hbWUgcGF0dCkpCisgICAgICAgICAoZXh0biAo c3RyaW5nLXRyaW0tbGVmdCBleHRlbnNpb24gcGF0dCkpKQorICAgIChjb25kICgoc3RyaW5n LWVtcHR5LXAgZmlsZSkgKGVycm9yICJNYWxmb3JtZWQgZmlsZW5hbWU6ICVzI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