[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tmr 58d30c4896 12/14: Remove single line functions whic
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tmr 58d30c4896 12/14: Remove single line functions which were used only once |
Date: |
Mon, 27 Jun 2022 12:58:05 -0400 (EDT) |
branch: externals/tmr
commit 58d30c4896e14380c4c607669db9ca55728e36e4
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Remove single line functions which were used only once
---
tmr-tabulated.el | 2 +-
tmr.el | 32 ++++++++++----------------------
2 files changed, 11 insertions(+), 23 deletions(-)
diff --git a/tmr-tabulated.el b/tmr-tabulated.el
index def3cf274b..4f30eab513 100644
--- a/tmr-tabulated.el
+++ b/tmr-tabulated.el
@@ -138,7 +138,7 @@ Point isn't moved if point is on the only entry."
(defun tmr-tabulated--get-timer-at-point ()
"Return the timer on the current line or nil."
- (tmr--get-timer-by-creation-date (tabulated-list-get-id)))
+ (cl-find (tabulated-list-get-id) tmr--timers :key
#'tmr--timer-creation-date))
(defun tmr-tabulated--refresh ()
"Refresh *tmr-tabulated-view* buffer if it exists."
diff --git a/tmr.el b/tmr.el
index f5413248f1..9860df9ec0 100644
--- a/tmr.el
+++ b/tmr.el
@@ -193,17 +193,6 @@ Populated by `tmr' and then operated on by `tmr-cancel'.")
(defvar tmr--update-hook nil
"Hooks to execute when timers are changed.")
-(defun tmr--active-timers ()
- "Retun list of active timers."
- (cl-remove-if
- (lambda (timer)
- (tmr--timer-donep timer))
- tmr--timers))
-
-(defun tmr--get-timer-by-creation-date (creation-date)
- "Return the timer which was started at CREATION-DATE."
- (cl-find creation-date tmr--timers :key #'tmr--timer-creation-date))
-
;;;###autoload
(defun tmr-cancel (timer)
"Cancel TIMER object set with `tmr' command.
@@ -255,17 +244,16 @@ that are still running.
If optional DESCRIPTION is provided use it to format the
completion candidates."
- (let ((timers (if active (tmr--active-timers) tmr--timers)))
- (cond
- ((null timers)
- (user-error "No timers available"))
- ((= (length timers) 1)
- (car timers))
- ((> (length timers) 1)
- (let* ((formatter (or description #'tmr--long-description))
- (timer-descriptions (mapcar formatter timers))
- (selection (completing-read "Timer: " timer-descriptions nil t)))
- (cl-find selection timers :test #'string= :key formatter))))))
+ (pcase (if active
+ (cl-remove-if #'tmr--timer-donep tmr--timers)
+ tmr--timers)
+ ('nil (user-error "No timers available"))
+ (`(,timer) timer)
+ (_
+ (let* ((formatter (or description #'tmr--long-description))
+ (timer-descriptions (mapcar formatter timers))
+ (selection (completing-read "Timer: " timer-descriptions nil t)))
+ (cl-find selection timers :test #'string= :key formatter)))))
;; NOTE 2022-04-21: Emacs has a `play-sound' function but it only
;; supports .wav and .au formats. Also, it does not work on all
- [elpa] externals/tmr updated (704242b6ba -> 907756ce8d), ELPA Syncer, 2022/06/27
- [elpa] externals/tmr bdd99767bb 03/14: Add tmr-tabulated--refresh, ELPA Syncer, 2022/06/27
- [elpa] externals/tmr 38c9089597 08/14: tmr-remove-finished: Add autoload, ELPA Syncer, 2022/06/27
- [elpa] externals/tmr 9f0dee563b 06/14: Move tmr-sound.el back into tmr.el, ELPA Syncer, 2022/06/27
- [elpa] externals/tmr cfd798b066 11/14: Add tmr-reschedule and tmr-edit-description, ELPA Syncer, 2022/06/27
- [elpa] externals/tmr 907756ce8d 14/14: Acknowledge Daniel Mendler for the latest patches, ELPA Syncer, 2022/06/27
- [elpa] externals/tmr 448be30775 09/14: Improve tmr-clone: Only prompt for description if pressing C-u C-u, ELPA Syncer, 2022/06/27
- [elpa] externals/tmr 6f3b096f2c 13/14: Greatly simplify tmr-tabulated, reuse tmr--read-timer, ELPA Syncer, 2022/06/27
- [elpa] externals/tmr 58d30c4896 12/14: Remove single line functions which were used only once,
ELPA Syncer <=
- [elpa] externals/tmr 58224191d0 01/14: Rename struct tmr-timer to tmr--timer, ELPA Syncer, 2022/06/27
- [elpa] externals/tmr e18496d187 07/14: Add tmr--update-hook, ELPA Syncer, 2022/06/27
- [elpa] externals/tmr e9c6c8861f 02/14: Get rid of tmr-descriptions-list, ELPA Syncer, 2022/06/27
- [elpa] externals/tmr 9974a28933 04/14: Remove unnecessary declare-function, ELPA Syncer, 2022/06/27
- [elpa] externals/tmr d6d5e4d22d 05/14: Warn if dbus is unavailable, ELPA Syncer, 2022/06/27
- [elpa] externals/tmr 92d6163dd0 10/14: Remove no-hooks argument, ELPA Syncer, 2022/06/27