From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] New package: listen Date: Mon, 26 Feb 2024 07:47:40 +0000 Message-ID: <871q8z8y5f.fsf@posteo.net> References: <51bcca65-2690-4f23-98bd-d929e63d7f94@alphapapa.net> <87il2cdb17.fsf@posteo.net> <6e496679-63f0-4a30-aa6a-8402ff96a6a1@alphapapa.net> <87h6hweihk.fsf@igel.home> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2950"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Andreas Schwab , emacs-devel To: Adam Porter Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Feb 26 08:48:19 2024 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 1reVil-0000YR-9V for ged-emacs-devel@m.gmane-mx.org; Mon, 26 Feb 2024 08:48:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1reViO-0004vn-Ic; Mon, 26 Feb 2024 02:47:59 -0500 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 1reViC-0004s7-Vj for emacs-devel@gnu.org; Mon, 26 Feb 2024 02:47:45 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1reViB-0006Yc-G5 for emacs-devel@gnu.org; Mon, 26 Feb 2024 02:47:44 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 0426D240106 for ; Mon, 26 Feb 2024 08:47:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1708933662; bh=EGrGMZ0wE9Tad5BEJWh7mryjOeKNzJQk27c0kiUkW64=; h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding:From; b=p051UrrkHUHQSHQTnXv0XdyhLztaafSu5/9yi+Wiz3pXnPLC0ms1o2MEy1RDKLtyL p3XQDiLTo8HiF9vIsKoYSCffRJCQeeGYJRb8ENJR8bXTXTNyCqloDdmenD3w36MZ46 HFRUOCBC6Ztn1pSW+GMIiQcZmPTXRZ5LVl8IqAJuQG/MZTXX4MoP60TUPYD5Ie15bg zFupy5K5Fx69YdqKCSOYAgNltZsFhpNKx3o1IItPK5Y/ycGoT+AQMItiV22eA87UF+ YdGdgmAD5ngOsdzLSGwqlGVvz64JRohvMEbqQ4EXx0m54tEQNKFHGm5llwJ8Ksem01 DyTGprkvd2Tkg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Tjt4r6VM6z9rxN; Mon, 26 Feb 2024 08:47:40 +0100 (CET) In-Reply-To: (Adam Porter's message of "Sun, 25 Feb 2024 21:46:46 -0600") OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:316547 Archived-At: Adam Porter writes: > Hi Andreas, > > On 2/25/24 08:17, Andreas Schwab wrote: >> On Feb 25 2024, Adam Porter wrote: >>=20 >>>> @@ -942,10 +941,10 @@ extension. >>>> Return one of symbols `vorbis', `opus', `flac', or `mp3'." >>>> (let ((case-fold-search t)) >>>> - (cond ((string-match ".ogg$" filename) 'vorbis) >>>> - ((string-match ".opus$" filename) 'opus) >>>> - ((string-match ".flac$" filename) 'flac) >>>> - ((string-match ".mp3$" filename) 'mp3) >>>> + (cond ((string-match ".ogg\\'" filename) 'vorbis) >>>> + ((string-match ".opus\\'" filename) 'opus) >>>> + ((string-match ".flac\\'" filename) 'flac) >>>> + ((string-match ".mp3\\'" filename) 'mp3) >>>> (t nil)))) >>> >>> According to the Elisp manual: "When matching a string instead of a >>> buffer, =E2=80=98$=E2=80=99 matches at the end of the string or before = a newline >>> character." So it appears to be correct here >> It should only match at the end of the string, not before a newline. > > As the manual says: > > =E2=80=98$=E2=80=99 > is similar to =E2=80=98^=E2=80=99 but matches only at the end of a l= ine (or the end > of the accessible portion of the buffer). Thus, =E2=80=98x+$=E2=80= =99 matches a > string of one =E2=80=98x=E2=80=99 or more at the end of a line. > > When matching a string instead of a buffer, =E2=80=98$=E2=80=99 matc= hes at the end > of the string or before a newline character. ^ this is the problem. Since it is possible for file-names to contain newline characters, matching the end of a line can result in false-positives: (string-match-p "\\.el$" "foo.el\nbar.le") ;;=3D> 3 (string-match-p "\\.el\\'" "foo.el\nbar.le") ;;=3D> nil (It's called the "manual", not the "infallible" (hehe) for a reason) --=20 Philip Kaludercic on peregrine