From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: re-search and org-link Date: Thu, 22 Jan 2009 07:46:21 +0100 Message-ID: References: Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LPtKf-0001uL-9c for emacs-orgmode@gnu.org; Thu, 22 Jan 2009 01:46:29 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LPtKd-0001u8-1g for emacs-orgmode@gnu.org; Thu, 22 Jan 2009 01:46:28 -0500 Received: from [199.232.76.173] (port=50671 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LPtKc-0001u5-Gv for emacs-orgmode@gnu.org; Thu, 22 Jan 2009 01:46:26 -0500 Received: from mail-ew0-f20.google.com ([209.85.219.20]:35219) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LPtKc-0005lN-2Z for emacs-orgmode@gnu.org; Thu, 22 Jan 2009 01:46:26 -0500 Received: by ewy13 with SMTP id 13so2445341ewy.18 for ; Wed, 21 Jan 2009 22:46:24 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Christopher Suckling Cc: emacs-orgmode@gnu.org Hi Christopher, turning font-lock off and on does seem to help, but it is a pretty big cannon. The reason hy your hook runs into problem is: When the match is in text marked by an "intangible" property (like the link part of a link that also has a description), then the command loop moves the cursor you of this location. Apparently this happens here. A more direct solution might be to move to the beginning of the line before continuing the search, like this: (add-hook 'org-occur-hook (lambda () (goto-char (point-max)) (while (re-search-backward regexp nil t) (show-subtree) (org-cycle) (org-cycle) (beginning-of-line 1)))) Or even better: (add-hook 'org-occur-hook (lambda () (goto-char (point-max)) (while (re-search-backward regexp nil t) (org-back-to-heading) ;; in case match was deeper in entry (show-subtree) (org-cycle) (org-cycle) (beginning-of-line 1)))) HTH - Carsten On Jan 21, 2009, at 3:17 PM, Christopher Suckling wrote: > I currently use the following hook to achieve the level of detail I > like from a sparse tree: > > (add-hook 'org-occur-hook > (lambda () > (goto-char (point-max)) > (while > (re-search-backward regexp nil t) > (show-subtree) > (org-cycle) > (org-cycle)))) > > I combine this hook with > > (setq org-show-following-heading nil) > (setq org-show-entry-below t) > > This works great unless regexp is within a fontified org-link. Then > Emacs hangs and I get the OS X spinning beach-ball. > > There is a very easy workaround as re-search-backward has no problem > with an org-link if font-locking is turned off for the buffer: > > (add-hook 'org-occur-hook > (lambda () > (goto-char (point-max)) > (font-lock-mode) > (while > (re-search-backward regexp nil t) > (show-subtree) > (org-cycle) > (org-cycle)) > (font-lock-mode))) > > Practically, I'm content with my solution, but I thought I'd mention > it should the bug lie within the org-link code and bite anyone else > in other situations. > > OS X 10.5.6, Emacs 23.0.60.1 (NS), Org-mode 6.18c > > Best wishes, > > Christopher > > > > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode