From cb90a203a7967b99032cd806f685419d4d0e2cd9 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 14 Jan 2025 09:42:04 +1100 Subject: [emacs] Add timer to save score in emms Also add isearch to common packages, so that search-whitespace-regexp takes effect in the emms profile --- emacs/.emacs.d/lisp/my/my-package.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'emacs/.emacs.d/lisp') diff --git a/emacs/.emacs.d/lisp/my/my-package.el b/emacs/.emacs.d/lisp/my/my-package.el index b591d0f..9eefa2e 100644 --- a/emacs/.emacs.d/lisp/my/my-package.el +++ b/emacs/.emacs.d/lisp/my/my-package.el @@ -216,6 +216,17 @@ same name, cancel that one first." (cancel-timer ,var-name)) (setq ,var-name (run-with-timer ,secs ,repeat ,function)))) +(defmacro my-timer (var-name secs repeat function) + "Create a timer. + +The timer has name VAR-NAME. If there is an existing time with the +same name, cancel that one first." + + `(progn + (when (and (boundp ',var-name) (timerp ,var-name)) + (cancel-timer ,var-name)) + (setq ,var-name (run-with-timer ,secs ,repeat ,function)))) + (defun my-describe-package-from-url (url) (interactive "sUrl: ") (when (string-match @@ -263,7 +274,7 @@ same name, cancel that one first." (add-hook hook function))) (defvar my-common-packages - '(package windmove consult icomplete + '(package windmove consult icomplete isearch my-utils my-buffer my-editing my-complete) "Common packages to include with any profile") -- cgit v1.2.3