]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch.el
notmuch.el: Fix notmuch-search-goto-last-thread.
[notmuch] / notmuch.el
index ddfcdc2aad2c9cb7c613d9ee0940b6ad77d17c74..439a975fadca06464407b213f814e094efe10281 100644 (file)
@@ -789,10 +789,15 @@ which this thread was originally shown."
 
 (defun notmuch-substitute-one-command-key (binding)
   "For a key binding, return a string showing a human-readable representation
-of the key as well as the first line of documentation from the bound function."
-  (concat (format-kbd-macro (vector (car binding)))
-         "\t"
-         (notmuch-documentation-first-line (cdr binding))))
+of the key as well as the first line of documentation from the bound function.
+
+For a mouse binding, return nil."
+  (let ((key (car binding)))
+    (if (mouse-event-p key)
+       nil
+      (concat (format-kbd-macro (vector key))
+             "\t"
+             (notmuch-documentation-first-line (cdr binding))))))
 
 (defun notmuch-substitute-command-keys (doc)
   "Like `substitute-command-keys' but with documentation, not function names."
@@ -939,11 +944,11 @@ thread from that buffer can be show when done with this one)."
     (define-key map "=" 'notmuch-search-refresh-view)
     (define-key map "t" 'notmuch-search-filter-by-tag)
     (define-key map "f" 'notmuch-search-filter)
+    (define-key map [mouse-1] 'notmuch-search-show-thread)
     (define-key map "*" 'notmuch-search-operate-all)
     (define-key map "a" 'notmuch-search-archive-thread)
     (define-key map "-" 'notmuch-search-remove-tag)
     (define-key map "+" 'notmuch-search-add-tag)
-    (define-key map [mouse-1] 'notmuch-search-show-thread)
     (define-key map (kbd "RET") 'notmuch-search-show-thread)
     map)
   "Keymap for \"notmuch search\" buffers.")
@@ -972,15 +977,15 @@ thread from that buffer can be show when done with this one)."
   ; directly to that position. (We have to count lines since the
   ; window-start position is not the same as point-min due to the
   ; invisible thread-ID characters on the first line.
-  (if (equal (count-lines (point-min) (window-start)) 1)
-      (goto-char (window-start))
+  (if (equal (count-lines (point-min) (window-start)) 0)
+      (goto-char (point-min))
     (scroll-down nil)))
 
 (defun notmuch-search-goto-last-thread ()
   "Move point to the last thread in the buffer."
   (interactive)
   (goto-char (point-max))
-  (forward-line -1))
+  (forward-line -2))
 
 (defface notmuch-tag-face
   '((((class color)