branch: externals/tmr commit e46df436e2ee1779c4afef587d48ec08b6ab6b71 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Rename done and completed to finished for consistency --- README.org | 4 ++-- tmr-notification.el | 2 +- tmr.el | 34 +++++++++++++++++----------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.org b/README.org index 6f31d7b9c1..bb2b668e13 100644 --- a/README.org +++ b/README.org @@ -200,8 +200,8 @@ TMR provides the following hooks: the newly created timer's start and end time as well as its optional description (if provided). -#+vindex: tmr-timer-completed-functions -+ ~tmr-timer-completed-functions~ :: This runs when a timer elapses. By +#+vindex: tmr-timer-finished-functions ++ ~tmr-timer-finished-functions~ :: This runs when a timer elapses. By default, it will (i) produce a desktop notification which describes the timer's start/end time and optional description (if available), (ii) play an alarm sound ([[#h:56bbbd6f-5b63-4375-9c86-e1eb231be356][Sound and desktop notifications]]), and (iii) diff --git a/tmr-notification.el b/tmr-notification.el index 0a0c09391c..3855520060 100644 --- a/tmr-notification.el +++ b/tmr-notification.el @@ -59,7 +59,7 @@ such notifications." Read: (info \"(elisp) Desktop Notifications\") for details." (if (featurep 'dbusbind) (let ((title "TMR May Ring (Emacs tmr package)") - (body (tmr--long-description-for-completed-timer timer))) + (body (tmr--long-description-for-finished-timer timer))) (notifications-notify :title title :body body diff --git a/tmr.el b/tmr.el index 8152d2747e..0458038ab2 100644 --- a/tmr.el +++ b/tmr.el @@ -69,14 +69,14 @@ Each function must accept a timer as argument." (declare-function tmr-notification-notify "ext:tmr-notification.el" (title message)) -(defcustom tmr-timer-completed-functions - (list #'tmr-print-message-for-completed-timer +(defcustom tmr-timer-finished-functions + (list #'tmr-print-message-for-finished-timer #'tmr-sound-play #'tmr-notification-notify) - "Functions to execute when a timer is completed. + "Functions to execute when a timer is finished. Each function must accept a timer as argument." :type 'hook - :options (list #'tmr-print-message-for-completed-timer + :options (list #'tmr-print-message-for-finished-timer #'tmr-sound-play #'tmr-notification-notify)) @@ -97,7 +97,7 @@ Each function must accept a timer as argument." nil :read-only t :documentation "Number of seconds after `start' indicating when the timer finishes.") - (donep + (finishedp nil :read-only nil :documentation "Non-nil if the timer is finished.") @@ -133,8 +133,8 @@ Each function must accept a timer as argument." (format " [%s]" (propertize description 'face 'bold)) "")))) -(defun tmr--long-description-for-completed-timer (timer) - "Return a human-readable description of completed TIMER. +(defun tmr--long-description-for-finished-timer (timer) + "Return a human-readable description of finished TIMER. This includes the creation and completion dates as well as the optional `tmr--timer-description'." (let ((start (tmr--format-creation-date timer)) @@ -177,10 +177,10 @@ original input for TIMER's duration." (defun tmr--format-remaining (timer &optional finished prefix) "Format remaining time of TIMER. -FINISHED is the string used for completed timers. +FINISHED is the string used for finished timers. PREFIX is used as prefix for running timers." (setq prefix (or prefix "")) - (if (tmr--timer-donep timer) + (if (tmr--timer-finishedp timer) (or finished "✔") (let ((secs (round (- (float-time (time-add (tmr--timer-creation-date timer) @@ -261,7 +261,7 @@ cancelling the original one." (defun tmr-remove-finished () "Remove all finished timers." (interactive) - (setq tmr--timers (cl-delete-if #'tmr--timer-donep tmr--timers)) + (setq tmr--timers (cl-delete-if #'tmr--timer-finishedp tmr--timers)) (run-hooks 'tmr--update-hook)) (defvar tmr--read-timer-hook nil @@ -282,7 +282,7 @@ completion candidates." (run-hook-with-args-until-success 'tmr--read-timer-hook) (pcase (if active - (cl-remove-if #'tmr--timer-donep tmr--timers) + (cl-remove-if #'tmr--timer-finishedp tmr--timers) tmr--timers) ('nil (user-error "No timers available")) (`(,timer) timer) @@ -311,9 +311,9 @@ TIMER is unused." "Show a `message' informing the user that TIMER was created." (message "%s" (tmr--long-description timer))) -(defun tmr-print-message-for-completed-timer (timer) - "Show a `message' informing the user that TIMER has completed." - (message "%s" (tmr--long-description-for-completed-timer timer))) +(defun tmr-print-message-for-finished-timer (timer) + "Show a `message' informing the user that TIMER has finished." + (message "%s" (tmr--long-description-for-finished-timer timer))) (defun tmr-print-message-for-cancelled-timer (timer) "Show a `message' informing the user that TIMER is cancelled." @@ -356,10 +356,10 @@ If optional DEFAULT is provided use it as a default candidate." 'tmr-description-history default)) (defun tmr--complete (timer) - "Mark TIMER as completed and execute `tmr-timer-completed-functions'." - (setf (tmr--timer-donep timer) t) + "Mark TIMER as finished and execute `tmr-timer-finished-functions'." + (setf (tmr--timer-finishedp timer) t) (run-hooks 'tmr--update-hook) - (run-hook-with-args 'tmr-timer-completed-functions timer)) + (run-hook-with-args 'tmr-timer-finished-functions timer)) ;;;###autoload (defun tmr (time &optional description)