mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
emacs: Display any unexpected output from notmuch search
Rather than silently swallowing unexpected output, the emacs interface will now
display it. This will allow error messages to actually arrive at the emacs
interface (though not in an especially pretty way). This also allows for easier
investigation of the inadvertent swallowing of search results that span page
boundaries (as demonstrated by the recent added emacs-large-search-buffer test).
The page-boundary bug has been present since a commit from 2009-11-24:
93af7b5745
Many thanks to Thomas Schwinge for tracking that bug down and
contributing the test for it.
This commit is contained in:
parent
4e414e2a5a
commit
44d3c57e2a
2 changed files with 11 additions and 2 deletions
|
@ -747,6 +747,8 @@ non-authors is found, assume that all of the authors match."
|
||||||
(more t)
|
(more t)
|
||||||
(inhibit-read-only t))
|
(inhibit-read-only t))
|
||||||
(while more
|
(while more
|
||||||
|
(while (and (< line (length string)) (= (elt string line) ?\n))
|
||||||
|
(setq line (1+ line)))
|
||||||
(if (string-match "^\\(thread:[0-9A-Fa-f]*\\) \\([^][]*\\) \\(\\[[0-9/]*\\]\\) \\([^;]*\\); \\(.*\\) (\\([^()]*\\))$" string line)
|
(if (string-match "^\\(thread:[0-9A-Fa-f]*\\) \\([^][]*\\) \\(\\[[0-9/]*\\]\\) \\([^;]*\\); \\(.*\\) (\\([^()]*\\))$" string line)
|
||||||
(let* ((thread-id (match-string 1 string))
|
(let* ((thread-id (match-string 1 string))
|
||||||
(date (match-string 2 string))
|
(date (match-string 2 string))
|
||||||
|
@ -756,6 +758,8 @@ non-authors is found, assume that all of the authors match."
|
||||||
(tags (match-string 6 string))
|
(tags (match-string 6 string))
|
||||||
(tag-list (if tags (save-match-data (split-string tags)))))
|
(tag-list (if tags (save-match-data (split-string tags)))))
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
|
(if (/= (match-beginning 1) line)
|
||||||
|
(insert (concat "Error: Unexpected output from notmuch search:\n" (substring string line (match-beginning 1)) "\n")))
|
||||||
(let ((beg (point-marker)))
|
(let ((beg (point-marker)))
|
||||||
(notmuch-search-show-result date count authors subject tags)
|
(notmuch-search-show-result date count authors subject tags)
|
||||||
(notmuch-search-color-line beg (point-marker) tag-list)
|
(notmuch-search-color-line beg (point-marker) tag-list)
|
||||||
|
@ -767,7 +771,12 @@ non-authors is found, assume that all of the authors match."
|
||||||
(set 'found-target beg)
|
(set 'found-target beg)
|
||||||
(set 'notmuch-search-target-thread "found"))))
|
(set 'notmuch-search-target-thread "found"))))
|
||||||
(set 'line (match-end 0)))
|
(set 'line (match-end 0)))
|
||||||
(set 'more nil)))))
|
(set 'more nil)
|
||||||
|
(while (and (< line (length string)) (= (elt string line) ?\n))
|
||||||
|
(setq line (1+ line)))
|
||||||
|
(if (< line (length string))
|
||||||
|
(insert (concat "Error: Unexpected output from notmuch search:\n" (substring string line) "\n")))
|
||||||
|
))))
|
||||||
(if found-target
|
(if found-target
|
||||||
(goto-char found-target)))
|
(goto-char found-target)))
|
||||||
(delete-process proc))))
|
(delete-process proc))))
|
||||||
|
|
|
@ -21,7 +21,7 @@ notmuch new > /dev/null
|
||||||
test_begin_subtest 'Comparing emacs result to "notmuch search"'
|
test_begin_subtest 'Comparing emacs result to "notmuch search"'
|
||||||
expected="$(notmuch search '*' | sed -e 's/^thread:[0-9a-f]* //' -e 's/;//' -e 's/xx*/[BLOB]/')
|
expected="$(notmuch search '*' | sed -e 's/^thread:[0-9a-f]* //' -e 's/;//' -e 's/xx*/[BLOB]/')
|
||||||
End of search results."
|
End of search results."
|
||||||
output=$(test_emacs '(notmuch-search "*") (notmuch-test-wait) (message (buffer-string))' 2>&1 | sed -e s', *, ,g' -e 's/xx*/[BLOB]/')
|
output=$(test_emacs '(notmuch-search "*") (notmuch-test-wait) (message (buffer-string))' 2>&1 | sed -e s', *, ,g' -e 's/xxx*/[BLOB]/g')
|
||||||
test_expect_equal "$output" "$expected"
|
test_expect_equal "$output" "$expected"
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
Loading…
Reference in a new issue