emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Bug: [bisected] font locking breaks by saying "#+SETUPFILE" [8.0


From: Nicolas Richard
Subject: Re: [O] 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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Hi all,

First I mention that I forgot to say this was reproducible from -Q.

Nicolas Richard <address@hidden> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]