:group 'notmuch)
(defvar notmuch-query-history nil
- "Variable to store minibuffer history for notmuch queries")
+ "Variable to store minibuffer history for notmuch queries.")
(defun notmuch-foreach-mime-part (function mm-handle)
(cond ((stringp (car mm-handle))
(define-key map "q" 'notmuch-stash-query)
(define-key map "?" 'notmuch-subkeymap-help)
map)
- "Submap for stash commands")
+ "Submap for stash commands.")
(fset 'notmuch-search-stash-map notmuch-search-stash-map)
(defun notmuch-search-stash-thread-id ()
The returned point will be just after the newline character that
ends the result line. If there is no thread at POS (or point),
-returns nil"
+returns nil."
(when (notmuch-search-get-result pos)
(next-single-property-change (or pos (point)) 'notmuch-search-result
nil (point-max))))
output))
(defun notmuch-search-find-thread-id (&optional bare)
- "Return the thread for the current thread
+ "Return the thread for the current thread.
-If BARE is set then do not prefix with \"thread:\""
+If BARE is set then do not prefix with \"thread:\"."
(let ((thread (plist-get (notmuch-search-get-result) :thread)))
(when thread (concat (unless bare "thread:") thread))))
(concat "(" (mapconcat 'identity query-list ") or (") ")"))))
(defun notmuch-search-find-authors ()
- "Return the authors for the current thread"
+ "Return the authors for the current thread."
(plist-get (notmuch-search-get-result) :authors))
(defun notmuch-search-find-authors-region (beg end)
- "Return a list of authors for the current region"
+ "Return a list of authors for the current region."
(notmuch-search-properties-in-region :authors beg end))
(defun notmuch-search-find-subject ()
- "Return the subject for the current thread"
+ "Return the subject for the current thread."
(plist-get (notmuch-search-get-result) :subject))
(defun notmuch-search-find-subject-region (beg end)
- "Return a list of authors for the current region"
+ "Return a list of authors for the current region."
(notmuch-search-properties-in-region :subject beg end))
(defun notmuch-search-show-thread (&optional elide-toggle)
(current-buffer)
notmuch-search-query-string
;; Name the buffer based on the subject.
- (concat "*" (truncate-string-to-width subject 30 nil nil t) "*"))
+ (concat "*"
+ (truncate-string-to-width subject 30 nil nil t)
+ "*"))
(message "End of search results."))))
(defun notmuch-tree-from-search-current-query ()
- "Call notmuch tree with the current query"
+ "Call notmuch tree with the current query."
(interactive)
(notmuch-tree notmuch-search-query-string))
(defun notmuch-unthreaded-from-search-current-query ()
- "Call notmuch tree with the current query"
+ "Call notmuch tree with the current query."
(interactive)
(notmuch-unthreaded notmuch-search-query-string))
(defun notmuch-tree-from-search-thread ()
- "Show the selected thread with notmuch-tree"
+ "Show the selected thread with notmuch-tree."
(interactive)
(notmuch-tree (notmuch-search-find-thread-id)
- notmuch-search-query-string
+ notmuch-search-query-string
nil
- (notmuch-prettify-subject (notmuch-search-find-subject))
+ (notmuch-prettify-subject (notmuch-search-find-subject))
t))
(defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
(goto-char new-point)))))
(defun notmuch-search-process-sentinel (proc msg)
- "Add a message to let user know when \"notmuch search\" exits"
+ "Add a message to let user know when \"notmuch search\" exits."
(let ((buffer (process-buffer proc))
(status (process-status proc))
(exit-status (process-exit-status proc))
;; If there is any invisible text, add it as a tooltip to the
;; visible text.
(when (not (string= invisible-string ""))
- (setq visible-string (propertize visible-string 'help-echo (concat "..." invisible-string))))
+ (setq visible-string
+ (propertize visible-string
+ 'help-echo (concat "..." invisible-string))))
;; Insert the visible and, if present, invisible author strings.
(insert visible-string)
(goto-char pos))))
(defun notmuch-search-process-filter (proc string)
- "Process and filter the output of \"notmuch search\""
+ "Process and filter the output of \"notmuch search\"."
(let ((results-buf (process-buffer proc))
(parse-buf (process-get proc 'parse-buf))
(inhibit-read-only t)
(longest-length 0))
(cl-loop for tuple in notmuch-saved-searches
if (let ((quoted-query
- (regexp-quote (notmuch-saved-search-get tuple :query))))
+ (regexp-quote
+ (notmuch-saved-search-get tuple :query))))
(and (string-match (concat "^" quoted-query) query)
(> (length (match-string 0 query))
longest-length)))
(concat "*notmuch-saved-search-" saved-search-name "*"))
(saved-search
(concat "*notmuch-search-"
- (replace-regexp-in-string (concat "^" (regexp-quote saved-search-query))
- (concat "[ " saved-search-name " ]")
- query)
+ (replace-regexp-in-string
+ (concat "^" (regexp-quote saved-search-query))
+ (concat "[ " saved-search-name " ]")
+ query)
"*"))
(t
(concat "*notmuch-search-" query "*"))
"subject:" "attachment:")
(mapcar (lambda (tag) (concat "tag:" tag)) all-tags)
(mapcar (lambda (tag) (concat "is:" tag)) all-tags)
- (mapcar (lambda (mimetype) (concat "mimetype:" mimetype)) (mailcap-mime-types)))))
+ (mapcar (lambda (mimetype) (concat "mimetype:" mimetype))
+ (mailcap-mime-types)))))
(let ((keymap (copy-keymap minibuffer-local-map))
(current-query (cl-case major-mode
(notmuch-search-mode (notmuch-search-get-query))
'notmuch-search-history current-query nil)))))
(defun notmuch-search-get-query ()
- "Return the current query in this search buffer"
+ "Return the current query in this search buffer."
notmuch-search-query-string)
(put 'notmuch-search 'notmuch-doc "Search for messages.")
(if no-display
(set-buffer buffer)
(switch-to-buffer buffer))
- (notmuch-search-mode)
+ ;; avoid wiping out third party buffer-local variables in the case
+ ;; where we're just refreshing or changing the sort order of an
+ ;; existing search results buffer
+ (unless (eq major-mode 'notmuch-search-mode)
+ (notmuch-search-mode))
;; Don't track undo information for this buffer
(set 'buffer-undo-list t)
(set 'notmuch-search-query-string query)
Runs a new search matching only messages that match both the
current search results AND that are tagged with the given tag."
(interactive
- (list (notmuch-select-tag-with-completion "Filter by tag: " notmuch-search-query-string)))
- (notmuch-search (concat notmuch-search-query-string " and tag:" tag) notmuch-search-oldest-first))
+ (list (notmuch-select-tag-with-completion "Filter by tag: "
+ notmuch-search-query-string)))
+ (notmuch-search (concat notmuch-search-query-string " and tag:" tag)
+ notmuch-search-oldest-first))
(defun notmuch-search-by-tag (tag)
"Display threads matching TAG in a notmuch-search buffer."