unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [Patch v2 0/3] contrib: pick: remove an unused variable
@ 2013-08-26 21:09 Mark Walters
  2013-08-26 21:09 ` [Patch v2 1/3] contrib: pick: remove unneeded variable notmuch-pick-buffer-name Mark Walters
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Mark Walters @ 2013-08-26 21:09 UTC (permalink / raw)
  To: notmuch

v2 of this series is at
id:1377460214-4795-1-git-send-email-markwalters1009@gmail.com

v2 had a bug on refresh view (which I should have tested more). The
main pick view only worked by fluke as the initial call to pick-worker
was inside a let binding.

This version fixes the bug, moves the call to pick-worker outside the
let binding (so the bug would have shown up sooner) and also adds a
test for refresh view.

It is also rebased on top of
id:1377547043-17584-1-git-send-email-markwalters1009@gmail.com so that
series should be applied first.

Best wishes

Mark


Mark Walters (3):
  contrib: pick: remove unneeded variable notmuch-pick-buffer-name
  contrib: pick: add docstring for notmuch-pick-worker
  contrib: pick: test: refresh view

 contrib/notmuch-pick/notmuch-pick.el |   29 +++++++++++++----------------
 contrib/notmuch-pick/test/emacs-pick |   11 +++++++++++
 2 files changed, 24 insertions(+), 16 deletions(-)

-- 
1.7.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Patch v2 1/3] contrib: pick: remove unneeded variable notmuch-pick-buffer-name
  2013-08-26 21:09 [Patch v2 0/3] contrib: pick: remove an unused variable Mark Walters
@ 2013-08-26 21:09 ` Mark Walters
  2013-08-26 21:09 ` [Patch v2 2/3] contrib: pick: add docstring for notmuch-pick-worker Mark Walters
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Mark Walters @ 2013-08-26 21:09 UTC (permalink / raw)
  To: notmuch

This variable is essentially unused: it was only used for making sure
it itself got reset after a refresh of the buffer.

It did this by passing an unnecessary argument to notmuch-pick-worker
so remove that too.
---
 contrib/notmuch-pick/notmuch-pick.el |   25 +++++++++----------------
 1 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index 8c499b0..5943ac2 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -161,10 +161,6 @@
   "A buffer local copy of argument open-target to the function notmuch-pick")
 (make-variable-buffer-local 'notmuch-pick-open-target)
 
-(defvar notmuch-pick-buffer-name nil
-  "A buffer local copy of argument buffer-name to the function notmuch-pick")
-(make-variable-buffer-local 'notmuch-pick-buffer-name)
-
 (defvar notmuch-pick-message-window nil
   "The window of the message pane.
 
@@ -586,13 +582,11 @@ message will be \"unarchived\", i.e. the tag changes in
   (let ((inhibit-read-only t)
 	(basic-query notmuch-pick-basic-query)
 	(query-context notmuch-pick-query-context)
-	(target (notmuch-pick-get-message-id))
-	(buffer-name notmuch-pick-buffer-name))
+	(target (notmuch-pick-get-message-id)))
     (erase-buffer)
     (notmuch-pick-worker basic-query
 			 query-context
-			 target
-			 (get-buffer buffer-name))))
+			 target)))
 
 (defun notmuch-pick-clean-address (address)
   "Try to clean a single email ADDRESS for display. Return
@@ -795,12 +789,11 @@ Complete list of currently available key bindings:
 	(notmuch-sexp-parse-partial-list 'notmuch-pick-insert-forest-thread
 					 results-buf)))))
 
-(defun notmuch-pick-worker (basic-query &optional query-context target buffer open-target)
+(defun notmuch-pick-worker (basic-query &optional query-context target open-target)
   (interactive)
   (notmuch-pick-mode)
   (setq notmuch-pick-basic-query basic-query)
   (setq notmuch-pick-query-context query-context)
-  (setq notmuch-pick-buffer-name (buffer-name buffer))
   (setq notmuch-pick-target-msg target)
   (setq notmuch-pick-open-target open-target)
 
@@ -813,7 +806,7 @@ Complete list of currently available key bindings:
     (if (equal (car (process-lines notmuch-command "count" search-args)) "0")
 	(setq search-args basic-query))
     (let ((proc (notmuch-start-notmuch
-		 "notmuch-pick" buffer #'notmuch-pick-process-sentinel
+		 "notmuch-pick" (current-buffer) #'notmuch-pick-process-sentinel
 		 "show" "--body=false" "--format=sexp"
 		 message-arg search-args))
 	  ;; Use a scratch buffer to accumulate partial output.
@@ -846,13 +839,13 @@ The arguments are:
 					(concat "*notmuch-pick-" query "*")))))
 	(inhibit-read-only t))
 
-    (switch-to-buffer buffer)
-    ;; Don't track undo information for this buffer
-    (set 'buffer-undo-list t)
+    (switch-to-buffer buffer))
+  ;; Don't track undo information for this buffer
+  (set 'buffer-undo-list t)
 
-    (notmuch-pick-worker query query-context target buffer open-target)
+  (notmuch-pick-worker query query-context target open-target)
 
-    (setq truncate-lines t)))
+  (setq truncate-lines t))
 
 
 ;; Set up key bindings from the rest of notmuch.
-- 
1.7.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Patch v2 2/3] contrib: pick: add docstring for notmuch-pick-worker
  2013-08-26 21:09 [Patch v2 0/3] contrib: pick: remove an unused variable Mark Walters
  2013-08-26 21:09 ` [Patch v2 1/3] contrib: pick: remove unneeded variable notmuch-pick-buffer-name Mark Walters
