all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Org agenda and appointments
@ 2023-03-10 10:31 Manuel Giraud via Users list for the GNU Emacs text editor
  2023-03-10 11:10 ` Robert Pluim
  0 siblings, 1 reply; 4+ messages in thread
From: Manuel Giraud via Users list for the GNU Emacs text editor @ 2023-03-10 10:31 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I like to have Emacs remind me of upcoming appointments.  For this, I
have put "(appt-activate 1)" in my init file and it works automagically
for anything that is (or will be) into the Diary.

Now, I'm also using Org agenda.  For instance, I use 'org-capture' to
enter some new appointment.  The Info manual says that I should call
'org-agenda-to-appt' to add Org agenda appointments and also have
notifications about those.  The problem is that I could forget to make
this call after entering a new appointment.

Inspired by what is done in 'appt-active', I came up with the following
solution in my init file:
--8<---------------cut here---------------start------------->8---
(defun +org-agenda-update-appt ()
  (when (member buffer-file-name (org-agenda-files))
    (org-agenda-to-appt))
  nil)
(add-hook 'write-file-functions #'+org-agenda-update-appt)
--8<---------------cut here---------------end--------------->8---

So my question is: Is there a better/cleaner interface to do this?
Because what I have done seems bit tricky from a user point of view.

Thanks,
-- 
Manuel Giraud



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Org agenda and appointments
  2023-03-10 10:31 Org agenda and appointments Manuel Giraud via Users list for the GNU Emacs text editor
@ 2023-03-10 11:10 ` Robert Pluim
  2023-03-10 13:42   ` Manuel Giraud via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Pluim @ 2023-03-10 11:10 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: Manuel Giraud

>>>>> On Fri, 10 Mar 2023 11:31:23 +0100, Manuel Giraud via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> said:

    Manuel> Hi,
    Manuel> I like to have Emacs remind me of upcoming appointments.  For this, I
    Manuel> have put "(appt-activate 1)" in my init file and it works automagically
    Manuel> for anything that is (or will be) into the Diary.

    Manuel> Now, I'm also using Org agenda.  For instance, I use 'org-capture' to
    Manuel> enter some new appointment.  The Info manual says that I should call
    Manuel> 'org-agenda-to-appt' to add Org agenda appointments and also have
    Manuel> notifications about those.  The problem is that I could forget to make
    Manuel> this call after entering a new appointment.

    Manuel> Inspired by what is done in 'appt-active', I came up with the following
    Manuel> solution in my init file:

    Manuel> (defun +org-agenda-update-appt ()
    Manuel>   (when (member buffer-file-name (org-agenda-files))
    Manuel>     (org-agenda-to-appt))
    Manuel>   nil)
    Manuel> (add-hook 'write-file-functions #'+org-agenda-update-appt)

    Manuel> So my question is: Is there a better/cleaner interface to do this?
    Manuel> Because what I have done seems bit tricky from a user point of view.

I think this is what `org-capture-after-finalize-hook' is for.

Robert
-- 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Org agenda and appointments
  2023-03-10 11:10 ` Robert Pluim
@ 2023-03-10 13:42   ` Manuel Giraud via Users list for the GNU Emacs text editor
  2023-03-10 13:58     ` Manuel Giraud via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 4+ messages in thread
From: Manuel Giraud via Users list for the GNU Emacs text editor @ 2023-03-10 13:42 UTC (permalink / raw)
  To: Robert Pluim; +Cc: help-gnu-emacs

Robert Pluim <rpluim@gmail.com> writes:

[...]

> I think this is what `org-capture-after-finalize-hook' is for.

Thanks.  It is indeed a more specialized hook.  But I thought I was
missing something simpler than setting up a hook.
-- 
Manuel Giraud



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Org agenda and appointments
  2023-03-10 13:42   ` Manuel Giraud via Users list for the GNU Emacs text editor
@ 2023-03-10 13:58     ` Manuel Giraud via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 4+ messages in thread
From: Manuel Giraud via Users list for the GNU Emacs text editor @ 2023-03-10 13:58 UTC (permalink / raw)
  To: Robert Pluim; +Cc: help-gnu-emacs

Manuel Giraud <manuel@ledu-giraud.fr> writes:

> Robert Pluim <rpluim@gmail.com> writes:
>
> [...]
>
>> I think this is what `org-capture-after-finalize-hook' is for.
>
> Thanks.  It is indeed a more specialized hook.  But I thought I was
> missing something simpler than setting up a hook.

Ok, it was just a one-liner:

(add-hook 'org-capture-after-finalize-hook #'org-agenda-to-appt)

Now what's left is the "changing day" update (as done in
'appt-activate')
-- 
Manuel Giraud



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-10 13:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-10 10:31 Org agenda and appointments Manuel Giraud via Users list for the GNU Emacs text editor
2023-03-10 11:10 ` Robert Pluim
2023-03-10 13:42   ` Manuel Giraud via Users list for the GNU Emacs text editor
2023-03-10 13:58     ` Manuel Giraud via Users list for the GNU Emacs text editor

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.