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

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

[elpa] externals/tmr b1aa243d90 1/7: Fix completion table, handle null c


From: ELPA Syncer
Subject: [elpa] externals/tmr b1aa243d90 1/7: Fix completion table, handle null completion
Date: Wed, 29 Jun 2022 07:58:00 -0400 (EDT)

branch: externals/tmr
commit b1aa243d907090b2ea028a4fb50f0aed43ab2df5
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Fix completion table, handle null completion
---
 tmr.el | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/tmr.el b/tmr.el
index 0626c9acd9..c70c0ea025 100644
--- a/tmr.el
+++ b/tmr.el
@@ -291,7 +291,8 @@ that are still running."
                              timer-list 'tmr-timer #'tmr--timer-annotation)
                             nil t)
                            timer-list))))
-        (and selected (get-text-property 0 'tmr-timer selected)))))))
+        (or (and selected (get-text-property 0 'tmr-timer selected))
+            (user-error "No timer selected")))))))
 
 ;; 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
@@ -431,14 +432,17 @@ Without a PROMPT, clone TIMER outright."
        (tmr--description-prompt (tmr--timer-description timer))
      (tmr--timer-description timer))))
 
-(defun tmr--completion-table (candidates &optional category)
-  "Return completion table for CANDIDATES of CATEGORY with sorting disabled."
-  (lambda (str pred action)
-    (if (eq action 'metadata)
-        `(metadata (display-sort-function . identity)
-                   (cycle-sort-function . identity)
-                   (category . ,category))
-      (complete-with-action action candidates str pred))))
+(defun tmr--completion-table (candidates &optional category annotation)
+  "Make completion table for CANDIDATES with sorting disabled.
+CATEGORY is the completion category.
+ANNOTATION is an annotation function."
+   (lambda (str pred action)
+     (if (eq action 'metadata)
+         `(metadata (display-sort-function . identity)
+                    (cycle-sort-function . identity)
+                   (annotation-function . ,annotation)
+                    (category . ,category))
+       (complete-with-action action candidates str pred))))
 
 (provide 'tmr)
 ;;; tmr.el ends here



reply via email to

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