emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 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/)]
@ 2013-06-12 17:07 Nicolas Richard
  2013-06-13 10:35 ` Bug: [bisected] font locking breaks by saying "#+SETUPFILE" " Nicolas Richard
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Richard @ 2013-06-12 17:07 UTC (permalink / raw)
  To: emacs-orgmode


Hi all,

Consider the following testing.el

#+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))
#+END_SRC

and the following testing.org

#+begin_src org
  ,* Heading
  On peut aussi utiliser #+SETUPFILE.
#+end_src

Launching those with
  emacs -l testing.el testing.org
shows[1] that the buffer testing.org doesn't have its headline in blue
like it should. If I then launch Gnus for instance, it also has problems
of missing colors.

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 ?


-- 
Nico.

[1] This loads the .el file, which in particular loads testing.org, and
then shows that buffer

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug: [bisected] font locking breaks by saying "#+SETUPFILE" [8.0.3 (release_8.0.3-165-g60ca9e @ /home/youngfrog/sources/org-mode/lisp/)]
  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
  2013-09-03 13:38   ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Richard @ 2013-06-13 10:35 UTC (permalink / raw)
  To: emacs-orgmode

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.

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Bug: [bisected] font locking breaks by saying "#+SETUPFILE" [8.0.3 (release_8.0.3-165-g60ca9e @ /home/youngfrog/sources/org-mode/lisp/)]
  2013-06-13 10:35 ` Bug: [bisected] font locking breaks by saying "#+SETUPFILE" " Nicolas Richard
@ 2013-09-03 13:38   ` Bastien
  2013-09-03 14:22     ` Nicolas Richard
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2013-09-03 13:38 UTC (permalink / raw)
  To: Nicolas Richard; +Cc: emacs-orgmode

Hi Nicolas and all,

Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:

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

Can anyone double-check if there are still problems in this area?

See Nicolas original bug report here:
http://article.gmane.org/gmane.emacs.orgmode/73429

Last time I checked things worked fine for me, but maybe I didn't
cover all use cases.

Thanks in advance for your help,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug: [bisected] font locking breaks by saying "#+SETUPFILE" [8.0.3 (release_8.0.3-165-g60ca9e @ /home/youngfrog/sources/org-mode/lisp/)]
  2013-09-03 13:38   ` Bastien
@ 2013-09-03 14:22     ` Nicolas Richard
  2013-09-03 14:44       ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Richard @ 2013-09-03 14:22 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Le 03/09/2013 15:38, Bastien a écrit :
> Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:
>> First I mention that I forgot to say this was reproducible from -Q.
> 
> Can anyone double-check if there are still problems in this area?
> 
> See Nicolas original bug report here:
> http://article.gmane.org/gmane.emacs.orgmode/73429

Commit f129764 should have fixed that. I think there is some confusion
because this was in fact a duplicate of another bug report where much
more discussion happened (but I saw that thread only after posting my
report).

-- 
Nico.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug: [bisected] font locking breaks by saying "#+SETUPFILE" [8.0.3 (release_8.0.3-165-g60ca9e @ /home/youngfrog/sources/org-mode/lisp/)]
  2013-09-03 14:22     ` Nicolas Richard
@ 2013-09-03 14:44       ` Bastien
  0 siblings, 0 replies; 5+ messages in thread
From: Bastien @ 2013-09-03 14:44 UTC (permalink / raw)
  To: Nicolas Richard; +Cc: emacs-orgmode

Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:

> Commit f129764 should have fixed that. I think there is some confusion
> because this was in fact a duplicate of another bug report where much
> more discussion happened (but I saw that thread only after posting my
> report).

Indeed, thanks for confirming!

This is now closed, then.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-03 14:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` Bug: [bisected] font locking breaks by saying "#+SETUPFILE" " Nicolas Richard
2013-09-03 13:38   ` Bastien
2013-09-03 14:22     ` Nicolas Richard
2013-09-03 14:44       ` Bastien

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).