[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/theme-buffet 9b866c9eb4 10/12: Improved theme-buffet--d
From: |
ELPA Syncer |
Subject: |
[elpa] externals/theme-buffet 9b866c9eb4 10/12: Improved theme-buffet--define-timer macro. |
Date: |
Fri, 24 Nov 2023 15:58:49 -0500 (EST) |
branch: externals/theme-buffet
commit 9b866c9eb4650d6ebd63a1289d251bd5d875659f
Author: bboal <egomet@bboal.com>
Commit: bboal <egomet@bboal.com>
Improved theme-buffet--define-timer macro.
---
theme-buffet.el | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/theme-buffet.el b/theme-buffet.el
index 79195adb6e..5bcb4383af 100644
--- a/theme-buffet.el
+++ b/theme-buffet.el
@@ -351,38 +351,38 @@ An error message will appear if the theme is not
available to load through
(when-let (((boundp timer-obj))
(obj (symbol-value timer-obj)))
(cancel-timer obj)
- (set timer-obj nil)))
+ (set timer-obj nil)
+ (message "Break time in the Theme-Buffet kitchen!")))
-(defmacro theme-buffet--define-timer(units)
+(defmacro theme-buffet--define-timer (units)
"Define interactive functions to set timer in UNITS.
UNITS is an unquoted symbol, mins or hours and refers to timer of the same
naming."
(let ((fn-name (intern (format "theme-buffet-timer-%s" units)))
- (factor (pcase units
- ('mins 60)
- ('hours 3600)
- (_ (user-error
- "Bad `units' arg on `theme-buffet--define-timer %s'"
units)))))
+ factor max-num)
+ (pcase units
+ ('mins (setq factor 60 max-num 180))
+ ('hours (setq factor 3600 max-num 12))
+ (_ (user-error
+ "Bad `units' arg on `theme-buffet--define-timer %s'" units)))
`(defun ,fn-name (number)
- ,(format "Set interactively the timer for NUMBER of %s." units)
+ ,(format "Set interactively the timer for NUMBER of %s.
+When NUMBER is 0, the timer is cancelled. Maximum value is %s" units max-num)
(interactive
- (list (read-number ,(format "Theme Buffet service in how many %s? "
units)
- nil
+ (list (read-number ,(format "Theme Buffet service in how many %s? "
units) nil
'theme-buffet-user-timers-history)))
(if-let (((natnump number))
- (max-num ,(if (eq units 'mins) 180 12))
- (min-num ,(if (eq units 'mins) 1 -12))
- ((and (>= number min-num)
- (<= number max-num)))
+ ((<= number ,max-num))
(timer-secs (* ,factor number)))
- (progn
+ (if (equal number 0)
+ (theme-buffet--free-timer ',fn-name)
(setq ,fn-name (run-at-time timer-secs timer-secs
#'theme-buffet--load-random
(theme-buffet--get-period-keyword)))
(message "Theme-Buffet Sous-Chef is rushing into the kitchen..."))
- (user-error "The input number should be a natural between %s and %s
instead of `%s'"
- min-num max-num number)))))
+ (user-error "The input number should be a natural up to %s instead of
`%s'"
+ ,max-num number)))))
;;;###autoload (autoload 'theme-buffet-timer-mins "theme-buffet")
(theme-buffet--define-timer mins) ; (theme-buffet-timer-mins n)
- [elpa] externals/theme-buffet 753800bb0e 06/12: More semantic and whitespace fix, (continued)
- [elpa] externals/theme-buffet 753800bb0e 06/12: More semantic and whitespace fix, ELPA Syncer, 2023/11/24
- [elpa] externals/theme-buffet 756a5f67c5 05/12: Whitespace cleanup and added double space on sentence end., ELPA Syncer, 2023/11/24
- [elpa] externals/theme-buffet 524a2eabbb 04/12: Reviewed some suggestions from Philip Kaludercic, ELPA Syncer, 2023/11/24
- [elpa] externals/theme-buffet e412016226 09/12: Corrected functions docstrings, ELPA Syncer, 2023/11/24
- [elpa] externals/theme-buffet 4e9a20f00a 03/12: Added README.md for short explanation of the package, ELPA Syncer, 2023/11/24
- [elpa] externals/theme-buffet ca58fb481a 02/12: Adding COPYING file for licensing purposes, ELPA Syncer, 2023/11/24
- [elpa] externals/theme-buffet 6b2d2dbba2 08/12: Remove period from user-error in `theme-buffet--define-timer' macro., ELPA Syncer, 2023/11/24
- [elpa] externals/theme-buffet dfcb3c5093 12/12: Added "Usage" heading in "Commentary" section, ELPA Syncer, 2023/11/24
- [elpa] externals/theme-buffet 3c049e1672 11/12: Improved messaging in `theme-buffet--reload-theme' function., ELPA Syncer, 2023/11/24
- [elpa] externals/theme-buffet 96f123f44b 07/12: Refactor `theme-buffet--define-timer', ELPA Syncer, 2023/11/24
- [elpa] externals/theme-buffet 9b866c9eb4 10/12: Improved theme-buffet--define-timer macro.,
ELPA Syncer <=