From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: font-lock-refresh-defaults Date: Thu, 22 Jul 2010 08:48:52 -0700 Message-ID: <2A9BC99A022442569748BEF619DFB564@us.oracle.com> References: <4FF5DD848A9B404E98F26FF04C85B3FA@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1279813836 25755 80.91.229.12 (22 Jul 2010 15:50:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 22 Jul 2010 15:50:36 +0000 (UTC) Cc: 'Bastian Beischer' , Emacs-devel@gnu.org To: "'Stefan Monnier'" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 22 17:50:34 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Oby2c-0005WG-4N for ged-emacs-devel@m.gmane.org; Thu, 22 Jul 2010 17:50:34 +0200 Original-Received: from localhost ([127.0.0.1]:41970 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oby2b-0003n8-Kv for ged-emacs-devel@m.gmane.org; Thu, 22 Jul 2010 11:50:33 -0400 Original-Received: from [140.186.70.92] (port=60797 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oby2V-0003ma-4G for Emacs-devel@gnu.org; Thu, 22 Jul 2010 11:50:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oby2T-0000Py-U8 for Emacs-devel@gnu.org; Thu, 22 Jul 2010 11:50:27 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:30607) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oby2T-0000Pm-Lt for Emacs-devel@gnu.org; Thu, 22 Jul 2010 11:50:25 -0400 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o6MFoLJV016744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 22 Jul 2010 15:50:23 GMT Original-Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o6MDsvki003611; Thu, 22 Jul 2010 15:50:20 GMT Original-Received: from abhmt012.oracle.com by acsmt355.oracle.com with ESMTP id 449781141279813733; Thu, 22 Jul 2010 08:48:53 -0700 Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 22 Jul 2010 08:48:52 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: AcsprKiajYKLQQTdQje2k/FUigT/cgABbNcg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 X-Source-IP: acsmt353.oracle.com [141.146.40.153] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090201.4C4868BD.0061:SCFMA4539814,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:127643 Archived-At: > > (defun Buffer-menu-fontify-and-adjust-frame () > > "Use for `buffer-menu-mode-hook'. Fontify, fit and raise frame." > > (save-window-excursion > > (save-excursion > > (pop-to-buffer "*Buffer List*") > > (when (< emacs-major-version 21) > > (make-local-variable 'font-lock-defaults)) > > (setq font-lock-defaults > > '(buffer-menu-font-lock-keywords t)) > > (when (fboundp 'font-lock-refresh-defaults) > > (font-lock-refresh-defaults)) ; WHY NEEDED NOW? > > (turn-on-font-lock) > > (when (and (fboundp 'fit-frame) (one-window-p t)) > > (fit-frame)) > > (raise-frame)))) > > > OK, so Emacs has apparently changed something about font-locking, so > > now you must refresh whenever you change the font-lock defaults. > > (Whenever? Or maybe only sometimes when you change the defaults?) > > I think that's pretty much always been necessary (as a general rule), > tho if the change is made before font-lock gets initialized, then of > course, there's nothing to refresh and the refresh is not needed, but > "when font-lock is initialized" is something that can depend on > *many* things. I won't argue that one has not sometimes had to refresh the defaults. I will say that the above code (without the call to `font-lock-refresh-defaults'), which is pretty simple, works fine in all previous Emacs releases. (And I also initialize font-lock prior to that code.) (And I repeat that the relevant context - the buff-menu.el code - did not change at all. It is there that someone will naturally look first for a change, to try to understand why things suddenly no longer work.) Refreshing might have been _theoretically_ necessary in the past as well, as you suggest, but it was not very often needed in practice, AFAICT. Anyway, `font-lock-refresh-defaults' did not even exist prior to Emacs 23.2. (And as I said before, the above code code, without f-l-r-d, works even in Emacs 23.2.) If this requirement to refresh has always been present (even if I didn't notice the need in practice), how did people refresh the defaults previously, without f-l-r-d? Can you point me to some pre-f-l-r-d source code that actually does it? I repeat that _something_ has apparently changed wrt font-locking, so that you must now refresh whenever (?) you change the defaults, or at least in more (or different) contexts than previously. And I repeat the main questions: Why the change? Just when do you now need to refresh, in practice (guidelines)? Why is there nothing about this change in NEWS? And nothing about when to use f-l-r-d in the Elisp manual? IOW, it seems that this need to refresh is felt more now than before, yet there is nothing guiding programmers about this. There is not even any mention of the (new) function you must call to satisfy the need (f-l-r-d). How about a little insight into this change? What's it all about? Thx.