X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=emacs%2Fnotmuch.el;h=178dea212817a7fe3d3ee93aa804c8d0bcc5f1bc;hp=64f3e3da8edcf0d8222d8466472905aa22d6fbb9;hb=2fbb6d05a931b23c307aee3af05ab488c6bca425;hpb=4c9585933ee1adf03dc0153f5a7d55bcd205d245 diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 64f3e3da..178dea21 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -399,10 +399,11 @@ Complete list of currently available key bindings: (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))) @@ -497,9 +498,10 @@ and will also appear in a buffer named \"*Notmuch errors*\"." (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))) @@ -512,9 +514,10 @@ and will also appear in a buffer named \"*Notmuch errors*\"." (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)))))) @@ -526,18 +529,18 @@ and will also appear in a buffer named \"*Notmuch errors*\"." (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 @@ -550,8 +553,8 @@ region which match the current search terms." (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: "