mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-01-03 15:21:41 +01:00
emacs: Fix search refresh when on the last line of a search buffer.
We currently allow the cursor to be positioned on the "End of search results" line after the last thread in a search buffer. When refreshing on this line, there's no thread ID to be used as the target. Previously, a refresh from this case would result in a nil thread target, but we were also using nil to indicate that the target thread had been found. This caused the position to be lost during refresh, (the cursor would move from the last line in the buffer to the first). We fix this by using a magic string of "found" rather than nil to clearly indicate whether the target thread has actually been found.
This commit is contained in:
parent
70ef8de798
commit
bb61755afe
1 changed files with 3 additions and 4 deletions
|
@ -1482,7 +1482,7 @@ This function advances the next thread when finished."
|
||||||
(insert (format " (process returned %d)" exit-status)))
|
(insert (format " (process returned %d)" exit-status)))
|
||||||
(insert "\n")
|
(insert "\n")
|
||||||
(if (and atbob
|
(if (and atbob
|
||||||
notmuch-search-target-thread)
|
(not (string= notmuch-search-target-thread "found")))
|
||||||
(set 'never-found-target-thread t))))))
|
(set 'never-found-target-thread t))))))
|
||||||
(if (and never-found-target-thread
|
(if (and never-found-target-thread
|
||||||
notmuch-search-target-line)
|
notmuch-search-target-line)
|
||||||
|
@ -1515,11 +1515,10 @@ This function advances the next thread when finished."
|
||||||
(put-text-property beg (point-marker) 'notmuch-search-thread-id thread-id)
|
(put-text-property beg (point-marker) 'notmuch-search-thread-id thread-id)
|
||||||
(put-text-property beg (point-marker) 'notmuch-search-authors authors)
|
(put-text-property beg (point-marker) 'notmuch-search-authors authors)
|
||||||
(put-text-property beg (point-marker) 'notmuch-search-subject subject)
|
(put-text-property beg (point-marker) 'notmuch-search-subject subject)
|
||||||
(if (and notmuch-search-target-thread
|
(if (string= thread-id notmuch-search-target-thread)
|
||||||
(string= thread-id notmuch-search-target-thread))
|
|
||||||
(progn
|
(progn
|
||||||
(set 'found-target beg)
|
(set 'found-target beg)
|
||||||
(set 'notmuch-search-target-thread nil))))
|
(set 'notmuch-search-target-thread "found"))))
|
||||||
(set 'line (match-end 0)))
|
(set 'line (match-end 0)))
|
||||||
(set 'more nil)))))
|
(set 'more nil)))))
|
||||||
(if found-target
|
(if found-target
|
||||||
|
|
Loading…
Reference in a new issue