[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: |
Thu, 13 Jun 2013 20:21:01 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> Thank you for this excellent "advice" ;-). It works very nicely --
> except for one wrinkle: after loading todos.el (which requires
> 'diary-lib) I have to eval diary-goto-entry (or load diary-lib) again in
> order for the advice to take effect. Without doing that it's as if the
> advice were not activated. But I see nothing about activating advice in
> nadvice.el. Here's what I added to diary-lib.el:
Contrary to advice, which has all kinds of subtle distinction between
defining an advice, enabling an advice, and activating an advice,
nadvice just has add-function (or advice-add) which
works more like add-hook (i.e. kind of defines/enables/activates all at
once).
> (define-derived-mode todos-mode special-mode "Todos"
> "Major mode for displaying, navigating and editing Todo lists.
> \\{todos-mode-map}"
> ;; other initializations ...
> (add-function :around diary-goto-location-function
> (lambda (orig-fun &rest args)
> (when (derived-mode-p 'todos-mode) (widen))
> (apply orig-fun args)
> (todos-diary-goto-entry))))
This doesn't make sense: you `add-function' to the global value of
diary-goto-location-function, but you do it in the mode function,
i.e. once per todo-mode buffer.
Either do it locally (i.e. in the todo-mode function but with
(add-function :around (local diary-goto-location-function)
(lambda (orig-fun &rest args)
(widen)
(apply orig-fun args)
(todos-diary-goto-entry)))
Or do it globally, (i.e. at the top-level of todo-mode.el).
Stefan
- Re: New version of todo-mode.el (announcement + user guide), (continued)
- Re: New version of todo-mode.el (announcement + user guide), Stephen Berman, 2013/06/11
- Re: New version of todo-mode.el (announcement + user guide), Stefan Monnier, 2013/06/11
- Re: New version of todo-mode.el (announcement + user guide), Stephen Berman, 2013/06/12
- Re: New version of todo-mode.el (announcement + user guide), Stefan Monnier, 2013/06/12
- Re: New version of todo-mode.el (announcement + user guide), Stephen Berman, 2013/06/13
- Re: New version of todo-mode.el (announcement + user guide), Glenn Morris, 2013/06/12
- Re: New version of todo-mode.el (announcement + user guide), Stefan Monnier, 2013/06/12
- Re: New version of todo-mode.el (announcement + user guide), Stephen Berman, 2013/06/12
- Re: New version of todo-mode.el (announcement + user guide), Stefan Monnier, 2013/06/12
- Re: New version of todo-mode.el (announcement + user guide), Stephen Berman, 2013/06/13
- Re: New version of todo-mode.el (announcement + user guide),
Stefan Monnier <=
- Re: New version of todo-mode.el (announcement + user guide), Stephen Berman, 2013/06/14
- Re: New version of todo-mode.el (announcement + user guide), Glenn Morris, 2013/06/14
- Re: New version of todo-mode.el (announcement + user guide), Stefan Monnier, 2013/06/14
- Re: New version of todo-mode.el (announcement + user guide), Stephen Berman, 2013/06/15
- Re: New version of todo-mode.el (announcement + user guide), Stefan Monnier, 2013/06/15
- Re: New version of todo-mode.el (announcement + user guide), Stephen Berman, 2013/06/16
- Re: New version of todo-mode.el (announcement + user guide), Stefan Monnier, 2013/06/16
- Re: New version of todo-mode.el (announcement + user guide), Glenn Morris, 2013/06/17
- Re: New version of todo-mode.el (announcement + user guide), Stephen Berman, 2013/06/17
- Re: New version of todo-mode.el (announcement + user guide), Wolfgang Jenkner, 2013/06/12