* features: mark messages as read/unread
This commit is contained in:
@ -265,6 +265,9 @@ after the end of the search results."
|
|||||||
(define-key map (kbd "<delete>") 'mu4e-mark-for-delete)
|
(define-key map (kbd "<delete>") 'mu4e-mark-for-delete)
|
||||||
(define-key map "D" 'mu4e-mark-for-delete)
|
(define-key map "D" 'mu4e-mark-for-delete)
|
||||||
|
|
||||||
|
(define-key map "o" 'mu4e-mark-as-unread)
|
||||||
|
(define-key map "r" 'mu4e-mark-as-read)
|
||||||
|
|
||||||
(define-key map "j" 'mu4e-jump-to-maildir)
|
(define-key map "j" 'mu4e-jump-to-maildir)
|
||||||
(define-key map "m" 'mu4e-mark-for-move)
|
(define-key map "m" 'mu4e-mark-for-move)
|
||||||
|
|
||||||
@ -297,6 +300,10 @@ after the end of the search results."
|
|||||||
(define-key menumap [execute-marks] '("Execute marks" . mu4e-execute-marks))
|
(define-key menumap [execute-marks] '("Execute marks" . mu4e-execute-marks))
|
||||||
(define-key menumap [unmark-all] '("Unmark all" . mu4e-unmark-all))
|
(define-key menumap [unmark-all] '("Unmark all" . mu4e-unmark-all))
|
||||||
(define-key menumap [unmark] '("Unmark" . mu4e-unmark))
|
(define-key menumap [unmark] '("Unmark" . mu4e-unmark))
|
||||||
|
|
||||||
|
(define-key menumap [mark-as-read] '("Mark as read" . mu4e-mark-as-read))
|
||||||
|
(define-key menumap [mark-as-unread] '("Mark as unread" . mu4e-mark-as-unread))
|
||||||
|
|
||||||
(define-key menumap [mark-delete] '("Mark for deletion" . mu4e-mark-for-delete))
|
(define-key menumap [mark-delete] '("Mark for deletion" . mu4e-mark-for-delete))
|
||||||
(define-key menumap [mark-trash] '("Mark for trash" . mu4e-mark-for-trash))
|
(define-key menumap [mark-trash] '("Mark for trash" . mu4e-mark-for-trash))
|
||||||
(define-key menumap [mark-move] '("Mark for move" . mu4e-mark-for-move))
|
(define-key menumap [mark-move] '("Mark for move" . mu4e-mark-for-move))
|
||||||
@ -494,6 +501,8 @@ The following marks are available, and the corresponding props:
|
|||||||
`move' y move the message to some folder
|
`move' y move the message to some folder
|
||||||
`trash' n move the message to `mu4e-trash-folder'
|
`trash' n move the message to `mu4e-trash-folder'
|
||||||
`delete' n remove the message
|
`delete' n remove the message
|
||||||
|
`read' n mark the message as read
|
||||||
|
`unread' n mark the message as unread
|
||||||
`unmark' n unmark this message"
|
`unmark' n unmark this message"
|
||||||
(let* ((docid (mu4e-hdrs-get-docid))
|
(let* ((docid (mu4e-hdrs-get-docid))
|
||||||
(markkar
|
(markkar
|
||||||
@ -501,7 +510,8 @@ The following marks are available, and the corresponding props:
|
|||||||
('move "m")
|
('move "m")
|
||||||
('trash "d")
|
('trash "d")
|
||||||
('delete "D")
|
('delete "D")
|
||||||
('select "*")
|
('unread "U")
|
||||||
|
('read "R")
|
||||||
('unmark " ")
|
('unmark " ")
|
||||||
(t (error "Invalid mark %S" mark)))))
|
(t (error "Invalid mark %S" mark)))))
|
||||||
(unless docid (error "No message on this line"))
|
(unless docid (error "No message on this line"))
|
||||||
@ -560,14 +570,14 @@ work well."
|
|||||||
(lambda (docid val)
|
(lambda (docid val)
|
||||||
(let ((marker (nth 0 val)) (mark (nth 1 val)) (target (nth 2 val)))
|
(let ((marker (nth 0 val)) (mark (nth 1 val)) (target (nth 2 val)))
|
||||||
(case mark
|
(case mark
|
||||||
(move
|
(move (mu4e-proc-move-msg docid target))
|
||||||
(mu4e-proc-move-msg docid target))
|
(read (mu4e-proc-flag docid "+S-u-N"))
|
||||||
|
(unread (mu4e-proc-flag docid "-S+u"))
|
||||||
(trash
|
(trash
|
||||||
(unless mu4e-trash-folder
|
(unless mu4e-trash-folder
|
||||||
(error "`mu4e-trash-folder' not set"))
|
(error "`mu4e-trash-folder' not set"))
|
||||||
(mu4e-proc-move-msg docid mu4e-trash-folder "+T"))
|
(mu4e-proc-move-msg docid mu4e-trash-folder "+T"))
|
||||||
(delete
|
(delete (mu4e-proc-remove-msg docid)))))
|
||||||
(mu4e-proc-remove-msg docid)))))
|
|
||||||
mu4e-marks-map)
|
mu4e-marks-map)
|
||||||
(mu4e-hdrs-unmark-all)))
|
(mu4e-hdrs-unmark-all)))
|
||||||
|
|
||||||
@ -727,29 +737,37 @@ not provided, function asks for it."
|
|||||||
(mu4e-next-header)))))
|
(mu4e-next-header)))))
|
||||||
|
|
||||||
|
|
||||||
|
(defun mu4e-mark (mark)
|
||||||
|
"Mark message for MARK (trash, delete, read, unread, unmark)."
|
||||||
|
(with-current-buffer mu4e-hdrs-buffer
|
||||||
|
(mu4e-hdrs-mark mark)
|
||||||
|
(mu4e-next-header)))
|
||||||
|
|
||||||
(defun mu4e-mark-for-trash ()
|
(defun mu4e-mark-for-trash ()
|
||||||
"Mark message at point for moving to the trash
|
"Mark message at point for moving to the trash
|
||||||
folder (`mu4e-trash-folder')."
|
folder (`mu4e-trash-folder')."
|
||||||
(interactive)
|
(interactive)
|
||||||
(unless mu4e-trash-folder
|
(mu4e-mark 'trash))
|
||||||
(error "`mu4e-trash-folder' is not set"))
|
|
||||||
(with-current-buffer mu4e-hdrs-buffer
|
|
||||||
(mu4e-hdrs-mark 'trash)
|
|
||||||
(mu4e-next-header)))
|
|
||||||
|
|
||||||
(defun mu4e-mark-for-delete ()
|
(defun mu4e-mark-for-delete ()
|
||||||
"Mark message at point for direct deletion."
|
"Mark message at point for direct deletion."
|
||||||
(interactive)
|
(interactive)
|
||||||
(with-current-buffer mu4e-hdrs-buffer
|
(mu4e-mark 'delete))
|
||||||
(mu4e-hdrs-mark 'delete)
|
|
||||||
(mu4e-next-header)))
|
(defun mu4e-mark-as-read ()
|
||||||
|
"Mark message at point as unread."
|
||||||
|
(interactive)
|
||||||
|
(mu4e-mark 'read))
|
||||||
|
|
||||||
|
(defun mu4e-mark-as-unread ()
|
||||||
|
"Mark message at point as read."
|
||||||
|
(interactive)
|
||||||
|
(mu4e-mark 'unread))
|
||||||
|
|
||||||
(defun mu4e-unmark ()
|
(defun mu4e-unmark ()
|
||||||
"Unmark message at point."
|
"Unmark message at point."
|
||||||
(interactive)
|
(interactive)
|
||||||
(with-current-buffer mu4e-hdrs-buffer
|
(mu4e-mark 'unmark))
|
||||||
(mu4e-hdrs-mark 'unmark)
|
|
||||||
(mu4e-next-header)))
|
|
||||||
|
|
||||||
(defun mu4e-unmark-all ()
|
(defun mu4e-unmark-all ()
|
||||||
"Unmark all messages."
|
"Unmark all messages."
|
||||||
|
|||||||
@ -475,12 +475,9 @@ get_flags (const char *path, const char *flagstr)
|
|||||||
MuFlags oldflags;
|
MuFlags oldflags;
|
||||||
oldflags = mu_maildir_get_flags_from_path (path);
|
oldflags = mu_maildir_get_flags_from_path (path);
|
||||||
return mu_flags_from_str_delta (flagstr, oldflags,
|
return mu_flags_from_str_delta (flagstr, oldflags,
|
||||||
MU_FLAG_TYPE_MAILDIR|
|
MU_FLAG_TYPE_ANY);
|
||||||
MU_FLAG_TYPE_MAILFILE);
|
|
||||||
} else
|
} else
|
||||||
return mu_flags_from_str (flagstr,
|
return mu_flags_from_str (flagstr, MU_FLAG_TYPE_ANY);
|
||||||
MU_FLAG_TYPE_MAILDIR |
|
|
||||||
MU_FLAG_TYPE_MAILFILE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -806,8 +806,11 @@ mu_msg_move_to_maildir (MuMsg *self, const char *maildir,
|
|||||||
flags |= mu_msg_get_flags (self) &
|
flags |= mu_msg_get_flags (self) &
|
||||||
(MU_FLAG_HAS_ATTACH|MU_FLAG_ENCRYPTED|MU_FLAG_SIGNED);
|
(MU_FLAG_HAS_ATTACH|MU_FLAG_ENCRYPTED|MU_FLAG_SIGNED);
|
||||||
/* update the pseudo-flag as well */
|
/* update the pseudo-flag as well */
|
||||||
if (!(flags & MU_FLAG_NEW) || (flags & MU_FLAG_SEEN))
|
if (!(flags & MU_FLAG_NEW) && (flags & MU_FLAG_SEEN))
|
||||||
flags &= ~MU_FLAG_UNREAD;
|
flags &= ~MU_FLAG_UNREAD;
|
||||||
|
else
|
||||||
|
flags |= MU_FLAG_UNREAD;
|
||||||
|
|
||||||
mu_msg_cache_set_num (self->_cache, MU_MSG_FIELD_ID_FLAGS, flags);
|
mu_msg_cache_set_num (self->_cache, MU_MSG_FIELD_ID_FLAGS, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -717,7 +717,6 @@ mu_store_update_msg (MuStore *store, unsigned docid, MuMsg *msg, GError **err)
|
|||||||
if (!store->in_transaction())
|
if (!store->in_transaction())
|
||||||
store->begin_transaction();
|
store->begin_transaction();
|
||||||
|
|
||||||
|
|
||||||
const std::string term
|
const std::string term
|
||||||
(store->get_uid_term(mu_msg_get_path(msg)));
|
(store->get_uid_term(mu_msg_get_path(msg)));
|
||||||
doc.add_term (term);
|
doc.add_term (term);
|
||||||
|
|||||||
Reference in New Issue
Block a user