Dangerous space bar key (was: Preventing the user shooting themself in the foot)

Jameson Graef Rollins jrollins at finestructure.net
Mon Jul 4 17:03:51 PDT 2011


On Mon, 04 Jul 2011 23:36:35 +0200, Matthieu Lemerre <racin at free.fr> wrote:
> I like to use the space (and sometimes the backspace key) to read
> threads back and forth, but sometimes I might read stuff to quickly and
> archive a thread without wanting it. It is then complex to find it back
> (especially if the thread contained a single message and I hit space
> before actually reading the message, so I can't find it again).
> 
> As a workaround, I have changed the space key function
> "notmuch-show-advance-and-archive" to not archive the thread if we are
> at the end of the thread, but to just do nothing. Thus I have to
> expicitely archive the thread when I have finished reading it, which I
> find much safer.

I completely agree with your discomfort with the current function bound
to space.  I don't like it at all, and I similarly rebound space to be a
much more sensible function:

(defun notmuch-show-advance ()
  "Advance through messages in a thread."
  (interactive)
  (let ((end-of-this-message (notmuch-show-message-bottom)))
    (cond
     ;; Ideally we would test `end-of-this-message' against the result
     ;; of `window-end', but that doesn't account for the fact that
     ;; the end of the message might be hidden, so we have to actually
     ;; go to the end, walk back over invisible text and then see if
     ;; point is visible.
     ((save-excursion
	(goto-char (- end-of-this-message 1))
	(notmuch-show-move-past-invisible-backward)
	(> (point) (window-end)))
      ;; The bottom of this message is not visible - scroll.
      (scroll-up nil))
     ((not (= end-of-this-message (point-max)))
      ;; This is not the last message - move to the next visible one.
      (notmuch-show-next-open-message))
     )))

Notice I also made it so that this does not exit the current thread
view.

jamie.
-------------- 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/20110704/37570c25/attachment-0001.pgp>


More information about the notmuch mailing list