Rudolf Adamkovič Personal site


Configuration: Fix initial cursor position

Position the cursor on the first saved search.

(with-eval-after-load 'notmuch
  (defun notmuch-hello-move-point-to-first-search+ ()
    (interactive)
    (let ((first-search-name (plist-get (car notmuch-saved-searches) :name))
          (first-widget (progn (widget-forward 1) (widget-at))))
      (while (not (equal (widget-text (widget-at)) first-search-name))
        (widget-forward 1)
        (when (equal (widget-at) first-widget)
          (user-error "Button not found: %s" first-search-name))))))
(with-eval-after-load 'notmuch
  (add-hook 'notmuch-hello-refresh-hook
            (lambda ()
              (when (bobp)
                (notmuch-hello-move-point-to-first-search+)))))

© 2025 Rudolf Adamkovič under GNU General Public License version 3.
Made with Emacs and secret alien technologies of yesteryear.