diff options
| author | David Bremner <david@tethera.net> | 2025-03-13 20:51:12 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2025-03-13 20:51:12 -0300 |
| commit | 190e958d17b9cf3704c61e73994ba9e6aac95205 (patch) | |
| tree | a1d72ab1d2af49c8a6925e993289f948bb515781 | |
| parent | 9cb99b9de5d106239c40dede1ada2cbe7b808eb9 (diff) | |
| parent | d4e36a2df66868b921c49d1545f9f096b64459e1 (diff) | |
Merge branch 'release'
| -rw-r--r-- | debian/changelog | 7 | ||||
| -rwxr-xr-x | debian/rules | 2 | ||||
| -rw-r--r-- | emacs/notmuch-tree.el | 10 | ||||
| -rw-r--r-- | emacs/notmuch.el | 18 | ||||
| -rwxr-xr-x | test/T312-emacs-hl-line.sh | 160 |
5 files changed, 192 insertions, 5 deletions
diff --git a/debian/changelog b/debian/changelog index 8fa45de8..4cdbaebd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +notmuch (0.39~rc2-2) experimental; urgency=medium + + * Increase test timeout to 10m (per test script). This is currently + only needed for riscv64, but should be harmless elsewhere. + + -- David Bremner <bremner@debian.org> Tue, 11 Mar 2025 19:39:27 -0300 + notmuch (0.39~rc2-1) experimental; urgency=medium * New upstream pre-release diff --git a/debian/rules b/debian/rules index ef52a71c..4e0836e7 100755 --- a/debian/rules +++ b/debian/rules @@ -2,7 +2,7 @@ include /usr/share/dpkg/architecture.mk export NOTMUCH_SKIP_TESTS = T810-tsan - +export NOTMUCH_TEST_TIMEOUT = 10m export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 2332f020..301ffd6e 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -1091,7 +1091,8 @@ Complete list of currently available key bindings: \\{notmuch-tree-mode-map}" (setq notmuch-buffer-refresh-function #'notmuch-tree-refresh-view) - (hl-line-mode 1) + (when notmuch-hl-line + (hl-line-mode 1)) (setq buffer-read-only t) (setq truncate-lines t) (when notmuch-tree-outline-enabled (notmuch-tree-outline-mode 1))) @@ -1121,6 +1122,8 @@ object, and with the tree results buffer as the current buffer.") (unless (= exit-status 0) (insert (format " (process returned %d)" exit-status))) (insert "\n")))) + (when (and notmuch-hl-line (= exit-status 0)) + (notmuch-hl-line-mode)) (run-hook-with-args 'notmuch-tree-process-exit-functions proc)))))) (defun notmuch-tree-process-filter (proc string) @@ -1136,7 +1139,10 @@ object, and with the tree results buffer as the current buffer.") (goto-char (point-max)) (insert string)) (notmuch-sexp-parse-partial-list 'notmuch-tree-insert-forest-thread - results-buf))))) + results-buf)) + (with-current-buffer results-buf + (when notmuch-hl-line + (notmuch-hl-line-mode)))))) (defun notmuch-tree-worker (basic-query &optional query-context target open-target unthreaded oldest-first diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 2a73ffa5..5477bf4a 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -126,13 +126,17 @@ there will be called at other points of notmuch execution." :type 'file :group 'notmuch) -(defcustom notmuch-search-hook '(notmuch-hl-line-mode) +(defcustom notmuch-search-hook nil "List of functions to call when notmuch displays the search results." :type 'hook - :options '(notmuch-hl-line-mode) :group 'notmuch-search :group 'notmuch-hooks) +(defcustom notmuch-hl-line t + "Use hl-line-mode to highlight current thread / message" + :type 'boolean + :group 'notmuch) + ;;; Mime Utilities (defun notmuch-foreach-mime-part (function mm-handle) @@ -925,6 +929,16 @@ sets the :orig-tag property." (notmuch-sexp-parse-partial-list 'notmuch-search-append-result results-buf)) (with-current-buffer results-buf + (when (and notmuch-hl-line + ;; If we know where the cursor will end up (from + ;; the call to notmuch-search), avoid redrawing the + ;; hl-line overlay until the buffer is sufficiently + ;; filled. This check is intended as an + ;; optimization to reduce flicker. + (>= + (line-number-at-pos (point-max) t) + (or notmuch-search-target-line -1))) + (notmuch-hl-line-mode)) (notmuch--search-hook-wrapper))))) ;;; Commands (and some helper functions used by them) diff --git a/test/T312-emacs-hl-line.sh b/test/T312-emacs-hl-line.sh new file mode 100755 index 00000000..3402811c --- /dev/null +++ b/test/T312-emacs-hl-line.sh @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +test_description="emacs hl-line-mode" +. $(dirname "$0")/test-lib.sh || exit 1 +. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1 + +EXPECTED=$NOTMUCH_SRCDIR/test/emacs.expected-output + +test_require_emacs +add_email_corpus + +test_begin_subtest "line 1, search" +test_emacs_expect_t '(let ((notmuch-hl-line t)) + (notmuch-search "tag:inbox") + (notmuch-test-wait) + (notmuch-test-expect-equal + (let ((start (overlay-start hl-line-overlay)) + (end (overlay-end hl-line-overlay))) + (list start (> end start))) + (list 1 t)))' + +test_begin_subtest "line 1, tree" +test_emacs_expect_t '(let ((notmuch-hl-line t)) + (notmuch-tree "tag:inbox") + (notmuch-test-wait) + (notmuch-test-expect-equal + (let ((start (overlay-start hl-line-overlay)) + (end (overlay-end hl-line-overlay))) + (list start (> end start))) + (list 1 t)))' + +test_begin_subtest "line 1, unthreaded" +test_emacs_expect_t '(let ((notmuch-hl-line t)) + (notmuch-tree "tag:inbox") + (notmuch-test-wait) + (notmuch-test-expect-equal + (let ((start (overlay-start hl-line-overlay)) + (end (overlay-end hl-line-overlay))) + (list start (> end start))) + (list 1 t)))' + +test_begin_subtest "line 1, search, refresh" +test_emacs_expect_t '(let ((notmuch-hl-line t)) + (notmuch-search "tag:inbox") + (notmuch-test-wait) + (notmuch-refresh-this-buffer) + (notmuch-test-wait) + (notmuch-test-expect-equal (overlay-start hl-line-overlay) 1))' + +test_begin_subtest "line 1, tree, refresh" +test_emacs_expect_t '(let ((notmuch-hl-line t)) + (notmuch-tree "tag:inbox") + (notmuch-test-wait) + (notmuch-refresh-this-buffer) + (notmuch-test-wait) + (notmuch-test-expect-equal + (let ((start (overlay-start hl-line-overlay)) + (end (overlay-end hl-line-overlay))) + (list start (> end start))) + (list 1 t)))' + +test_begin_subtest "line 1, unthreaded, refresh" +test_emacs_expect_t '(let ((notmuch-hl-line t)) + (notmuch-tree "tag:inbox") + (notmuch-test-wait) + (notmuch-refresh-this-buffer) + (notmuch-test-wait) + (notmuch-test-expect-equal + (let ((start (overlay-start hl-line-overlay)) + (end (overlay-end hl-line-overlay))) + (list start (> end start))) + (list 1 t)))' + + +test_begin_subtest "line 12, notmuch-search" +test_emacs_expect_t '(let ((notmuch-hl-line t)) + (notmuch-search "tag:inbox") + (notmuch-test-wait) + (forward-line 11) + (notmuch-post-command) + (notmuch-test-expect-equal + (line-number-at-pos (overlay-start hl-line-overlay)) 12))' + +test_begin_subtest "line 12, tree" +test_emacs_expect_t '(let ((notmuch-hl-line t)) + (notmuch-tree "tag:inbox") + (notmuch-test-wait) + (forward-line 11) + (notmuch-post-command) + (notmuch-test-expect-equal + (line-number-at-pos (overlay-start hl-line-overlay)) 12))' + +test_begin_subtest "line 12, unthreaded" +test_emacs_expect_t '(let ((notmuch-hl-line t)) + (notmuch-unthreaded "tag:inbox") + (notmuch-test-wait) + (forward-line 11) + (notmuch-post-command) + (notmuch-test-expect-equal + (line-number-at-pos (overlay-start hl-line-overlay)) 12))' + +test_begin_subtest "line 12, search, refresh" +test_emacs_expect_t '(let ((notmuch-hl-line t)) + (notmuch-search "tag:inbox") + (notmuch-test-wait) + (forward-line 11) + (notmuch-post-command) + (notmuch-refresh-this-buffer) + (notmuch-test-wait) + (notmuch-test-expect-equal + (line-number-at-pos (overlay-start hl-line-overlay)) 12))' + +test_begin_subtest "line 12, tree, refresh" +test_emacs_expect_t '(let ((notmuch-hl-line t)) + (notmuch-tree "tag:inbox") + (notmuch-test-wait) + (forward-line 11) + (notmuch-post-command) + (notmuch-refresh-this-buffer) + (notmuch-test-wait) + (notmuch-test-expect-equal + (line-number-at-pos (overlay-start hl-line-overlay)) 12))' + +test_begin_subtest "line 12, unthreaded, refresh" +test_emacs_expect_t '(let ((notmuch-hl-line t)) + (notmuch-tree "tag:inbox") + (notmuch-test-wait) + (forward-line 11) + (notmuch-post-command) + (notmuch-refresh-this-buffer) + (notmuch-test-wait) + (notmuch-test-expect-equal + (line-number-at-pos (overlay-start hl-line-overlay)) 12))' + +test_begin_subtest "hl-line disabled, search" +test_emacs_expect_t '(let ((notmuch-hl-line nil)) + (notmuch-search "tag:inbox") + (notmuch-test-wait) + (notmuch-test-expect-equal + (or hl-line-mode hl-line-overlay) + nil))' + +test_begin_subtest "hl-line disabled, tree" +test_emacs_expect_t '(let ((notmuch-hl-line nil)) + (notmuch-tree "tag:inbox") + (notmuch-test-wait) + (notmuch-test-expect-equal + (or hl-line-mode hl-line-overlay) + nil))' + +test_begin_subtest "hl-line disabled, unthreaded" +test_emacs_expect_t '(let ((notmuch-hl-line nil)) + (notmuch-unthreaded "tag:inbox") + (notmuch-test-wait) + (notmuch-test-expect-equal + (or hl-line-mode hl-line-overlay) + nil))' + +test_done + |
