[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/notmuch-indicator f043b8a1e8 22/36: Abstract notmuch-in
From: |
ELPA Syncer |
Subject: |
[elpa] externals/notmuch-indicator f043b8a1e8 22/36: Abstract notmuch-indicator--format-output |
Date: |
Wed, 21 Sep 2022 00:59:21 -0400 (EDT) |
branch: externals/notmuch-indicator
commit f043b8a1e8f46f70285cf0d63d3299d71f0b4d15
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Abstract notmuch-indicator--format-output
---
notmuch-indicator.el | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/notmuch-indicator.el b/notmuch-indicator.el
index 89eb395967..f3404f05a8 100644
--- a/notmuch-indicator.el
+++ b/notmuch-indicator.el
@@ -138,12 +138,24 @@ option `notmuch-indicator-refresh-count'."
;;;; Helper functions and the minor-mode
+(defun notmuch-indicator--shell-command (terms)
+ "Run shell command for `notmuch-count(1)' with TERMS."
+ (replace-regexp-in-string
+ "\n" " "
+ (shell-command-to-string
+ (format "notmuch count %s" terms))))
+
+(defun notmuch-indicator--format-label (label count)
+ "Format LABEL and COUNT of `notmuch-indicator-args'."
+ (format "%s%s " (or label "") count))
+
(defun notmuch-indicator--format-output (properties)
"Format PROPERTIES of `notmuch-indicator-args'."
- (let ((count (shell-command-to-string (format "notmuch count %s" (plist-get
properties :terms)))))
- (if (and (zerop (string-to-number count))
notmuch-indicator-hide-empty-counters)
+ (let ((count (notmuch-indicator--shell-command (plist-get properties
:terms))))
+ (if (and (zerop (string-to-number count))
+ notmuch-indicator-hide-empty-counters)
""
- (format "%s%s " (or (plist-get properties :label) "")
(replace-regexp-in-string "\n" " " count)))))
+ (notmuch-indicator--format-label (plist-get properties :label) count))))
(defun notmuch-indicator--return-count ()
"Parse `notmuch-indicator-args' and format them as single string."
- [elpa] externals/notmuch-indicator b141304bcb 04/36: Add README, (continued)
- [elpa] externals/notmuch-indicator b141304bcb 04/36: Add README, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator d24ae8718a 14/36: Add outline headings, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator f716f06aea 11/36: Use ":label" instead of ":specifier", ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator e169f26958 19/36: Add notmuch-indicator-hide-empty-counters user option, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator b225981c47 20/36: Refine how spacing is done, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator 45120219c4 23/36: Tweak spacing in two defcustom, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator 55a759133d 02/36: Tweak notmuch-indicator-args, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator 9a536bf3be 08/36: Add :group to notmuch-indicator-refresh-count, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator 2b390022ad 09/36: BREAKING make notmuch-indicator-args use plists, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator d2edfafc38 15/36: Add user option to update indicator post-command, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator f043b8a1e8 22/36: Abstract notmuch-indicator--format-output,
ELPA Syncer <=
- [elpa] externals/notmuch-indicator c9b7b8c229 26/36: The package is no longer a work-in-progress, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator 62ca2dd0bb 31/36: Refine notmuch-indicator-force-refresh-commands :type, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator 6f881fe3c2 32/36: Tweak THE most important part of the package, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator 251323c938 12/36: Update notmuch-indicator-refresh-count doc string, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator c97a631740 13/36: Update notmuch-indicator-mode doc string, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator 598dedf992 18/36: Add docs to the Commentary, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator c06c876e74 21/36: Improve one-line description, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator bfb48f7773 28/36: Accept :face in notmuch-indicator-args, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator 58633d173a 33/36: Add mailing list to package headers, ELPA Syncer, 2022/09/21
- [elpa] externals/notmuch-indicator 9611974047 35/36: Add backronym in the Commentary, ELPA Syncer, 2022/09/21