emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/org-notify 75df171a0a 05/23: Allow also suffixes for pr


From: ELPA Syncer
Subject: [elpa] externals/org-notify 75df171a0a 05/23: Allow also suffixes for predefined functions.
Date: Mon, 25 Jul 2022 12:57:56 -0400 (EDT)

branch: externals/org-notify
commit 75df171a0a8ca760714fc14a4751f0885b8320cb
Author: Peter Münster <pmrb@free.fr>
Commit: Peter Münster <pmrb@free.fr>

    Allow also suffixes for predefined functions.
    
    org-notify.el (org-notify-add): For the :actions, the user can supply now
    also a suffix for a predefined function instead of the full function name.
---
 org-notify.el | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/org-notify.el b/org-notify.el
index 61bf48a842..20624e90b0 100644
--- a/org-notify.el
+++ b/org-notify.el
@@ -37,13 +37,11 @@
 ;; Example setup:
 ;; (org-notify-add 'appt
 ;;                 '(:time "-1s" :period "20s" :duration 10
-;;                   :actions (org-notify-action-message
-;;                             org-notify-action-ding))
+;;                   :actions (-message -ding))
 ;;                 '(:time "15m" :period "2m" :duration 100
-;;                   :actions org-notify-action-notify)
-;;                 '(:time "2h" :period "5m"
-;;                   :actions org-notify-action-message)
-;;                 '(:time "3d" :actions org-notify-action-email))
+;;                   :actions -notify)
+;;                 '(:time "2h" :period "5m" :actions -message)
+;;                 '(:time "3d" :actions -email))
 ;; This means for todo-items with `notify' property set to `appt': 3 days
 ;; before deadline, send a reminder-email, 2 hours before deadline, start to
 ;; send messages every 5 minutes, then 15 minutes before deadline, start to
@@ -151,7 +149,10 @@ forgotten tasks."
                 (unless (listp actions)
                   (setq actions (list actions)))
                 (dolist (action actions)
-                  (funcall action plist))))
+                  (funcall (if (fboundp action) action
+                             (intern (concat "org-notify-action"
+                                             (symbol-name action))))
+                           plist))))
             (return)))))))
 
 (defun org-notify-add (name &rest params)
@@ -168,7 +169,9 @@ List of possible parameters:
              start. It's a string: an integral value (positive or negative)
              followed by a unit (s, m, h, d, w, M).
   :actions   A function or a list of functions to be called to notify the
-             user.
+             user. Instead of a function name, you can also supply a suffix
+             of one of the various predefined `org-notify-action-xxx'
+             functions.
   :period    Optional: can be used to repeat the actions periodically. Same
              format as :time.
   :duration  Some actions use this parameter to specify the duration of the



reply via email to

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