summaryrefslogtreecommitdiffhomepage
path: root/custom/jao-custom-notmuch.el
diff options
context:
space:
mode:
Diffstat (limited to 'custom/jao-custom-notmuch.el')
-rw-r--r--custom/jao-custom-notmuch.el30
1 files changed, 12 insertions, 18 deletions
diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el
index f7996ac..c2f6a85 100644
--- a/custom/jao-custom-notmuch.el
+++ b/custom/jao-custom-notmuch.el
@@ -16,18 +16,18 @@
(:name "l" :query "tag:new and tag:local")
(:name "f" :query "tag:new and tag:feeds and not tag:\"/emacs/\"")))
-(defsubst jao-notmuch--qstr (c)
- (format "%s%s" (plist-get c :name) (plist-get c :count)))
-
(defvar jao-notmuch-mac-mail-badge nil
"Name of Mac mail app showing, besides emacs")
(defvar jao-notmuch-mac-hammerspoon (jao-is-darwin))
(defun jao-notmuch-hammerspoon ()
(jao-when-darwin
- (let* ((s (substring-no-properties jao-notmuch-minibuffer-string))
- (s (string-replace " " "%20" s)))
- (jao-mac-open "-g hammerspoon://menu?message=%s" s))))
+ (let ((s (substring-no-properties jao-notmuch-minibuffer-string)))
+ (jao-mac-open "-g hammerspoon://menu?message=%s" (url-hexify-string s)))))
+
+(defun jao-notmuch--qstr (c)
+ (propertize (format "%s%s" (plist-get c :name) (plist-get c :count))
+ 'face (or (plist-get c :face) 'jao-themes-dimm)))
(defun jao-notmuch-notify ()
(interactive)
@@ -36,14 +36,8 @@
(when jao-notmuch-mac-mail-badge
(jao-mac-app-badge jao-notmuch-mac-mail-badge))
0))
- (cnts (if (> (or mc 0) 0) (cons `(:name "" :count ,mc) cnts) cnts)))
- (setq jao-notmuch-minibuffer-string
- (mapconcat (lambda (c)
- (propertize (jao-notmuch--qstr c)
- 'face
- (or (plist-get c :face) 'jao-themes-dimm)))
- cnts
- " "))
+ (cnts (if mc (cons `(:name "" :count ,(format "[%s]" mc)) cnts) cnts)))
+ (setq jao-notmuch-minibuffer-string (mapconcat #'jao-notmuch--qstr cnts " "))
(when jao-notmuch-mac-hammerspoon (jao-notmuch-hammerspoon))
(jao-minibuffer-refresh)))
@@ -91,7 +85,7 @@
(defun jao-notmuch-tree-widen-search ()
(interactive)
- (when-let ((query (notmuch-tree-get-query)))
+ (when-let* ((query (notmuch-tree-get-query)))
(let ((notmuch-show-process-crypto (notmuch-tree--message-process-crypto)))
(notmuch-tree-close-message-window)
(notmuch-tree (string-replace jao-notmuch--newa "" query)))))
@@ -105,7 +99,7 @@
(mapcar (lambda (s) (jao-notmuch--widen s extra)) searches))
(defun jao-notmuch-hello--insert-searches (searches title)
- (when-let (searches (notmuch-hello-query-counts searches))
+ (when-let* ((searches (notmuch-hello-query-counts searches)))
(let* ((cnt (when title
(seq-reduce (lambda (c q)
(+ c (or (plist-get q :count) 0)))
@@ -414,7 +408,7 @@
(if (not (search-forward "Enclosure:" nil t))
(user-error "No enclosure in message body")
(re-search-forward "https?://" nil t)
- (if-let (url (thing-at-point-url-at-point))
+ (if-let* ((url (thing-at-point-url-at-point)))
(progn
(message "%s %s ..." (if add "Adding" "Playing") url)
(unless add (jao-mpc-clear))
@@ -433,7 +427,7 @@
"Planet Scheme: ")))
(defun jao-mail-clean-address (args)
- (when-let ((address (car args)))
+ (when-let* ((address (car args)))
(list (thread-last (replace-regexp-in-string jao-mail-clean-rx "" address)
(replace-regexp-in-string " " ", ")))))