From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: master 2399541: Remove font-lock toggle from font-lock-update Date: Mon, 29 Mar 2021 11:50:29 -0400 Message-ID: References: <20210324143048.23515.75257@vcs0.savannah.gnu.org> <20210324143050.40C6E20D10@vcs0.savannah.gnu.org> <8786a8e8fa731c1bd1ef@heytings.org> <87h7l0blrc.fsf@gnus.org> <87czvobksy.fsf@gnus.org> <87r1k4a1c0.fsf@gnus.org> <8786a8e8fa96815c66e3@heytings.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="32863"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Gregory Heytings Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Mar 29 17:53:38 2021 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 1lQuCv-0008PN-W0 for ged-emacs-devel@m.gmane-mx.org; Mon, 29 Mar 2021 17:53:37 +0200 Original-Received: from localhost ([::1]:60754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lQuCv-0002vg-0E for ged-emacs-devel@m.gmane-mx.org; Mon, 29 Mar 2021 11:53:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lQuA2-0007x0-Rm for emacs-devel@gnu.org; Mon, 29 Mar 2021 11:50:40 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:27001) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lQu9x-0002GH-Oo for emacs-devel@gnu.org; Mon, 29 Mar 2021 11:50:37 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 97040440BE3; Mon, 29 Mar 2021 11:50:32 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id E9D3A4403B4; Mon, 29 Mar 2021 11:50:30 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1617033030; bh=YtiaJxu3jNALYbDUqnlVXgayEWlEopQW8lEeX8zOG70=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=edxsb2o7D3NQybM1WftgZdS7h0LV+I7j44ycclykOrW96RVs/6h+74vvWXKTQCCKT N2/C0UoJd3TwKIA6xmqDqFMUfsVZV4lmPhJ3j9WiSSknj5bSTl/s15TEz1hs45vd/n Lly5G7iKldQC2DrgquRS9GVPgovCow34/YVbqxQI/6wIH4KEqYN0JHd7CNrBhaCf7I rethGYXI8+oCjPubtGHKqOtVegqfeAQMoMSZRTQFQi5Ki6yv68AWW4pRdXAWz1By1W WcfOSupZ4TcYYwGD6oSy9SoOfe6cK2tX1iQ4qwTG8NY3A/GZ+ugG1lSxB+fQXISgPA Iql/Qq6h0hGtg== Original-Received: from alfajor (unknown [216.154.43.249]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2F04612006D; Mon, 29 Mar 2021 11:50:30 -0400 (EDT) In-Reply-To: (Gregory Heytings's message of "Mon, 29 Mar 2021 14:40:19 +0000") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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:267152 Archived-At: >>> One thing I'm not entirely sure is whether the second case is (and >>> font-lock-mode (not font-lock-keywords)) or (and font-lock-mode (not >>> font-lock-fontified)), but my guess is that font-lock-fontified is an >>> internal variable and that it is safer to use font-lock-keywords here. >> >> I'm not entirely sure what is the best way to detect this middle-point >> either. The code that decides whether to activate the font-lock machinery >> calls `font-lock-specified-p` for that, but maybe there are corner cases >> where the machinery can be activated even when `font-lock-specified-p` >> returns nil? Similarly, I'm not sure if `font-lock-fontified` is always >> non-nil when the font-lock machinery is activated and always nil when it >> isn't. >> >> IOW, someone needs to look carefully at the code to find out (and >> presumably then document the result e.g. by adding a function that returns >> this info, or with comments, or by adding a variable which keeps track of >> this info or ...). >> > > I guess that Someone^TM is me? ;-) I'll have a look. BTW, this relates to the distinction between "font-lock-mode, the minor mode that control whether there is highlighting or not" and "font-lock-mode, the most common way to apply highlighting when requested". Admittedly, it seems the only user of `font-lock-function` (the core variable that allows taking advantage of this distinction to provide a different machinery) is `ert.el` which just uses in a marginal way that could probably be replace by the use of `font-lock-hook` or something like that. >>>>> +Otherwise, with prefix ARG, toggle Font Lock mode." >>>> >>>> Is this behavior useful? >>> >>> I think it is, yes, and I think it makes sense to use the prefix argument >>> for that. M-x font-lock-mode does not always produce the expected >>> effect, which can be puzzling, so having a way to "do what I mean" in >>> a command is useful. >> >> Could you describe what you mean by "does not always produce the expected >> effect" here? [ And maybe how the prefix ARG to `font-lock-dwim` avoids >> those problems? ] >> > By "does not always produce the expected effect", I mean for example that > M-x font-lock-mode in a text-mode or fundamental-mode buffer does not > remove then fontification from a piece of code that was killed-yanked from I see. IIUC, that's unrelated to the: Otherwise, with prefix ARG, toggle Font Lock mode part of the command's behavior, right? Stefan