+(defun notmuch-pick-goto-and-insert-msg (msg)
+ "Insert msg at the end of the buffer. Move point to msg if it is the target"
+ (save-excursion
+ (goto-char (point-max))
+ (notmuch-pick-insert-msg msg))
+ (let ((msg-id (notmuch-id-to-query (plist-get msg :id))))
+ (when (string= msg-id notmuch-pick-target-msg)
+ (setq notmuch-pick-target-msg "found")
+ (goto-char (point-max))
+ (forward-line -1))))
+