Preventing the user shooting themself in the foot

Jameson Graef Rollins jrollins at finestructure.net
Wed Jun 29 13:37:21 PDT 2011


On Wed, 29 Jun 2011 20:42:01 +0100, Robin Green <greenrd at greenrd.org> wrote:
> It's really dangerous to use the 'a' key in notmuch-mode in an inbox
> thread which has multiple unread replies! Yes, the other unread replies
> will still be tagged unread, but the user might not immediately be aware
> of them. It would be really useful to have an optional warning ("More
> unread messages in this thread, are you sure?") for this situation!

I think that's a bit extreme, but I agree that the default behavior of
the emacs key bindings are not good, particularly in regards to
archiving messages.

I should probably just send in all of my emacs UI tweaks as patches, but
here are a couple of functions/bindings I've added to my .emacs to make
the message processing more sane.  The main new function is
notmuch-show-next-open-message-or-pop, which will jump to the next
message in the thread, or pop out of the thread if you're on the last
message.  I then use this in my tag processing functions, such as
archiving and deleting.

hth.

jamie.


(defun notmuch-show-next-open-message-or-pop ()
  "Show the next message or pop to parent search."
  (interactive)
  (let (r)
    (while (and (setq r (notmuch-show-goto-message-next))
		(not (notmuch-show-message-visible-p))))
    (if r
	(progn
	  (notmuch-show-mark-read)
	  (notmuch-show-message-adjust))
      (let ((parent-buffer notmuch-show-parent-buffer))
	(if parent-buffer
	    (progn
	      (kill-this-buffer)
	      (switch-to-buffer parent-buffer)
	      (forward-line 1)))))))

(define-key notmuch-show-mode-map "a"
  (lambda ()
    "Archive current message and advance."
    (interactive)
    (notmuch-show-remove-tag "inbox")
    (notmuch-show-next-open-message-or-pop)))

(define-key notmuch-show-mode-map "d"
  (lambda ()
    "Delete current message and advance to next message."
    (interactive)
    (notmuch-show-add-tag "delete")
    (notmuch-show-next-open-message-or-pop)))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20110629/fc70ca80/attachment.pgp>


More information about the notmuch mailing list