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: [PATCH] mailcap-add-mailcap-entry: Superfluous setcdr, readability, entry overriding Date: Wed, 09 Mar 2022 15:03:49 +0100 Message-ID: <87sfrr5ika.fsf@gnus.org> References: <87tuc9pvp0.fsf@sperrhaken.name> 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="8999"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: emacs-devel To: Felix Dietrich Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 09 15:05:00 2022 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 1nRwvz-00020v-FW for ged-emacs-devel@m.gmane-mx.org; Wed, 09 Mar 2022 15:04:59 +0100 Original-Received: from localhost ([::1]:37818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRwvy-0003N7-3M for ged-emacs-devel@m.gmane-mx.org; Wed, 09 Mar 2022 09:04:58 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRwuy-0002cu-7p for emacs-devel@gnu.org; Wed, 09 Mar 2022 09:03:58 -0500 Original-Received: from [2a01:4f9:2b:f0f::2] (port=36738 helo=quimby.gnus.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRwuw-0002Si-MT for emacs-devel@gnu.org; Wed, 09 Mar 2022 09:03:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To: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=6sRKvqa37f/vVtmDWmKoz9d2/+dpTC4eskJ+XTnIeDE=; b=jKZ9fKytezUtFia9Z2hh4Rj8Hc UWjXO7OPaQ3SSlbJNlBSK1qZcSQJqQfDtPlb7LVKVSdl74zVlblHozdNJSxXScT/7X132NP6GMPjk Hfg2TMdeUSGk4E+EQlkkrgI5EmHWEjvSnEWyxErTZmb9GLu80LZd5HeN+KGPpGeuqqHY=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nRwus-00086z-6O; Wed, 09 Mar 2022 15:03:52 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAG1BMVEUxiCogXR0cjShc YSmUKSheKB0KIQlDgyn///+3Z0e0AAAAAWJLR0QIht6VegAAAAd0SU1FB+YDCQ07F4HYnskAAAF0 SURBVDjLxZQxb8IwEIXPPVJWGxTPEIvd5Fx1RXKgcwViz4BnpPT/q2eHlpC4UtWlL8kpuc/Ou7Oj gFiA5IMllFLppteSYMUX561aiK+sBSBab2dkpNrUfHrciqoy6AGcM1R4dzxutsp45937ktwLg6Uh KsgXtfNyQaZ2tfeOagAlhcWaUBb8UIGpgTyu2YbrWIGo2Dy5ypV86v0HBT4qAvWoAQihDRxu6kHk SjOJIQP4DSMAd4/2ASQP3cZ8BrADQ62nIL3ppMcePDian84TwD2ooJsJSOWGsjlkQGh1uZ+CEDsv DznA9pcMSCoP+2lVXG64nDPlcieBo56AuFb8wUn9CJ55+WK+VUKPAechTRoBFTcs7rYSI5A28rab AxD6TnQKGaD+B7R3MOxD5D7qX2v+fYeA9mqpuyIRWiC85R2R64gaZ9E2nZ/vkOcgWXCeyDQ8+Ipv 1PHzzPEYv+MfAHX4mian+IGds3OekdHsp8IQ/qRPKWl7bFpi8T0AAAAldEVYdGRhdGU6Y3JlYXRl ADIwMjItMDMtMDlUMTM6NTk6MjMrMDA6MDCCqzDVAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIyLTAz LTA5VDEzOjU5OjIzKzAwOjAw8/aIaQAAAABJRU5ErkJggg== X-Now-Playing: Robert Wyatt's _Nothing Can Stop Us_: "At Last I Am Free" In-Reply-To: <87tuc9pvp0.fsf@sperrhaken.name> (Felix Dietrich's message of "Mon, 07 Mar 2022 17:35:23 +0100") X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:4f9:2b:f0f::2 (failed) Received-SPF: pass client-ip=2a01:4f9:2b:f0f::2; envelope-from=larsi@gnus.org; helo=quimby.gnus.org X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 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, RDNS_NONE=0.793, 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" Xref: news.gmane.io gmane.emacs.devel:286955 Archived-At: Felix Dietrich writes: > Given that setcdr returns its second argument, i.e. the NEWCDR, I > believe that setcdr here is essentially called twice with the same > arguments. Therefore, one of the setcdr calls is superfluous and should > be removed. Yup. > The first, relating to readability: I found it quit difficult to follow > the flow of the function=CA=BCs code due to its nesting and idiosyncratic > order of condition checking. I want to, therefore, propose a > restructured version, which I believe to be functionally equivalent. Yes, the code is pretty confusing... so reading the patches, I'm not quite sure whether the new one is equivalent or not. So I think we'd want to have a number of tests in mailcap-tests.el to test that the results really are equivalent before and after the change, too. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no