emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] How to track down "No heading for this item in buffer or region.


From: Nick Dokos
Subject: Re: [O] How to track down "No heading for this item in buffer or region."?
Date: Sat, 26 Jan 2013 11:45:49 -0500

Bastien <address@hidden> wrote:

> > Not quite: the file *is* opened in a buffer (the agenda code opens all the
> > files, I presume with find-file-noselect), but the text properties are
> > not up to date. It's only when I explicitly visit the buffer
> > that they get updated.
> 
> I updated the commit using the `font-lock-comment-face' for skipping
> commented scheduled/deadline lines -- it now uses comment-start-skip
> to skip those lines.  No need to put the # at the beginning of the
> line, the optimization here is not significant enough IMHO.
> 
> Org now relies on the general font-lock mechanism for comments, and
> defines comment-start etc.  See `org-setup-comments-handling'. Yes,
> the text properties from font-lock are not always present when the
> buffer is not visited, you're right... things seem a bit unpredictable
> in this area.
> 

I experimented a bit and came up with the following hack (which is
probably too heavy-handed to be acceptable as a genuine fix).

Let's assume that there is a way to force lazy properties (there must be
one since visiting the buffer does force them). Then anywhere where
org-agenda-skip is called, we make sure that the force function is
called beforehand. There's a few code paths that enter here but they are
all (?)  of the form:

   loop over files
      (setq buf  (find-file-noselect file))
      (with-current-buffer buf
           ;;;     
           do things that eventually call org-agenda-skip)

Replacing the ;;; with a call to the forcing function should do
the trick.

So here's my elephant-gun-to-kill-a-mosquito forcing function:

--8<---------------cut here---------------start------------->8---
(defun org-force-lazy-text-properties ()
    (jit-lock-function 1))
--8<---------------cut here---------------end--------------->8---

It seems to work at least for small files. There seem to be limits
to how much fontification it does, so if the file is bigger, it might
miss things. The more likely misfeature however is that it will slow
down the agenda to a crawl. It's an existence proof, not a solution.

Nick











reply via email to

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