From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jeff Norden Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Remove obsolete fast-lock and lazy-lock libraries Date: Mon, 10 Aug 2020 11:59:09 -0500 Message-ID: References: <831rke624c.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15473"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, stefankangas@gmail.com, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Aug 10 19:00:14 2020 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 1k5B9i-0003sJ-JI for ged-emacs-devel@m.gmane-mx.org; Mon, 10 Aug 2020 19:00:14 +0200 Original-Received: from localhost ([::1]:45254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5B9h-0008Cv-HT for ged-emacs-devel@m.gmane-mx.org; Mon, 10 Aug 2020 13:00:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5B8o-0006eJ-Mc for emacs-devel@gnu.org; Mon, 10 Aug 2020 12:59:18 -0400 Original-Received: from mta.tntech.edu ([149.149.2.87]:62055) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5B8l-0001I5-Tz for emacs-devel@gnu.org; Mon, 10 Aug 2020 12:59:18 -0400 Original-Received: from math.tntech.edu (unknown [149.149.102.6]) by mta.tntech.edu (Postfix) with ESMTPS id 3A4293000079; Mon, 10 Aug 2020 11:59:12 -0500 (CDT) Original-Received: from norden.tntech.edu ([149.149.102.4] helo=norden.math.tntech.edu) by math.tntech.edu with esmtp (Exim 4.92) (envelope-from ) id 1k5B8f-0005kQ-PB; Mon, 10 Aug 2020 11:59:10 -0500 Original-Received: by norden.math.tntech.edu (Postfix, from userid 742) id B09202572B73; Mon, 10 Aug 2020 11:59:09 -0500 (CDT) In-Reply-To: <831rke624c.fsf@gnu.org> (message from Eli Zaretskii on Mon, 10 Aug 2020 16:50:59 +0300) X-SA-Spam-Score: 0.0 X-SA-Spam-Report: Spam detection software, running on the system "math.tntech.edu", has NOT identified this incoming email as spam. If you have any questions, contact @@CONTACT_ADDRESS@@ pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 T_SPF_HELO_TEMPERROR SPF: test of HELO record failed (temperror) Received-SPF: pass client-ip=149.149.2.87; envelope-from=jnorden@tntech.edu; helo=mta.tntech.edu X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/10 12:59:12 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-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:253599 Archived-At: >> Anything that makes it clear how to disable Jit Lock while still >> using Font Lock seem like an improvement to me. > > Suggestions for how to improve the discoverability of this are > welcome. I like Stefan's font-lock-debug suggestion even more as I think about it. It definitely would have helped me when I was starting out to write fontification code. The current situation makes debugging font-lock rather confusing for someone new. In addition to the un-helpful name, f-l-s-m only works if set before font-lock is initialized. On the other hand, jit-lock-debug-mode can be invoked at any time. Historically, I think there was a need to set f-l-s-m to the value that worked best for the mode one was using. Now, all it does is enable/disable Jit. It seems like the only reason to disable Jit is if fontification isn't working properly, i.e., for debugging. This doesn't seem like the sort of thing that would usually be done via the "Easy Customization" menus. Furthermore, "M-x set-variable" doesn't work as expected for f-l-s-m, since it doesn't have any effect for a buffer that is already running font-lock (this puzzled me at first). It also seems to me that the abstraction of a 'minor mode' for font debugging options doesn't help much, and perhaps just adds to the confusion. The same goes for the idea that jit-lock is a mode, rather than just another feature of font-lock (it isn't defined as a minor mode, in fact). ---- So, here is an idea for consideration: A new buffer-local variable: font-lock-debug The possible values for now (more could be added later) would be: nil: normal fontification using Jit jit-defer: equivalent to currently setting jit-lock-debug-mode jit-disable: equivalent to currently having f-l-s-m nil when font-lock starts This variable could be set via font-lock-defaults like most other font-related things. Also add a new command, font-lock-set-debug, for changing font-lock-debug on the fly. This command would make the required adjustments to the change functions, jit registration, jit-lock-defer-timer, etc. This could also be used for initialization at font-lock startup, and then maybe the remaining confusing thing-lock things could be obsoleted. For backward compatibility: a) When font-lock-mode starts: if font-lock-support-mode is bound, and font-lock-debug is not set in font-lock-defaults, and (font-lock-value-in-major-mode f-l-s-m) returns nil, then set font-lock-debug to 'jit-disable. b) jit-lock-debug-mode would be a command that uses font-lock-set-debug to toggle font-lock-debug between nil and jit-defer (or set it to one of those when given an argument). If font-lock-debug is jit-disable, this command would give a "Jit Lock is disabled" message. --- Here are some ideas for possible future values of font-lock-debug: keyword-trace: write a line into a *Font Lock Debug* buffer each time a keyword matches, including the appropriate match-data values. jit-trace: write a line into a *Font Lock Debug* buffer each time Jit Lock decides to fontify, with the begin and end positions of the chunk. Thanks, -Jeff