emacs-devel
[Top][All Lists]
Advanced

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

Re: New version of todo-mode.el (announcement + user guide)


From: Stefan Monnier
Subject: Re: New version of todo-mode.el (announcement + user guide)
Date: Wed, 12 Jun 2013 21:18:29 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> Thanks for the go-ahead.  I do agree with you that a hook would be
> better and in fact gave it some thought, but couldn't see how to do it
> using an existing hook.  I didn't consider adding a new hook, and I'm
> not sure I what that should be.  The problem is, after the button is
> clicked in the Fancy Diary display, if the todo file is in a buffer, it
> will probably be narrowed, so it has to be widened before going to the
> position of the marker, and then it has to be narrowed again afterwards
> to get the proper display.  So either there have to be two hooks
> sandwiching the goto-char for the marker, or the latter has to be passed
> to the hook function.  Neither really seems much better than the ad hoc
> patch I posted, but it's not unlikely I'm overlooking a better
> alternative.  If you have any ideas, I'm all ears.

I think a way to do this is with a diary-goto-marker-function hook.
The default value could be `goto-char'.  And your todo-mode can change
it via something like:

    (add-function :around diary-goto-marker-function
                  (lambda (orig-fun &rest args)
                    (when (derived-mode-p 'todo-mode) (widen))
                    (apply orig-fun args)
                    (todos-diary-goto-entry)))

-- Stefan



reply via email to

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