emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Richard <theonewiththeevillook@yahoo.fr>
To: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87bo7ati0m.fsf@yahoo.fr> (raw)
In-Reply-To: <87zjuv2r79.fsf@yahoo.fr> (Nicolas Richard's message of "Wed, 12 Jun 2013 19:07:22 +0200")

Hi all,

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

Nicolas Richard <theonewiththeevillook@yahoo.fr> 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	other threads:[~2013-06-13 10:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-12 17:07 Bug: font locking breaks by saying "#+SETUPFILE" in the middle of a line [8.0.3 (release_8.0.3-165-g60ca9e @ /home/youngfrog/sources/org-mode/lisp/)] Nicolas Richard
2013-06-13 10:35 ` Nicolas Richard [this message]
2013-09-03 13:38   ` Bug: [bisected] font locking breaks by saying "#+SETUPFILE" " Bastien
2013-09-03 14:22     ` Nicolas Richard
2013-09-03 14:44       ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bo7ati0m.fsf@yahoo.fr \
    --to=theonewiththeevillook@yahoo.fr \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).