From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: How to track down "No heading for this item in buffer or region."? Date: Sat, 26 Jan 2013 11:45:49 -0500 Message-ID: <6884.1359218749@alphaville> References: <20130124123204.GB24543@boo.workgroup> <87y5fioimf.fsf@bzg.ath.cx> <20130124162311.GE24543@boo.workgroup> <87libipeot.fsf@bzg.ath.cx> <4467.1359056138@alphaville.americas.hpqcorp.net> <8738xqpbo4.fsf@bzg.ath.cx> <4630.1359091242@alphaville> <87r4l86wv5.fsf@bzg.ath.cx> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:42533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tz8t8-0006g2-Qb for emacs-orgmode@gnu.org; Sat, 26 Jan 2013 11:45:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tz8t7-0001PK-P5 for emacs-orgmode@gnu.org; Sat, 26 Jan 2013 11:45:54 -0500 Received: from g4t0016.houston.hp.com ([15.201.24.19]:9675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tz8t7-0001Ox-Hj for emacs-orgmode@gnu.org; Sat, 26 Jan 2013 11:45:53 -0500 In-Reply-To: Message from Bastien of "Sat, 26 Jan 2013 11:51:10 +0100." <87r4l86wv5.fsf@bzg.ath.cx> 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: Bastien Cc: emacs-orgmode , Carsten Dominik Bastien 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