From 59a1f58695d09ab29ddf992b2c0711c94a4039ea Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 3 Jan 2023 23:03:03 -0600 Subject: Switch to use-package --- lisp/+notmuch.el | 52 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) (limited to 'lisp/+notmuch.el') diff --git a/lisp/+notmuch.el b/lisp/+notmuch.el index 74b9b77..5df6e5b 100644 --- a/lisp/+notmuch.el +++ b/lisp/+notmuch.el @@ -60,11 +60,11 @@ for search." 'notmuch-address-history))) (:else (defun notmuch-address-selection-function (prompt collection initial-input) - "Call (`completing-read' + "Call (`completing-read' PROMPT COLLECTION nil nil INITIAL-INPUT 'notmuch-address-history)" - (completing-read - prompt collection nil nil nil - 'notmuch-address-history))))) + (completing-read + prompt collection nil nil nil + 'notmuch-address-history))))) (defcustom +notmuch-spam-tags '("+spam" "+Spam") "A list of tag changes to apply when marking a thread as spam." @@ -101,5 +101,49 @@ This function advances the next thread when finished." (when (eq beg end) (notmuch-search-next-thread))) +(defun +notmuch-tree-beginning (&optional arg) + "Move point to beginning of message or tree, depending on ARG." + (interactive "P") + (cond + ((and (window-live-p notmuch-tree-message-window) + (not arg)) + (with-selected-window notmuch-tree-message-window + (beginning-of-buffer))) + (:else (beginning-of-buffer)))) + +(defun +notmuch-tree-end (&optional arg) + "Move point to end of message or tree, depending on ARG." + (interactive "P") + (cond + ((and (window-live-p notmuch-tree-message-window) + (not arg)) + (with-selected-window notmuch-tree-message-window + (end-of-buffer))) + (:else (end-of-buffer)))) + +(defun +notmuch-make-saved-search (name key search-type &rest queries) + "Wrapper to ease `notmuch-saved-searches' defining. +NAME, KEY, and SEARCH-TYPE are paired with the corresponding keywords in +`notmuch-saved-searches', which see. QUERIES are all concatenated together with +AND. If QUERIES is prepended with more keyword arguments, those are added to +the saved search as well." + (declare (indent 3)) + (let (extra-keywords) + (while (keywordp (car queries)) + (push (cadr queries) extra-keywords) + (push (car queries) extra-keywords) + (setf queries (cddr queries))) + (add-to-list 'notmuch-saved-searches + (append + (list :name name + :key key + :search-type search-type + :query (apply #'+notmuch-query-concat queries)) + (reverse extra-keywords)) + :append + (lambda (a b) + (equal (plist-get a :name) + (plist-get b :name)))))) + (provide '+notmuch) ;;; +notmuch.el ends here -- cgit 1.4.1-21-gabe81