emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <dominik@science.uva.nl>
To: Christopher Suckling <suckling.list@googlemail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: re-search and org-link
Date: Thu, 22 Jan 2009 07:46:21 +0100	[thread overview]
Message-ID: <B4E672A6-BDEF-4D15-BDEE-2EAB94D22009@uva.nl> (raw)
In-Reply-To: <FCC38401-B5F0-4C1F-AB3C-443D9E9396A1@gmail.com>

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

  reply	other threads:[~2009-01-22  6:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-21 14:17 re-search and org-link Christopher Suckling
2009-01-22  6:46 ` Carsten Dominik [this message]
2009-01-22 18:58   ` Christopher Suckling

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=B4E672A6-BDEF-4D15-BDEE-2EAB94D22009@uva.nl \
    --to=dominik@science.uva.nl \
    --cc=emacs-orgmode@gnu.org \
    --cc=suckling.list@googlemail.com \
    /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).