From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Richard Subject: Re: Bug: [bisected] font locking breaks by saying "#+SETUPFILE" [8.0.3 (release_8.0.3-165-g60ca9e @ /home/youngfrog/sources/org-mode/lisp/)] Date: Thu, 13 Jun 2013 12:35:53 +0200 Message-ID: <87bo7ati0m.fsf@yahoo.fr> References: <87zjuv2r79.fsf@yahoo.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Un4sO-0004hX-I2 for emacs-orgmode@gnu.org; Thu, 13 Jun 2013 06:35:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Un4sM-0001Mk-1l for emacs-orgmode@gnu.org; Thu, 13 Jun 2013 06:35:31 -0400 Received: from mxin.ulb.ac.be ([164.15.128.112]:35771) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Un4sL-0001MR-SQ for emacs-orgmode@gnu.org; Thu, 13 Jun 2013 06:35:29 -0400 In-Reply-To: <87zjuv2r79.fsf@yahoo.fr> (Nicolas Richard's message of "Wed, 12 Jun 2013 19:07:22 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi all, First I mention that I forgot to say this was reproducible from -Q. Nicolas Richard writes: > I've had such a line in one of my org file for one year now, and it used > to work fine, but I have to catch my train right now so can't debug > further atm. Maybe this rings a bell already ? After a "git bisect" session, the first bad commit is Bastien's b83c0309 "Fix handling of setup file wrt setting tags". That commit introduces a call to (org-set-regexps-and-options) when #+SETUPFILE is found anywhere in the buffer ; and that calls (org-set-font-lock-defaults) which in the end calls (kill-local-variable 'font-lock-keywords) and that seems to be a problem at that moment (while it doesn't seem to be a problem when (org-mode) runs it). Not sure how to fix that, because I don't really understand all these font locking. One solution (i.e. it works) is moving org-set-font-lock-defaults to (org-mode) explicitly : #+begin_src diff Modified lisp/org.el diff --git a/lisp/org.el b/lisp/org.el index b68749d..69b33d9 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5152,8 +5152,7 @@ Support for group tags is controlled by the option (mapcar (lambda (w) (substring w 0 -1)) (list org-scheduled-string org-deadline-string org-clock-string org-closed-string))) - (org-compute-latex-and-related-regexp) - (org-set-font-lock-defaults)))) + (org-compute-latex-and-related-regexp)))) (defun org-file-contents (file &optional noerror) "Return the contents of FILE, as a string." @@ -5339,6 +5338,7 @@ The following commands are available: (setq buffer-display-table org-display-table)) (org-set-regexps-and-options-for-tags) (org-set-regexps-and-options) + (org-set-font-lock-defaults) (when (and org-tag-faces (not org-tags-special-faces-re)) ;; tag faces set outside customize.... force initialization. (org-set-tag-faces 'org-tag-faces org-tag-faces)) #+end_src As a side note, I don't understand how/why other buffers are affected. With the following test case #+begin_src emacs-lisp (setq inhibit-splash-screen t) (add-to-list 'load-path "~/sources/org-mode/lisp/") (let ((org-agenda-files '("testing.org"))) (org-agenda-list)) (switch-to-buffer "testing.org") (message "%s %s" font-lock-keywords (progn (sit-for 0.1) font-lock-keywords)) #+end_src I get "nil (t nil)" in the *Messages* buffer. (Btw, while testing this whole issue I ran into a problem that inserting (message "%s" font-lock-keywords) at a specific place would fix the problem. That was wrong and I lost much time trying to understand that. I now run `font-lock-fontify-buffer' at the end of the code to make sure I have the right fontlocking.) -- Nico.