From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: master 305dbc7 2/4: Move description of value to syntax-ppss function. Date: Thu, 31 Oct 2019 15:06:54 +0100 Message-ID: <87tv7p6mbl.fsf@gnus.org> 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> <20191030203421.GA12640@ACM> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="103257"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Dmitry Gutov , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 31 15:09:23 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 1iQB8c-000Qf6-Bg for ged-emacs-devel@m.gmane.org; Thu, 31 Oct 2019 15:09:22 +0100 Original-Received: from localhost ([::1]:50416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iQB8Z-0007AE-Rd for ged-emacs-devel@m.gmane.org; Thu, 31 Oct 2019 10:09:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44120) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iQB6K-0003sp-Sx for emacs-devel@gnu.org; Thu, 31 Oct 2019 10:07:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iQB6J-0001hR-6T for emacs-devel@gnu.org; Thu, 31 Oct 2019 10:07:00 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:40344) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iQB6I-0001eZ-V1 for emacs-devel@gnu.org; Thu, 31 Oct 2019 10:06:59 -0400 Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iQB6E-0001C1-RR; Thu, 31 Oct 2019 15:06:57 +0100 In-Reply-To: <20191030203421.GA12640@ACM> (Alan Mackenzie's message of "Wed, 30 Oct 2019 20:34:21 +0000") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 80.91.231.51 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:241669 Archived-At: Alan Mackenzie writes: > 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. As syntax.el says: ;; Note: PPSS stands for `parse-partial-sexp state' > 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. No, (nth 3 s) can mean anything. You first have to backtrack up the code to see what s is, then go to the doc string for syntax-ppss, and then go to the doc string for parse-partial-sexp to see what it means. > 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. I think that's a kinda elitist way of looking at it. If you don't understand obscure code, there's nothing wrong with you -- there's something wrong with the code. Font locking is something normal users should be able to understand, because it's something that's very visual, has an immediate impact, and can be tweaked endlessly. But reading the code today is much harder than it has to be, and my guess is that many people will just bail when presented with code like ;; Find each interesting place between here and `end'. (while (progn (when (or (nth 3 state) (nth 4 state)) (setq face (funcall font-lock-syntactic-face-function state)) ... I think we had the same discussion with decoded time accessors? That was a minor understandability hurdle compared to ppss -- at least there you could sort of guess what they were because they were increasing (minutes higher than seconds). The ppss nths are completely inscrutable. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no