From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Wolfgang Jenkner Newsgroups: gmane.emacs.bugs Subject: bug#10063: 24.0.91; Making font-lock-mode-hook buffer-local while locally let-bound! Date: Mon, 26 Dec 2011 21:02:52 +0100 Message-ID: <8539c714mr.fsf@iznogoud.viz> References: <87y5vg5jzb.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1324929939 11357 80.91.229.12 (26 Dec 2011 20:05:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 26 Dec 2011 20:05:39 +0000 (UTC) Cc: Lars Magne Ingebrigtsen , 10063@debbugs.gnu.org, Katsumi Yamaoka , Leo To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 26 21:05:35 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RfGnd-0004cG-Sh for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Dec 2011 21:05:34 +0100 Original-Received: from localhost ([::1]:55968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RfGnd-0000PK-4L for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Dec 2011 15:05:33 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:37599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RfGnZ-0000PF-Fl for bug-gnu-emacs@gnu.org; Mon, 26 Dec 2011 15:05:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RfGnY-0001Pn-0H for bug-gnu-emacs@gnu.org; Mon, 26 Dec 2011 15:05:29 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53583) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RfGnX-0001Pj-Um for bug-gnu-emacs@gnu.org; Mon, 26 Dec 2011 15:05:27 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RfGq1-0000lU-SJ; Mon, 26 Dec 2011 15:08:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87y5vg5jzb.fsf@gmail.com> Resent-From: Wolfgang Jenkner Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Mon, 26 Dec 2011 20:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10063 X-GNU-PR-Package: emacs,gnus X-GNU-PR-Keywords: Original-Received: via spool by 10063-submit@debbugs.gnu.org id=B10063.13249300302883 (code B ref 10063); Mon, 26 Dec 2011 20:08:01 +0000 Original-Received: (at 10063) by debbugs.gnu.org; 26 Dec 2011 20:07:10 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RfGpC-0000kS-39 for submit@debbugs.gnu.org; Mon, 26 Dec 2011 15:07:10 -0500 Original-Received: from mx12.lb01.inode.at ([62.99.145.14] helo=mx.inode.at) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RfGp9-0000kK-Up for 10063@debbugs.gnu.org; Mon, 26 Dec 2011 15:07:08 -0500 Original-Received: from [85.127.80.57] (port=13206 helo=iznogoud.viz) by smartmx-12.inode.at with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1RfGme-0006kz-C7; Mon, 26 Dec 2011 21:04:32 +0100 Original-Received: from wolfgang by iznogoud.viz with local (Exim 4.77 (FreeBSD)) (envelope-from ) id 1RfGma-0000f5-CS; Mon, 26 Dec 2011 21:04:28 +0100 User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.92 (berkeley-unix) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 26 Dec 2011 15:08:01 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:55212 Archived-At: Tags: patch Stefan Monnier writes: >> 601: ;; Disable support modes, e.g., jit-lock, lazy-lock, etc. >> 602: (font-lock-mode-hook nil) >> 603: (font-lock-support-mode nil) > > BTW, these should not be let-bindings but buffer-local bindings. There's usually a major mode being called a few lines later, so kill-all-local-variables has already undone those settings before font-locking happens. Here's more context from mm-view.el (mm-display-inline-fontify): #+begin_src emacs-lisp (let ((font-lock-verbose nil)) ;; Disable support modes, e.g., jit-lock, lazy-lock, etc. (set (make-local-variable 'font-lock-mode-hook) nil) (set (make-local-variable 'font-lock-support-mode) nil) ... (with-demoted-errors (if mode (funcall mode) ...) ...)) #+end_src By the way, if you were viewing this in a Gnus article buffer after having set org-src-fontify-natively to t such a snippet used to be font-locked like in emacs-lisp mode but now it isn't, for the reason just given. The first patch below is relative to emacs bzr trunk and the second patch relative to gnus git master (No Gnus). 2011-12-26 Wolfgang Jenkner * font-lock.el (font-lock-support-mode): Mark it permanent-local. (Bug#10063) 2011-12-26 Wolfgang Jenkner * mm-view.el (mm-display-inline-fontify): Scrap `font-lock-mode-hook'. The 2005-09-06 entry gives disabling support modes as the only reason for caring about that variable, but already in NEWS.19 the advice is to use `font-lock-support-mode' instead as hook for support functions. === modified file 'lisp/font-lock.el' --- lisp/font-lock.el 2011-11-20 07:30:16 +0000 +++ lisp/font-lock.el 2011-12-26 05:03:58 +0000 @@ -887,6 +887,8 @@ :version "21.1" :group 'font-lock) +(put 'font-lock-support-mode 'permanent-local t) + (defvar fast-lock-mode) (defvar lazy-lock-mode) (defvar jit-lock-mode) -- >8 -- Subject: [PATCH] Scrap font-lock-mode-hook. --- lisp/mm-view.el | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/lisp/mm-view.el b/lisp/mm-view.el index 854ca34..0b3db15 100644 --- a/lisp/mm-view.el +++ b/lisp/mm-view.el @@ -566,8 +566,6 @@ (face-property 'default prop) (current-buffer)))) (delete-region ,(point-min-marker) ,(point-max-marker))))))))) -;; Shut up byte-compiler. -(defvar font-lock-mode-hook) (defun mm-display-inline-fontify (handle &optional mode) "Insert HANDLE inline fontifying with MODE. If MODE is not set, try to find mode automatically." @@ -602,7 +600,6 @@ If MODE is not set, try to find mode automatically." ;; I find font-lock a bit too verbose. (let ((font-lock-verbose nil)) ;; Disable support modes, e.g., jit-lock, lazy-lock, etc. - (set (make-local-variable 'font-lock-mode-hook) nil) (set (make-local-variable 'font-lock-support-mode) nil) (setq buffer-file-name (mm-handle-filename handle)) (set (make-local-variable 'enable-local-variables) nil) -- 1.7.8