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

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

[elpa] externals/notmuch-indicator f5c9b2ee4f 1/4: Add action to search


From: ELPA Syncer
Subject: [elpa] externals/notmuch-indicator f5c9b2ee4f 1/4: Add action to search for the terms with mouse-1
Date: Wed, 28 Sep 2022 13:57:50 -0400 (EDT)

branch: externals/notmuch-indicator
commit f5c9b2ee4f6dab35186f5fb67b58d1c48f32634f
Author: Henrik Kjerringvåg <henrik@kjerringvag.no>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Add action to search for the terms with mouse-1
---
 notmuch-indicator.el | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/notmuch-indicator.el b/notmuch-indicator.el
index 57a9d8fd6b..89e93054ee 100644
--- a/notmuch-indicator.el
+++ b/notmuch-indicator.el
@@ -166,11 +166,17 @@ option `notmuch-indicator-refresh-count'."
    (shell-command-to-string
     (format "notmuch count %s" terms))))
 
-(defun notmuch-indicator--format-label (label count face)
-  "Format LABEL, COUNT, FACE of `notmuch-indicator-args'."
-  (if (and face label)
-      (format "%s%s " (propertize label 'face face) count)
-    (format "%s%s " (or label "") count)))
+(defun notmuch-indicator--format-label (label count face terms)
+  "Format LABEL, COUNT, FACE and TERMS of `notmuch-indicator-args'."
+  (let ((map (make-sparse-keymap)))
+    (define-key map [mode-line mouse-1]
+                (lambda () (interactive) (notmuch-search terms)))
+    (propertize
+     (if (and face label)
+         (format "%s%s " (propertize label 'face face) count)
+       (format "%s%s " (or label "") count))
+     'help-echo "mouse-1: Open notmuch search"
+     'local-map map)))
 
 (defun notmuch-indicator--format-output (properties)
   "Format PROPERTIES of `notmuch-indicator-args'."
@@ -181,7 +187,8 @@ option `notmuch-indicator-refresh-count'."
       (notmuch-indicator--format-label
        (plist-get properties :label)
        count
-       (plist-get properties :face)))))
+       (plist-get properties :face)
+       (plist-get properties :terms)))))
 
 (defun notmuch-indicator--return-count ()
   "Parse `notmuch-indicator-args' and format them as single string."



reply via email to

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