@ 2013-08-26 21:09 ` Mark Walters
  2013-08-26 21:09 ` [Patch v2 3/3] contrib: pick: test: refresh view Mark Walters
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Mark Walters @ 2013-08-26 21:09 UTC (permalink / raw)
  To: notmuch

---
 contrib/notmuch-pick/notmuch-pick.el |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index 5943ac2..7b13708 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -790,6 +790,10 @@ Complete list of currently available key bindings:
 					 results-buf)))))
 
 (defun notmuch-pick-worker (basic-query &optional query-context target open-target)
+  "Insert the actual pick search in the current buffer.
+
+This is is a helper function for notmuch-pick. The arguments are
+the same as for the function notmuch-pick."
   (interactive)
   (notmuch-pick-mode)
   (setq notmuch-pick-basic-query basic-query)
-- 
1.7.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Patch v2 3/3] contrib: pick: test: refresh view
  2013-08-26 21:09 [Patch v2 0/3] contrib: pick: remove an unused variable Mark Walters
  2013-08-26 21:09 ` [Patch v2 1/3] contrib: pick: remove unneeded variable notmuch-pick-buffer-name Mark Walters
  2013-08-26 21:09 ` [Patch v2 2/3] contrib: pick: add docstring for notmuch-pick-worker Mark Walters
