From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: master 305dbc7 2/4: Move description of value to syntax-ppss function. Date: Wed, 30 Oct 2019 20:34:21 +0000 Message-ID: <20191030203421.GA12640@ACM> References: <20191030121649.15369.13207@vcs0.savannah.gnu.org> <20191030121651.BFCF8204DF@vcs0.savannah.gnu.org> <87eeyutgwa.fsf@gnus.org> <333d1d46-ab79-5818-4367-b28ed915aff6@yandex.ru> <87a79itfzp.fsf@gnus.org> <875zk6tfo7.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="15839"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: emacs-devel@gnu.org, Dmitry Gutov To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 30 23:26:03 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iPwPi-0003yh-6V for ged-emacs-devel@m.gmane.org; Wed, 30 Oct 2019 23:26:02 +0100 Original-Received: from localhost ([::1]:44882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPwPh-00084n-2H for ged-emacs-devel@m.gmane.org; Wed, 30 Oct 2019 18:26:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52591) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPufo-000739-Ts for emacs-devel@gnu.org; Wed, 30 Oct 2019 16:34:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPufm-0003WI-U3 for emacs-devel@gnu.org; Wed, 30 Oct 2019 16:34:32 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:14267 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1iPufm-0003VA-KM for emacs-devel@gnu.org; Wed, 30 Oct 2019 16:34:30 -0400 Original-Received: (qmail 76391 invoked by uid 3782); 30 Oct 2019 20:34:25 -0000 Original-Received: from acm.muc.de (p4FE15A8F.dip0.t-ipconnect.de [79.225.90.143]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 30 Oct 2019 21:34:21 +0100 Original-Received: (qmail 12732 invoked by uid 1000); 30 Oct 2019 20:34:21 -0000 Content-Disposition: inline In-Reply-To: <875zk6tfo7.fsf@gnus.org> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.1 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:241653 Archived-At: Hello, Lars. On Wed, Oct 30, 2019 at 16:29:44 +0100, Lars Ingebrigtsen wrote: > Lars Ingebrigtsen writes: > > So perhaps that patch should be reverted anyway. Or have the list in > > both functions. Or, even better, stop saying > > (if (nth 5 state) > > (do-something-incomprehensible) > > (do-something-else-incomprehensible)) > > everywhere and just add accessor functions already, so that the code > > becomes marginally more readable. Because trying to make sense of it > > now is just too hard, and it doesn't have to be. > If we want to do this, I volunteer to start doing the rewrite -- I have > some functions for this from the decoded time makeover... > So what would the accessor macros be? Err... looking at the doc > string, something like: > ppss-depth > ppss-start-innermost > ppss-start-last-complete-sexp > ppss-string-terminator > ppss-comment-nesting > ppss-after-quote-character > ppss-minimum-paren-depth > ppss-comment-style > ppss-start-comment-or-string > ppss-open-paren-positions > ppss-two-character-syntax > ppss-internal For a start, why the prefix "ppss-"? The values are the results of calling parse-partial-sexp (however indirectly), so "pps-" would be more accurate, as well as being a character shorter. But I'm thoroughly against this change. It's bloat. On a good day, (or (nth 3 s) (nth 4 s)) will easily fit onto a single line of code, often with room for a comment such as "; in a string or comment.". (or (pps-string-terminator s) (pps-comment-nesting s)) is much less likely to do so. So we end up with an extra line, whether a continuation line added by redisplay, or a real extra line added by the hacker. In either case this is undesirable. I doubt these macros will be easier to read than the use of nth. They are too long to be instantly recognised - the eye and the brain must scan them piece by piece. (nth 3 s) can be a mental atom, requiring no effort. In practice, by far most of the accesses to the state returned by parse-partial-sexp are elements 3, 4, and 8, so anybody using parse-partial-sexp quickly learns what these mean. Others can be explained by comments, if needed. Anybody who doesn't recognise elts 3, 4, and 8 is probably best advised to read the pertinent manual page anyway. These new macro names would be a burden to learn and use, and a burden on the Emacs Lisp manual. Please don't do this. > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no -- Alan Mackenzie (Nuremberg, Germany).