From d3aa6848da4519f6229426b1d0432afacf748f8b Mon Sep 17 00:00:00 2001 From: Dmitry Kurochkin Date: Fri, 20 Jan 2012 00:52:14 +0100 Subject: emacs: add invisible dot instead of space at the end of notmuch-hello search box This makes `show-trailing-whitespace' happy, i.e. it does not mark the whole search box line as trailing spaces. Since the dot is invisible, this change makes no visible difference for `notmuch-hello'. Edited-by: Pieter Praet to fix the tests. --- test/emacs.expected-output/notmuch-hello | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/emacs.expected-output/notmuch-hello') diff --git a/test/emacs.expected-output/notmuch-hello b/test/emacs.expected-output/notmuch-hello index de57de2..196112e 100644 --- a/test/emacs.expected-output/notmuch-hello +++ b/test/emacs.expected-output/notmuch-hello @@ -4,7 +4,7 @@ Saved searches: [edit] 52 inbox 52 unread -Search: +Search: . [Show all tags] -- cgit v1.2.3 From 02d88159226b351091ae94e2176d2e59c79d21d3 Mon Sep 17 00:00:00 2001 From: Dmitry Kurochkin Date: Wed, 25 Jan 2012 05:10:52 +0400 Subject: emacs: bind "s" to `notmuch-search' in notmuch-hello buffer Before the change, "s" in notmuch-hello buffer would jump to the search box. The patch changes the binding to `notmuch-search' which is consistent with all other notmuch buffers. --- emacs/notmuch-hello.el | 19 ++++++------------- test/emacs.expected-output/notmuch-hello | 2 +- .../notmuch-hello-no-saved-searches | 2 +- test/emacs.expected-output/notmuch-hello-with-empty | 2 +- 4 files changed, 9 insertions(+), 16 deletions(-) (limited to 'test/emacs.expected-output/notmuch-hello') diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 63f2e07..d88a870 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -29,9 +29,6 @@ (declare-function notmuch-search "notmuch" (query &optional oldest-first target-thread target-line continuation)) (declare-function notmuch-poll "notmuch" ()) -(defvar notmuch-hello-search-bar-marker nil - "The position of the search bar within the notmuch-hello buffer.") - (defcustom notmuch-recent-searches-max 10 "The number of recent searches to store and display." :type 'integer @@ -324,11 +321,6 @@ should be. Returns a cons cell `(tags-per-line width)'." (widget-insert "\n")) found-target-pos)) -(defun notmuch-hello-goto-search () - "Put point inside the `search' widget." - (interactive) - (goto-char notmuch-hello-search-bar-marker)) - (defimage notmuch-hello-logo ((:type png :file "notmuch-logo.png"))) (defun notmuch-hello-search-continuation() @@ -358,7 +350,7 @@ should be. Returns a cons cell `(tags-per-line width)'." (define-key map "G" 'notmuch-hello-poll-and-update) (define-key map (kbd "") 'widget-backward) (define-key map "m" 'notmuch-mua-new-mail) - (define-key map "s" 'notmuch-hello-goto-search) + (define-key map "s" 'notmuch-search) map) "Keymap for \"notmuch hello\" buffers.") (fset 'notmuch-hello-mode-map notmuch-hello-mode-map) @@ -471,7 +463,8 @@ Complete list of currently available key bindings: (widget-insert " messages.\n")) (let ((found-target-pos nil) - (final-target-pos nil)) + (final-target-pos nil) + (search-bar-pos)) (let* ((saved-alist ;; Filter out empty saved searches if required. (if notmuch-show-empty-saved-searches @@ -503,7 +496,7 @@ Complete list of currently available key bindings: (indent-rigidly start (point) notmuch-hello-indent))) (widget-insert "\nSearch: ") - (setq notmuch-hello-search-bar-marker (point-marker)) + (setq search-bar-pos (point-marker)) (widget-create 'editable-field ;; Leave some space at the start and end of the ;; search boxes. @@ -595,7 +588,7 @@ Complete list of currently available key bindings: (when notmuch-saved-searches (widget-insert "Edit saved searches with the `edit' button.\n")) (widget-insert "Hit RET or click on a saved search or tag name to view matching threads.\n") - (widget-insert "`=' refreshes this screen. `s' jumps to the search box. `q' to quit.\n") + (widget-insert "`=' refreshes this screen. `s' to search messages. `q' to quit.\n") (let ((fill-column (- (window-width) notmuch-hello-indent))) (center-region start (point)))) @@ -607,7 +600,7 @@ Complete list of currently available key bindings: (widget-forward 1))) (unless (widget-at) - (notmuch-hello-goto-search)))) + (goto-char search-bar-pos)))) (run-hooks 'notmuch-hello-refresh-hook)) diff --git a/test/emacs.expected-output/notmuch-hello b/test/emacs.expected-output/notmuch-hello index 196112e..c43ab8c 100644 --- a/test/emacs.expected-output/notmuch-hello +++ b/test/emacs.expected-output/notmuch-hello @@ -11,4 +11,4 @@ Search: . Type a search query and hit RET to view matching threads. Edit saved searches with the `edit' button. Hit RET or click on a saved search or tag name to view matching threads. - `=' refreshes this screen. `s' jumps to the search box. `q' to quit. + `=' refreshes this screen. `s' to search messages. `q' to quit. diff --git a/test/emacs.expected-output/notmuch-hello-no-saved-searches b/test/emacs.expected-output/notmuch-hello-no-saved-searches index f4cfe49..080a56b 100644 --- a/test/emacs.expected-output/notmuch-hello-no-saved-searches +++ b/test/emacs.expected-output/notmuch-hello-no-saved-searches @@ -7,4 +7,4 @@ Search: . Type a search query and hit RET to view matching threads. Edit saved searches with the `edit' button. Hit RET or click on a saved search or tag name to view matching threads. - `=' refreshes this screen. `s' jumps to the search box. `q' to quit. + `=' refreshes this screen. `s' to search messages. `q' to quit. diff --git a/test/emacs.expected-output/notmuch-hello-with-empty b/test/emacs.expected-output/notmuch-hello-with-empty index a860a72..a9e312c 100644 --- a/test/emacs.expected-output/notmuch-hello-with-empty +++ b/test/emacs.expected-output/notmuch-hello-with-empty @@ -11,4 +11,4 @@ Search: . Type a search query and hit RET to view matching threads. Edit saved searches with the `edit' button. Hit RET or click on a saved search or tag name to view matching threads. - `=' refreshes this screen. `s' jumps to the search box. `q' to quit. + `=' refreshes this screen. `s' to search messages. `q' to quit. -- cgit v1.2.3 From d0a048f8561f63de5e30cb23dec6b6facb79c851 Mon Sep 17 00:00:00 2001 From: Dmitry Kurochkin Date: Wed, 25 Jan 2012 22:24:56 +0400 Subject: emacs: polish notmuch-hello help text Make `=' binding description consistent with others. --- emacs/notmuch-hello.el | 2 +- test/emacs.expected-output/notmuch-hello | 2 +- test/emacs.expected-output/notmuch-hello-no-saved-searches | 2 +- test/emacs.expected-output/notmuch-hello-with-empty | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'test/emacs.expected-output/notmuch-hello') diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index ab65e36..d17a30f 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -580,7 +580,7 @@ Complete list of currently available key bindings: (when notmuch-saved-searches (widget-insert "Edit saved searches with the `edit' button.\n")) (widget-insert "Hit RET or click on a saved search or tag name to view matching threads.\n") - (widget-insert "`=' refreshes this screen. `s' to search messages. `q' to quit.\n") + (widget-insert "`=' to refresh this screen. `s' to search messages. `q' to quit.\n") (let ((fill-column (- (window-width) notmuch-hello-indent))) (center-region start (point)))) diff --git a/test/emacs.expected-output/notmuch-hello b/test/emacs.expected-output/notmuch-hello index c43ab8c..3e59595 100644 --- a/test/emacs.expected-output/notmuch-hello +++ b/test/emacs.expected-output/notmuch-hello @@ -11,4 +11,4 @@ Search: . Type a search query and hit RET to view matching threads. Edit saved searches with the `edit' button. Hit RET or click on a saved search or tag name to view matching threads. - `=' refreshes this screen. `s' to search messages. `q' to quit. + `=' to refresh this screen. `s' to search messages. `q' to quit. diff --git a/test/emacs.expected-output/notmuch-hello-no-saved-searches b/test/emacs.expected-output/notmuch-hello-no-saved-searches index 080a56b..ef0e5d0 100644 --- a/test/emacs.expected-output/notmuch-hello-no-saved-searches +++ b/test/emacs.expected-output/notmuch-hello-no-saved-searches @@ -7,4 +7,4 @@ Search: . Type a search query and hit RET to view matching threads. Edit saved searches with the `edit' button. Hit RET or click on a saved search or tag name to view matching threads. - `=' refreshes this screen. `s' to search messages. `q' to quit. + `=' to refresh this screen. `s' to search messages. `q' to quit. diff --git a/test/emacs.expected-output/notmuch-hello-with-empty b/test/emacs.expected-output/notmuch-hello-with-empty index a9e312c..71edba7 100644 --- a/test/emacs.expected-output/notmuch-hello-with-empty +++ b/test/emacs.expected-output/notmuch-hello-with-empty @@ -11,4 +11,4 @@ Search: . Type a search query and hit RET to view matching threads. Edit saved searches with the `edit' button. Hit RET or click on a saved search or tag name to view matching threads. - `=' refreshes this screen. `s' to search messages. `q' to quit. + `=' to refresh this screen. `s' to search messages. `q' to quit. -- cgit v1.2.3 From 6e25ea031fc43dd3a6a9ff00f33526fdd3abc92a Mon Sep 17 00:00:00 2001 From: Daniel Schoepe Date: Fri, 17 Feb 2012 18:48:08 +0400 Subject: emacs: Tests for user-defined sections A new file was added for notmuch-hello tests. --- test/emacs-hello | 47 ++++++++++++++++++++++ test/emacs.expected-output/notmuch-hello | 3 +- .../notmuch-hello-new-section | 4 ++ .../notmuch-hello-no-saved-searches | 3 +- .../notmuch-hello-section-counts | 5 +++ .../notmuch-hello-section-hidden-tag | 4 ++ .../notmuch-hello-section-with-empty | 4 ++ .../emacs.expected-output/notmuch-hello-with-empty | 3 +- test/notmuch-test | 1 + 9 files changed, 71 insertions(+), 3 deletions(-) create mode 100755 test/emacs-hello create mode 100644 test/emacs.expected-output/notmuch-hello-new-section create mode 100644 test/emacs.expected-output/notmuch-hello-section-counts create mode 100644 test/emacs.expected-output/notmuch-hello-section-hidden-tag create mode 100644 test/emacs.expected-output/notmuch-hello-section-with-empty (limited to 'test/emacs.expected-output/notmuch-hello') diff --git a/test/emacs-hello b/test/emacs-hello new file mode 100755 index 0000000..b235e3a --- /dev/null +++ b/test/emacs-hello @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +test_description="Testing emacs notmuch-hello view" +. test-lib.sh + +EXPECTED=$TEST_DIRECTORY/emacs.expected-output + +add_email_corpus + +test_begin_subtest "User-defined section with inbox tag" +test_emacs "(let ((notmuch-hello-sections + (list (lambda () (notmuch-hello-insert-searches + \"Test\" '((\"inbox\" . \"tag:inbox\"))))))) + (notmuch-hello) + (test-output))" +test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-new-section + +test_begin_subtest "User-defined section with empty, hidden entry" +test_emacs "(let ((notmuch-hello-sections + (list (lambda () (notmuch-hello-insert-searches + \"Test-with-empty\" + '((\"inbox\" . \"tag:inbox\") + (\"doesnotexist\" . \"tag:doesnotexist\")) + :hide-empty-searches t))))) + (notmuch-hello) + (test-output))" +test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-section-with-empty + +test_begin_subtest "User-defined section, unread tag filtered out" +test_emacs "(let ((notmuch-hello-sections + (list (lambda () (notmuch-hello-insert-tags-section + \"Test-with-filtered\" + :hide-tags '(\"unread\")))))) + (notmuch-hello) + (test-output))" +test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-section-hidden-tag + +test_begin_subtest "User-defined section, different query for counts" +test_emacs "(let ((notmuch-hello-sections + (list (lambda () (notmuch-hello-insert-tags-section + \"Test-with-counts\" + :filter-count \"tag:signed\"))))) + (notmuch-hello) + (test-output))" +test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-section-counts + +test_done diff --git a/test/emacs.expected-output/notmuch-hello b/test/emacs.expected-output/notmuch-hello index 3e59595..1470790 100644 --- a/test/emacs.expected-output/notmuch-hello +++ b/test/emacs.expected-output/notmuch-hello @@ -6,9 +6,10 @@ Saved searches: [edit] Search: . -[Show all tags] +All tags: [show] Type a search query and hit RET to view matching threads. Edit saved searches with the `edit' button. Hit RET or click on a saved search or tag name to view matching threads. `=' to refresh this screen. `s' to search messages. `q' to quit. + Customize this page. diff --git a/test/emacs.expected-output/notmuch-hello-new-section b/test/emacs.expected-output/notmuch-hello-new-section new file mode 100644 index 0000000..c64d712 --- /dev/null +++ b/test/emacs.expected-output/notmuch-hello-new-section @@ -0,0 +1,4 @@ +Test: [hide] + + 52 inbox + diff --git a/test/emacs.expected-output/notmuch-hello-no-saved-searches b/test/emacs.expected-output/notmuch-hello-no-saved-searches index ef0e5d0..05475b1 100644 --- a/test/emacs.expected-output/notmuch-hello-no-saved-searches +++ b/test/emacs.expected-output/notmuch-hello-no-saved-searches @@ -2,9 +2,10 @@ Search: . -[Show all tags] +All tags: [show] Type a search query and hit RET to view matching threads. Edit saved searches with the `edit' button. Hit RET or click on a saved search or tag name to view matching threads. `=' to refresh this screen. `s' to search messages. `q' to quit. + Customize this page. diff --git a/test/emacs.expected-output/notmuch-hello-section-counts b/test/emacs.expected-output/notmuch-hello-section-counts new file mode 100644 index 0000000..9d79659 --- /dev/null +++ b/test/emacs.expected-output/notmuch-hello-section-counts @@ -0,0 +1,5 @@ +Test-with-counts: [hide] + + 2 attachment 7 signed + 7 inbox 7 unread + diff --git a/test/emacs.expected-output/notmuch-hello-section-hidden-tag b/test/emacs.expected-output/notmuch-hello-section-hidden-tag new file mode 100644 index 0000000..3688e7c --- /dev/null +++ b/test/emacs.expected-output/notmuch-hello-section-hidden-tag @@ -0,0 +1,4 @@ +Test-with-filtered: [hide] + + 4 attachment 52 inbox 7 signed + diff --git a/test/emacs.expected-output/notmuch-hello-section-with-empty b/test/emacs.expected-output/notmuch-hello-section-with-empty new file mode 100644 index 0000000..8209fed --- /dev/null +++ b/test/emacs.expected-output/notmuch-hello-section-with-empty @@ -0,0 +1,4 @@ +Test-with-empty: [hide] + + 52 inbox + diff --git a/test/emacs.expected-output/notmuch-hello-with-empty b/test/emacs.expected-output/notmuch-hello-with-empty index 71edba7..5e53222 100644 --- a/test/emacs.expected-output/notmuch-hello-with-empty +++ b/test/emacs.expected-output/notmuch-hello-with-empty @@ -6,9 +6,10 @@ Saved searches: [edit] Search: . -[Show all tags] +All tags: [show] Type a search query and hit RET to view matching threads. Edit saved searches with the `edit' button. Hit RET or click on a saved search or tag name to view matching threads. `=' to refresh this screen. `s' to search messages. `q' to quit. + Customize this page. diff --git a/test/notmuch-test b/test/notmuch-test index e14d34e..f03b594 100755 --- a/test/notmuch-test +++ b/test/notmuch-test @@ -54,6 +54,7 @@ TESTS=" argument-parsing emacs-test-functions emacs-address-cleaning + emacs-hello emacs-show " TESTS=${NOTMUCH_TESTS:=$TESTS} -- cgit v1.2.3 From 6409a27b2c835223806e4b14cc219c927856c256 Mon Sep 17 00:00:00 2001 From: Dmitry Kurochkin Date: Sat, 10 Mar 2012 07:54:15 +0400 Subject: emacs: get rid of trailing spaces in notmuch-hello view This patch removes trailing spaces in notmuch-hello view. A side effect of this change is that tag/query buttons no longer include a space at the end. This means that pressing RET when the point is at the first character after the tag/query button no longer works (note that this is the standard behavior for buttons). We may change this behavior in the future (without adding trailing spaces back) if people would find this change inconvenient. --- emacs/notmuch-hello.el | 30 +++++++++------------- test/emacs | 2 +- test/emacs.expected-output/notmuch-hello | 2 +- .../emacs.expected-output/notmuch-hello-long-names | 6 ++--- .../notmuch-hello-new-section | 2 +- .../notmuch-hello-section-counts | 4 +-- .../notmuch-hello-section-hidden-tag | 2 +- .../notmuch-hello-section-with-empty | 2 +- .../emacs.expected-output/notmuch-hello-with-empty | 2 +- 9 files changed, 23 insertions(+), 29 deletions(-) (limited to 'test/emacs.expected-output/notmuch-hello') diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 6b4b2c1..71d37b8 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -429,7 +429,8 @@ Such a list can be computed with `notmuch-hello-query-counts'." (let* ((widest (notmuch-hello-longest-label searches)) (tags-and-width (notmuch-hello-tags-per-line widest)) (tags-per-line (car tags-and-width)) - (widest (cdr tags-and-width)) + (column-width (cdr tags-and-width)) + (column-indent 0) (count 0) (reordered-list (notmuch-hello-reflect searches tags-per-line)) ;; Hack the display of the buttons used. @@ -441,32 +442,25 @@ Such a list can be computed with `notmuch-hello-query-counts'." (mapc (lambda (elem) ;; (not elem) indicates an empty slot in the matrix. (when elem + (if (> column-indent 0) + (widget-insert (make-string column-indent ? ))) (let* ((name (first elem)) (query (second elem)) - (msg-count (third elem)) - (formatted-name (format "%s " name))) + (msg-count (third elem))) (widget-insert (format "%8s " (notmuch-hello-nice-number msg-count))) - (if (string= formatted-name notmuch-hello-target) + (if (string= name notmuch-hello-target) (setq found-target-pos (point-marker))) (widget-create 'push-button :notify #'notmuch-hello-widget-search :notmuch-search-terms query - formatted-name) - (unless (eq (% count tags-per-line) (1- tags-per-line)) - ;; If this is not the last tag on the line, insert - ;; enough space to consume the rest of the column. - ;; Because the button for the name is `(1+ (length - ;; name))' long (due to the trailing space) we can - ;; just insert `(- widest (length name))' spaces - the - ;; column separator is included in the button if - ;; `(equal widest (length name)'. - (widget-insert (make-string (max 0 - (- widest (length name))) - ? ))))) + name) + (setq column-indent + (1+ (max 0 (- column-width (length name))))))) (setq count (1+ count)) - (if (eq (% count tags-per-line) 0) - (widget-insert "\n"))) + (when (eq (% count tags-per-line) 0) + (setq column-indent 0) + (widget-insert "\n"))) reordered-list) ;; If the last line was not full (and hence did not include a diff --git a/test/emacs b/test/emacs index c7510e9..38decd0 100755 --- a/test/emacs +++ b/test/emacs @@ -39,7 +39,7 @@ test_begin_subtest "Navigation of notmuch-hello to search results" test_emacs '(notmuch-hello) (goto-char (point-min)) (re-search-forward "inbox") - (widget-button-press (point)) + (widget-button-press (1- (point))) (notmuch-test-wait) (test-output)' test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-view-inbox diff --git a/test/emacs.expected-output/notmuch-hello b/test/emacs.expected-output/notmuch-hello index 1470790..2d69891 100644 --- a/test/emacs.expected-output/notmuch-hello +++ b/test/emacs.expected-output/notmuch-hello @@ -2,7 +2,7 @@ Saved searches: [edit] - 52 inbox 52 unread + 52 inbox 52 unread Search: . diff --git a/test/emacs.expected-output/notmuch-hello-long-names b/test/emacs.expected-output/notmuch-hello-long-names index be6d2c5..486d0d9 100644 --- a/test/emacs.expected-output/notmuch-hello-long-names +++ b/test/emacs.expected-output/notmuch-hello-long-names @@ -2,14 +2,14 @@ Saved searches: [edit] - 52 inbox 52 unread + 52 inbox 52 unread Search: . All tags: [hide] - 52 a-very-long-tag 52 inbox 52 unread - 4 attachment 7 signed + 52 a-very-long-tag 52 inbox 52 unread + 4 attachment 7 signed Type a search query and hit RET to view matching threads. Edit saved searches with the `edit' button. diff --git a/test/emacs.expected-output/notmuch-hello-new-section b/test/emacs.expected-output/notmuch-hello-new-section index 6a339aa..67fdef2 100644 --- a/test/emacs.expected-output/notmuch-hello-new-section +++ b/test/emacs.expected-output/notmuch-hello-new-section @@ -1,4 +1,4 @@ Test: [hide] - 52 inbox + 52 inbox diff --git a/test/emacs.expected-output/notmuch-hello-section-counts b/test/emacs.expected-output/notmuch-hello-section-counts index 9d79659..7a9827c 100644 --- a/test/emacs.expected-output/notmuch-hello-section-counts +++ b/test/emacs.expected-output/notmuch-hello-section-counts @@ -1,5 +1,5 @@ Test-with-counts: [hide] - 2 attachment 7 signed - 7 inbox 7 unread + 2 attachment 7 signed + 7 inbox 7 unread diff --git a/test/emacs.expected-output/notmuch-hello-section-hidden-tag b/test/emacs.expected-output/notmuch-hello-section-hidden-tag index 3688e7c..809a114 100644 --- a/test/emacs.expected-output/notmuch-hello-section-hidden-tag +++ b/test/emacs.expected-output/notmuch-hello-section-hidden-tag @@ -1,4 +1,4 @@ Test-with-filtered: [hide] - 4 attachment 52 inbox 7 signed + 4 attachment 52 inbox 7 signed diff --git a/test/emacs.expected-output/notmuch-hello-section-with-empty b/test/emacs.expected-output/notmuch-hello-section-with-empty index dc2568d..5c67317 100644 --- a/test/emacs.expected-output/notmuch-hello-section-with-empty +++ b/test/emacs.expected-output/notmuch-hello-section-with-empty @@ -1,4 +1,4 @@ Test-with-empty: [hide] - 52 inbox + 52 inbox diff --git a/test/emacs.expected-output/notmuch-hello-with-empty b/test/emacs.expected-output/notmuch-hello-with-empty index 5e53222..854e0c2 100644 --- a/test/emacs.expected-output/notmuch-hello-with-empty +++ b/test/emacs.expected-output/notmuch-hello-with-empty @@ -2,7 +2,7 @@ Saved searches: [edit] - 52 inbox 52 unread 0 empty + 52 inbox 52 unread 0 empty Search: . -- cgit v1.2.3