@ 2013-08-26 21:09 ` Mark Walters
  2013-09-01 18:34 ` [Patch v2 0/3] contrib: pick: remove an unused variable Mark Walters
  2013-09-02 15:17 ` Tomi Ollila
  4 siblings, 0 replies; 6+ messages in thread
From: Mark Walters @ 2013-08-26 21:09 UTC (permalink / raw)
  To: notmuch

A recent proposed patch was buggy when refreshing the view. Add a test
for refresh so that this does not reoccur.
---
 contrib/notmuch-pick/test/emacs-pick |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/contrib/notmuch-pick/test/emacs-pick b/contrib/notmuch-pick/test/emacs-pick
index eed5f02..37f974a 100755
--- a/contrib/notmuch-pick/test/emacs-pick
+++ b/contrib/notmuch-pick/test/emacs-pick
@@ -23,6 +23,17 @@ test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
 	    (delete-other-windows)'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox
 
+test_begin_subtest "Refreshed notmuch-pick view in emacs"
+test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
+	    (require (quote notmuch-pick))
+	    (notmuch-pick "tag:inbox")
+	    (notmuch-test-wait)
+	    (notmuch-pick-refresh-view)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox
+
 test_begin_subtest "Navigation of notmuch-hello to search results"
 test_emacs '(notmuch-hello)
 	    (goto-char (point-min))
-- 
1.7.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Patch v2 0/3] contrib: pick: remove an unused variable
  2013-08-26 21:09 [Patch v2 0/3] contrib: pick: remove an unused variable Mark Walters
                   ` (2 preceding siblings ...)
  2013-08-26 21:09 ` [Patch v2 3/3] contrib: pick: test: refresh view Mark Walters
@ 2013-09-01 18:34 ` Mark Walters
  2013-09-02 15:17 ` Tomi Ollila
  4 siblings, 0 replies; 6+ messages in thread
From: Mark Walters @ 2013-09-01 18:34 UTC (permalink / raw)
  To: notmuch


I should have included a diff from v2: see below (obviously the test in
patch 3 is also new).

Best wishes

Mark 



diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index f6710e9..5d46d42 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -812,7 +812,7 @@ Complete list of currently available key bindings:
 	(setq search-args basic-query))
     (if notmuch-pick-asynchronous-parser
 	(let ((proc (notmuch-start-notmuch
-		     "notmuch-pick" buffer #'notmuch-pick-process-sentinel
+		     "notmuch-pick" (current-buffer) #'notmuch-pick-process-sentinel
 		     "show" "--body=false" "--format=sexp"
 		     message-arg search-args))
 	      ;; Use a scratch buffer to accumulate partial output.
@@ -853,13 +853,13 @@ The arguments are:
 					(concat "*notmuch-pick-" query "*")))))
 	(inhibit-read-only t))
 
-    (switch-to-buffer buffer)
-    ;; Don't track undo information for this buffer
-    (set 'buffer-undo-list t)
+    (switch-to-buffer buffer))
+  ;; Don't track undo information for this buffer
+  (set 'buffer-undo-list t)
 
-    (notmuch-pick-worker query query-context target open-target)
+  (notmuch-pick-worker query query-context target open-target)
 
-    (setq truncate-lines t)))
+  (setq truncate-lines t))
 
 
 ;; Set up key bindings from the rest of notmuch.

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Patch v2 0/3] contrib: pick: remove an unused variable
  2013-08-26 21:09 [Patch v2 0/3] contrib: pick: remove an unused variable Mark Walters
                   ` (3 preceding siblings ...)
  2013-09-01 18:34 ` [Patch v2 0/3] contrib: pick: remove an unused variable Mark Walters
@ 2013-09-02 15:17 ` Tomi Ollila
  4 siblings, 0 replies; 6+ messages in thread
From: Tomi Ollila @ 2013-09-02 15:17 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Tue, Aug 27 2013, Mark Walters <markwalters1009@gmail.com> wrote:

> v2 of this series is at
> id:1377460214-4795-1-git-send-email-markwalters1009@gmail.com
>
> v2 had a bug on refresh view (which I should have tested more). The
> main pick view only worked by fluke as the initial call to pick-worker
> was inside a let binding.
>
> This version fixes the bug, moves the call to pick-worker outside the
> let binding (so the bug would have shown up sooner) and also adds a
> test for refresh view.
>
> It is also rebased on top of
> id:1377547043-17584-1-git-send-email-markwalters1009@gmail.com so that
> series should be applied first.

Looks Good, tests pass. +1

>
> Best wishes
>
> Mark

Tomi


>
>
> Mark Walters (3):
>   contrib: pick: remove unneeded variable notmuch-pick-buffer-name
>   contrib: pick: add docstring for notmuch-pick-worker
>   contrib: pick: test: refresh view
>
>  contrib/notmuch-pick/notmuch-pick.el |   29 +++++++++++++----------------
>  contrib/notmuch-pick/test/emacs-pick |   11 +++++++++++
>  2 files changed, 24 insertions(+), 16 deletions(-)
>
> -- 
> 1.7.9.1
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
>

-- 
uussigu

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-09-02 15:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-26 21:09 [Patch v2 0/3] contrib: pick: remove an unused variable Mark Walters
2013-08-26 21:09 ` [Patch v2 1/3] contrib: pick: remove unneeded variable notmuch-pick-buffer-name Mark Walters
2013-08-26 21:09 ` [Patch v2 2/3] contrib: pick: add docstring for notmuch-pick-worker Mark Walters
2013-08-26 21:09 ` [Patch v2 3/3] contrib: pick: test: refresh view Mark Walters
2013-09-01 18:34 ` [Patch v2 0/3] contrib: pick: remove an unused variable Mark Walters
2013-09-02 15:17 ` Tomi Ollila

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).