(forward-line)))
(message-mode))
-(defun notmuch-toggle-invisible-action (cite-button)
- (let ((invis-spec (button-get cite-button 'invisibility-spec)))
- (if (invisible-p invis-spec)
- (remove-from-invisibility-spec invis-spec)
- (add-to-invisibility-spec invis-spec)
- ))
- (force-window-update)
- (redisplay t))
-
-(define-button-type 'notmuch-button-citation-toggle-type 'help-echo "mouse-1, RET: Show citation"
- :supertype 'notmuch-button-invisibility-toggle-type)
-(define-button-type 'notmuch-button-signature-toggle-type 'help-echo "mouse-1, RET: Show signature"
- :supertype 'notmuch-button-invisibility-toggle-type)
-(define-button-type 'notmuch-button-body-toggle-type
- 'help-echo "mouse-1, RET: Show message"
- 'face 'notmuch-message-summary-face
- :supertype 'notmuch-button-invisibility-toggle-type)
-
-(defun notmuch-fontify-headers ()
- (while (looking-at "[[:space:]]")
- (forward-char))
- (if (looking-at "[Tt]o:")
- (progn
- (overlay-put (make-overlay (point) (re-search-forward ":"))
- 'face 'message-header-name)
- (overlay-put (make-overlay (point) (re-search-forward ".*$"))
- 'face 'message-header-to))
- (if (looking-at "[B]?[Cc][Cc]:")
- (progn
- (overlay-put (make-overlay (point) (re-search-forward ":"))
- 'face 'message-header-name)
- (overlay-put (make-overlay (point) (re-search-forward ".*$"))
- 'face 'message-header-cc))
- (if (looking-at "[Ss]ubject:")
- (progn
- (overlay-put (make-overlay (point) (re-search-forward ":"))
- 'face 'message-header-name)
- (overlay-put (make-overlay (point) (re-search-forward ".*$"))
- 'face 'message-header-subject))
- (if (looking-at "[Ff]rom:")
- (progn
- (overlay-put (make-overlay (point) (re-search-forward ":"))
- 'face 'message-header-name)
- (overlay-put (make-overlay (point) (re-search-forward ".*$"))
- 'face 'message-header-other))
- (if (looking-at "[Dd]ate:")
- (progn
- (overlay-put (make-overlay (point) (re-search-forward ":"))
- 'face 'message-header-name)
- (overlay-put (make-overlay (point) (re-search-forward ".*$"))
- 'face 'message-header-other))))))))
-
(defun notmuch-documentation-first-line (symbol)
"Return the first line of the documentation string for SYMBOL."
(let ((doc (documentation symbol)))
"Notmuch mail reader for Emacs."
:group 'mail)
-(defcustom notmuch-search-hook nil
+(defcustom notmuch-search-hook '(hl-line-mode)
"List of functions to call when notmuch displays the search results."
:type 'hook
:options '(hl-line-mode)
(define-key map "-" 'notmuch-search-remove-tag)
(define-key map "+" 'notmuch-search-add-tag)
(define-key map (kbd "RET") 'notmuch-search-show-thread)
- (define-key map "F" 'notmuch-folder)
map)
"Keymap for \"notmuch search\" buffers.")
(fset 'notmuch-search-mode-map notmuch-search-mode-map)
(defun notmuch-search-properties-in-region (property beg end)
(save-excursion
(let ((output nil)
- (last-line (line-number-at-pos end)))
+ (last-line (line-number-at-pos end))
+ (max-line (- (line-number-at-pos (point-max)) 2)))
(goto-char beg)
(beginning-of-line)
- (while (<= (line-number-at-pos) last-line)
+ (while (<= (line-number-at-pos) (min last-line max-line))
(setq output (cons (get-text-property (point) property) output))
(forward-line 1))
output)))
"Display the currently selected thread."
(interactive)
(let ((thread-id (notmuch-search-find-thread-id))
- (subject (notmuch-search-find-subject))
- buffer-name)
- (when (string-match "^[ \t]*$" subject)
- (setq subject "[No Subject]"))
- (setq buffer-name (concat "*"
- (truncate-string-to-width subject 32 nil nil t)
- "*"))
+ (subject (notmuch-search-find-subject)))
(if (> (length thread-id) 0)
(notmuch-show thread-id
(current-buffer)
notmuch-search-query-string
- buffer-name)
+ ;; name the buffer based on notmuch-search-find-subject
+ (if (string-match "^[ \t]*$" subject)
+ "[No Subject]"
+ (truncate-string-to-width
+ (concat "*"
+ (truncate-string-to-width subject 32 nil nil t)
+ "*")
+ 32 nil nil t)))
(error "End of search results"))))
(defun notmuch-search-reply-to-thread ()
(defun notmuch-search-get-tags-region (beg end)
(save-excursion
(let ((output nil)
- (last-line (line-number-at-pos end)))
+ (last-line (line-number-at-pos end))
+ (max-line (- (line-number-at-pos (point-max)) 2)))
(goto-char beg)
- (while (<= (line-number-at-pos) last-line)
+ (while (<= (line-number-at-pos) (min last-line max-line))
(setq output (append output (notmuch-search-get-tags)))
(forward-line 1))
output)))
(defun notmuch-search-add-tag-thread (tag)
- (notmuch-call-notmuch-process "tag" (concat "+" tag) (notmuch-search-find-thread-id))
- (notmuch-search-set-tags (delete-dups (sort (cons tag (notmuch-search-get-tags)) 'string<))))
+ (notmuch-search-add-tag-region tag (point) (point)))
(defun notmuch-search-add-tag-region (tag beg end)
(let ((search-id-string (mapconcat 'identity (notmuch-search-find-thread-id-region beg end) " or ")))
(notmuch-call-notmuch-process "tag" (concat "+" tag) search-id-string)
(save-excursion
- (let ((last-line (line-number-at-pos end)))
+ (let ((last-line (line-number-at-pos end))
+ (max-line (- (line-number-at-pos (point-max)) 2)))
(goto-char beg)
- (while (<= (line-number-at-pos) last-line)
+ (while (<= (line-number-at-pos) (min last-line max-line))
(notmuch-search-set-tags (delete-dups (sort (cons tag (notmuch-search-get-tags)) 'string<)))
(forward-line))))))
(defun notmuch-search-remove-tag-thread (tag)
- (notmuch-call-notmuch-process "tag" (concat "-" tag) (notmuch-search-find-thread-id))
- (notmuch-search-set-tags (delete tag (notmuch-search-get-tags))))
+ (notmuch-search-remove-tag-region tag (point) (point)))
(defun notmuch-search-remove-tag-region (tag beg end)
(let ((search-id-string (mapconcat 'identity (notmuch-search-find-thread-id-region beg end) " or ")))
(notmuch-call-notmuch-process "tag" (concat "-" tag) search-id-string)
(save-excursion
- (let ((last-line (line-number-at-pos end)))
+ (let ((last-line (line-number-at-pos end))
+ (max-line (- (line-number-at-pos (point-max)) 2)))
(goto-char beg)
- (while (<= (line-number-at-pos) last-line)
+ (while (<= (line-number-at-pos) (min last-line max-line))
(notmuch-search-set-tags (delete tag (notmuch-search-get-tags)))
(forward-line))))))
-
(defun notmuch-search-add-tag (tag)
"Add a tag to the currently selected thread or region.
-The tag is added to messages in the currently selected thread or
-region which match the current search terms."
+The tag is added to all messages in the currently selected thread
+or threads in the current region."
(interactive
(list (notmuch-select-tag-with-completion "Tag to add: ")))
(save-excursion
(defun notmuch-search-remove-tag (tag)
"Remove a tag from the currently selected thread or region.
-The tag is removed from all messages in the currently selected thread
-or region which match the current search terms."
+The tag is removed from all messages in the currently selected
+thread or threads in the current region."
(interactive
(list (notmuch-select-tag-with-completion
"Tag to remove: "
Runs a new search matching only messages that match both the
current search results AND the additional query string provided."
(interactive "sFilter search: ")
- (let ((grouped-query (if (string-match-p notmuch-search-disjunctive-regexp query) (concat "( " query " )") query)))
- (notmuch-search (concat notmuch-search-query-string " and " grouped-query) notmuch-search-oldest-first)))
+ (let ((grouped-query (if (string-match-p notmuch-search-disjunctive-regexp query)
+ (concat "( " query " )")
+ query)))
+ (notmuch-search (if (string= notmuch-search-query-string "*")
+ grouped-query
+ (concat notmuch-search-query-string " and " grouped-query)) notmuch-search-oldest-first)))
(defun notmuch-search-filter-by-tag (tag)
"Filter the current search results based on a single tag.