On Jan 23, 2008, at 12:08 PM, Adam Spiers wrote:

On Wed, Jan 23, 2008 at 11:52:39AM +0100, Carsten Dominik wrote:
The same problem exists with normal `M-x occur'.

Fixing this would require advising a number of occur functions.

Ah of course, I hadn't twigged that it just uses occur-mode.

Maybe it is better to to define a new hook for the occur commands
that we then can use for this.  I'll look into it.  Very likely
this will work in 5.20, but it will require a fresh CVS Emacs.

I'd rather have the advice to save switching to CVS emacs on all my
computers, but then I'm selfish ;-) Thanks a lot whichever you choose.

I am afraid I will go the way of creating a hook, this is more consistent
and will work better for the different functions involved.

Of course, you can fix this for yourself.
For example (untested):

(defadvice occur-mode-goto-occurrence
  (after org-occur-reveal activate)
  (and (org-mode-p) (org-reveal)))
(defadvice occur-mode-goto-occurrence-other-window
  (after org-occur-reveal activate)
  (and (org-mode-p) (org-reveal)))
(defadvice occur-mode-display-occurrence
  (after org-occur-reveal activate)
  (when (org-mode-p)
    (let ((pos (occur-mode-find-occurrence)))
      (with-current-buffer (marker-buffer pos)
        (save-excursion
          (goto-char pos)
          (org-reveal))))))

Let me know if this works for all three functions and if I have missed
any other functions which need this.  If it works, I'll put it into
org.el as a temporary measure, untile the release of Emacs 23.

- Carsten


_______________________________________________
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 via email to