unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v2 00/11] contrib: pick: keybindings 
@ 2013-08-18 12:14 Mark Walters
  2013-08-18 12:14 ` [PATCH v2 01/11] contrib: pick: override notmuch-show-get-prop Mark Walters
                   ` (10 more replies)
  0 siblings, 11 replies; 13+ messages in thread
From: Mark Walters @ 2013-08-18 12:14 UTC (permalink / raw)
  To: notmuch

This v2 of the patch set
id:1373047878-20822-1-git-send-email-markwalters1009@gmail.com to fix
the two things mentioned by Tomi in
id:m2ppuwt7db.fsf@guru.guru-group.fi : That is the comment for
notmuch-show-get-prop now has an XXX and the keybinding for activating
a pick show window button has been moved from / to e to make it more
easily accessible on non US/UK keyboards.

Best wishes

Mark

Mark Walters (11):
  contrib: pick: override notmuch-show-get-prop
  contrib: pick: Link in notmuch-show-pipe-message
  contrib: pick: Link in attachment functions straight from
    notmuch-show
  contrib: pick: Link in stash map straight from notmuch-show
  contrib: pick: add in to-message-window function
  contrib: pick: add button press helper
  contrib: pick: pass tab through to the message pane
  contrib: pick: close window function
  contrib: pick: make help close the message pane first
  contrib: pick: add in binding to view raw message
  contrib: pick: use close-message-pane for reply etc

 contrib/notmuch-pick/notmuch-pick.el |  139 +++++++++++++++++-----------------
 1 files changed, 70 insertions(+), 69 deletions(-)

-- 
1.7.9.1

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

* [PATCH v2 01/11] contrib: pick: override notmuch-show-get-prop
  2013-08-18 12:14 [PATCH v2 00/11] contrib: pick: keybindings Mark Walters
@ 2013-08-18 12:14 ` Mark Walters
  2013-08-18 12:14 ` [PATCH v2 02/11] contrib: pick: Link in notmuch-show-pipe-message Mark Walters
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Mark Walters @ 2013-08-18 12:14 UTC (permalink / raw)
  To: notmuch

We override notmuch-show-get-prop so that many of the show functions
can be used in notmuch-pick without modification. The main use is that
it means notmuch-show-get-message-id `works' in pick. Thus we get all
the stash functions and several other `for free' in pick.
---
 contrib/notmuch-pick/notmuch-pick.el |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index 7f5f729..04e37ee 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -238,6 +238,22 @@ Some useful entries are:
     (beginning-of-line)
     (get-text-property (point) :notmuch-message-properties)))
 
+;; XXX This should really be a lib function but we are trying to
+;; reduce impact on the code base.
+(defun notmuch-show-get-prop (prop &optional props)
+  "This is a pick overridden version of notmuch-show-get-prop
+
+It gets property PROP from PROPS or, if PROPS is nil, the current
+message in either pick or show. This means that several functions
+in notmuch-show now work unchanged in pick as they just need the
+correct message properties."
+  (let ((props (or props
+		   (cond ((eq major-mode 'notmuch-show-mode)
+			  (notmuch-show-get-message-properties))
+			 ((eq major-mode 'notmuch-pick-mode)
+			  (notmuch-pick-get-message-properties))))))
+    (plist-get props prop)))
+
 (defun notmuch-pick-set-message-properties (props)
   (save-excursion
     (beginning-of-line)
-- 
1.7.9.1

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

* [PATCH v2 02/11] contrib: pick: Link in notmuch-show-pipe-message
  2013-08-18 12:14 [PATCH v2 00/11] contrib: pick: keybindings Mark Walters
  2013-08-18 12:14 ` [PATCH v2 01/11] contrib: pick: override notmuch-show-get-prop Mark Walters
@ 2013-08-18 12:14 ` Mark Walters
  2013-08-18 12:14 ` [PATCH v2 03/11] contrib: pick: Link in attachment functions straight from notmuch-show Mark Walters
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Mark Walters @ 2013-08-18 12:14 UTC (permalink / raw)
  To: notmuch

Since we can now use show functions directly in pick we can drop pick-pipe-message.
---
 contrib/notmuch-pick/notmuch-pick.el |   31 ++-----------------------------
 1 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index 04e37ee..22ade72 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -190,6 +190,8 @@ if the user has loaded a different buffer in that window.")
 (defvar notmuch-pick-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map [mouse-1] 'notmuch-pick-show-message)
+    ;; these use notmuch-show functions directly
+    (define-key map "|" 'notmuch-show-pipe-message)
     (define-key map "q" 'notmuch-pick-quit)
     (define-key map "x" 'notmuch-pick-quit)
     (define-key map "?" 'notmuch-help)
@@ -205,7 +207,6 @@ if the user has loaded a different buffer in that window.")
     (define-key map "p" 'notmuch-pick-prev-matching-message)
     (define-key map "N" 'notmuch-pick-next-message)
     (define-key map "P" 'notmuch-pick-prev-message)
-    (define-key map "|" 'notmuch-pick-pipe-message)
     (define-key map "-" 'notmuch-pick-remove-tag)
     (define-key map "+" 'notmuch-pick-add-tag)
     (define-key map " " 'notmuch-pick-scroll-or-next)
@@ -586,34 +587,6 @@ message will be \"unarchived\", i.e. the tag changes in
   (notmuch-pick-close-message-window)
   (notmuch-mua-new-reply (notmuch-pick-get-message-id) prompt-for-sender nil))
 
-;; Shamelessly stolen from notmuch-show.el: maybe should be unified.
-(defun notmuch-pick-pipe-message (command)
-  "Pipe the contents of the current message to the given command.
-
-The given command will be executed with the raw contents of the
-current email message as stdin. Anything printed by the command
-to stdout or stderr will appear in the *notmuch-pipe* buffer.
-
-When invoked with a prefix argument, the command will receive all
-open messages in the current thread (formatted as an mbox) rather
-than only the current message."
-  (interactive "sPipe message to command: ")
-  (let ((shell-command
-	 (concat notmuch-command " show --format=raw "
-		 (shell-quote-argument (notmuch-pick-get-message-id)) " | " command))
-	 (buf (get-buffer-create (concat "*notmuch-pipe*"))))
-    (with-current-buffer buf
-      (setq buffer-read-only nil)
-      (erase-buffer)
-      (let ((exit-code (call-process-shell-command shell-command nil buf)))
-	(goto-char (point-max))
-	(set-buffer-modified-p nil)
-	(setq buffer-read-only t)
-	(unless (zerop exit-code)
-	  (switch-to-buffer-other-window buf)
-	  (message (format "Command '%s' exited abnormally with code %d"
-			   shell-command exit-code)))))))
-
 (defun notmuch-pick-clean-address (address)
   "Try to clean a single email ADDRESS for display. Return
 AUTHOR_NAME if present, otherwise return AUTHOR_EMAIL. Return
-- 
1.7.9.1

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

* [PATCH v2 03/11] contrib: pick: Link in attachment functions straight from notmuch-show
  2013-08-18 12:14 [PATCH v2 00/11] contrib: pick: keybindings Mark Walters
  2013-08-18 12:14 ` [PATCH v2 01/11] contrib: pick: override notmuch-show-get-prop Mark Walters
  2013-08-18 12:14 ` [PATCH v2 02/11] contrib: pick: Link in notmuch-show-pipe-message Mark Walters
@ 2013-08-18 12:14 ` Mark Walters
  2013-08-18 12:14 ` [PATCH v2 04/11] contrib: pick: Link in stash map " Mark Walters
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Mark Walters @ 2013-08-18 12:14 UTC (permalink / raw)
  To: notmuch

We can use the attachment functions straight from
notmuch-show. notmuch-show-view-all-mime-parts might be deprecated so
we either want to undeprecate it or not have this binding.
---
 contrib/notmuch-pick/notmuch-pick.el |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index 22ade72..d841d99 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -192,6 +192,8 @@ if the user has loaded a different buffer in that window.")
     (define-key map [mouse-1] 'notmuch-pick-show-message)
     ;; these use notmuch-show functions directly
     (define-key map "|" 'notmuch-show-pipe-message)
+    (define-key map "w" 'notmuch-show-save-attachments)
+    (define-key map "v" 'notmuch-show-view-all-mime-parts)
     (define-key map "q" 'notmuch-pick-quit)
     (define-key map "x" 'notmuch-pick-quit)
     (define-key map "?" 'notmuch-help)
-- 
1.7.9.1

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

* [PATCH v2 04/11] contrib: pick: Link in stash map straight from notmuch-show
  2013-08-18 12:14 [PATCH v2 00/11] contrib: pick: keybindings Mark Walters
                   ` (2 preceding siblings ...)
  2013-08-18 12:14 ` [PATCH v2 03/11] contrib: pick: Link in attachment functions straight from notmuch-show Mark Walters
@ 2013-08-18 12:14 ` Mark Walters
  2013-08-18 12:14 ` [PATCH v2 05/11] contrib: pick: add in to-message-window function Mark Walters
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Mark Walters @ 2013-08-18 12:14 UTC (permalink / raw)
  To: notmuch

These functions all now work straight from their notmuch-show
implementation so link them in.

Stash functionality was one of the key missing things in notmuch-pick.
---
 contrib/notmuch-pick/notmuch-pick.el |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index d841d99..89e6d4b 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -194,6 +194,7 @@ if the user has loaded a different buffer in that window.")
     (define-key map "|" 'notmuch-show-pipe-message)
     (define-key map "w" 'notmuch-show-save-attachments)
     (define-key map "v" 'notmuch-show-view-all-mime-parts)
+    (define-key map "c" 'notmuch-show-stash-map)
     (define-key map "q" 'notmuch-pick-quit)
     (define-key map "x" 'notmuch-pick-quit)
     (define-key map "?" 'notmuch-help)
-- 
1.7.9.1

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

* [PATCH v2 05/11] contrib: pick: add in to-message-window function
  2013-08-18 12:14 [PATCH v2 00/11] contrib: pick: keybindings Mark Walters
                   ` (3 preceding siblings ...)
  2013-08-18 12:14 ` [PATCH v2 04/11] contrib: pick: Link in stash map " Mark Walters
@ 2013-08-18 12:14 ` Mark Walters
  2013-08-18 12:14 ` [PATCH v2 06/11] contrib: pick: add button press helper Mark Walters
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Mark Walters @ 2013-08-18 12:14 UTC (permalink / raw)
  To: notmuch

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

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index 89e6d4b..d00d324 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -187,6 +187,19 @@ if the user has loaded a different buffer in that window.")
 (make-variable-buffer-local 'notmuch-pick-message-buffer)
 (put 'notmuch-pick-message-buffer 'permanent-local t)
 
+(defun notmuch-pick-to-message-pane (func)
+  "Execute FUNC in message pane.
+
+This function returns a function (so can be used as a keybinding)
+which executes function FUNC in the message pane if it is
+open (if the message pane is closed it does nothing)."
+  `(lambda ()
+      ,(concat "(In message pane) " (documentation func t))
+     (interactive)
+     (when (window-live-p notmuch-pick-message-window)
+       (with-selected-window notmuch-pick-message-window
+	 (funcall #',func)))))
+
 (defvar notmuch-pick-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map [mouse-1] 'notmuch-pick-show-message)
-- 
1.7.9.1

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

* [PATCH v2 06/11] contrib: pick: add button press helper
  2013-08-18 12:14 [PATCH v2 00/11] contrib: pick: keybindings Mark Walters
                   ` (4 preceding siblings ...)
  2013-08-18 12:14 ` [PATCH v2 05/11] contrib: pick: add in to-message-window function Mark Walters
@ 2013-08-18 12:14 ` Mark Walters
  2013-08-18 12:14 ` [PATCH v2 07/11] contrib: pick: pass tab through to the message pane Mark Walters
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Mark Walters @ 2013-08-18 12:14 UTC (permalink / raw)
  To: notmuch

We will want to be able to activate buttons not in the current
buffer (ie in the message pane) so it is helpful to have a way of
activating a button without signalling error if there is no button.
---
 contrib/notmuch-pick/notmuch-pick.el |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index d00d324..2abb08b 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -200,6 +200,14 @@ open (if the message pane is closed it does nothing)."
        (with-selected-window notmuch-pick-message-window
 	 (funcall #',func)))))
 
+(defun notmuch-pick-button-activate (&optional button)
+  "Activate BUTTON or button at point
+
+This function does not give an error if there is no button."
+  (interactive)
+  (let ((button (or button (button-at (point)))))
+    (when button (button-activate button))))
+
 (defvar notmuch-pick-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map [mouse-1] 'notmuch-pick-show-message)
-- 
1.7.9.1

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

* [PATCH v2 07/11] contrib: pick: pass tab through to the message pane
  2013-08-18 12:14 [PATCH v2 00/11] contrib: pick: keybindings Mark Walters
                   ` (5 preceding siblings ...)
  2013-08-18 12:14 ` [PATCH v2 06/11] contrib: pick: add button press helper Mark Walters
@ 2013-08-18 12:14 ` Mark Walters
  2013-08-18 12:14 ` [PATCH v2 08/11] contrib: pick: close window function Mark Walters
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Mark Walters @ 2013-08-18 12:14 UTC (permalink / raw)
  To: notmuch

This makes tab move to next button in the message pane and binds
button activate (in message pane) to "e". This means that is easy to
toggle hidden parts or hidden citations etc in the message pane.
---
 contrib/notmuch-pick/notmuch-pick.el |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index 2abb08b..bd506ca 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -216,6 +216,14 @@ This function does not give an error if there is no button."
     (define-key map "w" 'notmuch-show-save-attachments)
     (define-key map "v" 'notmuch-show-view-all-mime-parts)
     (define-key map "c" 'notmuch-show-stash-map)
+
+    ;; these apply to the message pane
+    (define-key map (kbd "M-TAB") (notmuch-pick-to-message-pane #'notmuch-show-previous-button))
+    (define-key map (kbd "<backtab>")  (notmuch-pick-to-message-pane #'notmuch-show-previous-button))
+    (define-key map (kbd "TAB") (notmuch-pick-to-message-pane #'notmuch-show-next-button))
+    (define-key map "e" (notmuch-pick-to-message-pane #'notmuch-pick-button-activate))
+
+    ;; The main pick bindings
     (define-key map "q" 'notmuch-pick-quit)
     (define-key map "x" 'notmuch-pick-quit)
     (define-key map "?" 'notmuch-help)
-- 
1.7.9.1

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

* [PATCH v2 08/11] contrib: pick: close window function
  2013-08-18 12:14 [PATCH v2 00/11] contrib: pick: keybindings Mark Walters
                   ` (6 preceding siblings ...)
  2013-08-18 12:14 ` [PATCH v2 07/11] contrib: pick: pass tab through to the message pane Mark Walters
@ 2013-08-18 12:14 ` Mark Walters
  2013-08-18 12:14 ` [PATCH v2 09/11] contrib: pick: make help close the message pane first Mark Walters
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Mark Walters @ 2013-08-18 12:14 UTC (permalink / raw)
  To: notmuch

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

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index bd506ca..ba252d5 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -208,6 +208,18 @@ This function does not give an error if there is no button."
   (let ((button (or button (button-at (point)))))
     (when button (button-activate button))))
 
+(defun notmuch-pick-close-message-pane-and (func)
+  "Close message pane and execute FUNC.
+
+This function returns a function (so can be used as a keybinding)
+which closes the message pane if open and then executes function
+FUNC."
+  `(lambda ()
+      ,(concat "(Close message pane and) " (documentation func t))
+     (interactive)
+     (notmuch-pick-close-message-window)
+     (funcall #',func)))
+
 (defvar notmuch-pick-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map [mouse-1] 'notmuch-pick-show-message)
-- 
1.7.9.1

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

* [PATCH v2 09/11] contrib: pick: make help close the message pane first
  2013-08-18 12:14 [PATCH v2 00/11] contrib: pick: keybindings Mark Walters
                   ` (7 preceding siblings ...)
  2013-08-18 12:14 ` [PATCH v2 08/11] contrib: pick: close window function Mark Walters
@ 2013-08-18 12:14 ` Mark Walters
  2013-08-18 12:14 ` [PATCH v2 10/11] contrib: pick: add in binding to view raw message Mark Walters
  2013-08-18 12:14 ` [PATCH v2 11/11] contrib: pick: use close-message-pane for reply etc Mark Walters
  10 siblings, 0 replies; 13+ messages in thread
From: Mark Walters @ 2013-08-18 12:14 UTC (permalink / raw)
  To: notmuch

Previously pressing "?" for help when the message pane was open meant
the help window was very small. Close the message pane before
displaying help.
---
 contrib/notmuch-pick/notmuch-pick.el |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index ba252d5..68ddcf6 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -235,10 +235,12 @@ FUNC."
     (define-key map (kbd "TAB") (notmuch-pick-to-message-pane #'notmuch-show-next-button))
     (define-key map "e" (notmuch-pick-to-message-pane #'notmuch-pick-button-activate))
 
+    ;; bindings from show (or elsewhere) but we close the message pane first.
+    (define-key map "?" (notmuch-pick-close-message-pane-and #'notmuch-help))
+
     ;; The main pick bindings
     (define-key map "q" 'notmuch-pick-quit)
     (define-key map "x" 'notmuch-pick-quit)
-    (define-key map "?" 'notmuch-help)
     (define-key map "a" 'notmuch-pick-archive-message-then-next)
     (define-key map "=" 'notmuch-pick-refresh-view)
     (define-key map "s" 'notmuch-pick-to-search)
-- 
1.7.9.1

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

* [PATCH v2 10/11] contrib: pick: add in binding to view raw message
  2013-08-18 12:14 [PATCH v2 00/11] contrib: pick: keybindings Mark Walters
                   ` (8 preceding siblings ...)
  2013-08-18 12:14 ` [PATCH v2 09/11] contrib: pick: make help close the message pane first Mark Walters
@ 2013-08-18 12:14 ` Mark Walters
  2013-08-18 12:14 ` [PATCH v2 11/11] contrib: pick: use close-message-pane for reply etc Mark Walters
  10 siblings, 0 replies; 13+ messages in thread
From: Mark Walters @ 2013-08-18 12:14 UTC (permalink / raw)
  To: notmuch

Note this does rely on the fact that we have over-ridden notmuch-show-get-properties
---
 contrib/notmuch-pick/notmuch-pick.el |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index 68ddcf6..0e10c7c 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -236,6 +236,7 @@ FUNC."
     (define-key map "e" (notmuch-pick-to-message-pane #'notmuch-pick-button-activate))
 
     ;; bindings from show (or elsewhere) but we close the message pane first.
+    (define-key map "V" (notmuch-pick-close-message-pane-and #'notmuch-show-view-raw-message))
     (define-key map "?" (notmuch-pick-close-message-pane-and #'notmuch-help))
 
     ;; The main pick bindings
-- 
1.7.9.1

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

* [PATCH v2 11/11] contrib: pick: use close-message-pane for reply etc
  2013-08-18 12:14 [PATCH v2 00/11] contrib: pick: keybindings Mark Walters
                   ` (9 preceding siblings ...)
  2013-08-18 12:14 ` [PATCH v2 10/11] contrib: pick: add in binding to view raw message Mark Walters
@ 2013-08-18 12:14 ` Mark Walters
  2013-08-21 20:23   ` Tomi Ollila
  10 siblings, 1 reply; 13+ messages in thread
From: Mark Walters @ 2013-08-18 12:14 UTC (permalink / raw)
  To: notmuch

We can save some code duplication by using the new close-message-pane
functionality for reply, forward, and new mail.
---
 contrib/notmuch-pick/notmuch-pick.el |   43 +++------------------------------
 1 files changed, 4 insertions(+), 39 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index 0e10c7c..3b86a5a 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -236,6 +236,10 @@ FUNC."
     (define-key map "e" (notmuch-pick-to-message-pane #'notmuch-pick-button-activate))
 
     ;; bindings from show (or elsewhere) but we close the message pane first.
+    (define-key map "m" (notmuch-pick-close-message-pane-and #'notmuch-mua-new-mail))
+    (define-key map "f" (notmuch-pick-close-message-pane-and #'notmuch-show-forward-message))
+    (define-key map "r" (notmuch-pick-close-message-pane-and #'notmuch-show-reply-sender))
+    (define-key map "R" (notmuch-pick-close-message-pane-and #'notmuch-show-reply))
     (define-key map "V" (notmuch-pick-close-message-pane-and #'notmuch-show-view-raw-message))
     (define-key map "?" (notmuch-pick-close-message-pane-and #'notmuch-help))
 
@@ -246,10 +250,6 @@ FUNC."
     (define-key map "=" 'notmuch-pick-refresh-view)
     (define-key map "s" 'notmuch-pick-to-search)
     (define-key map "z" 'notmuch-pick-to-pick)
-    (define-key map "m" 'notmuch-pick-new-mail)
-    (define-key map "f" 'notmuch-pick-forward-message)
-    (define-key map "r" 'notmuch-pick-reply-sender)
-    (define-key map "R" 'notmuch-pick-reply)
     (define-key map "n" 'notmuch-pick-next-matching-message)
     (define-key map "p" 'notmuch-pick-prev-matching-message)
     (define-key map "N" 'notmuch-pick-next-message)
@@ -599,41 +599,6 @@ message will be \"unarchived\", i.e. the tag changes in
 			 target
 			 (get-buffer buffer-name))))
 
-(defmacro with-current-notmuch-pick-message (&rest body)
-  "Evaluate body with current buffer set to the text of current message"
-  `(save-excursion
-     (let ((id (notmuch-pick-get-message-id)))
-       (let ((buf (generate-new-buffer (concat "*notmuch-msg-" id "*"))))
-         (with-current-buffer buf
-	    (call-process notmuch-command nil t nil "show" "--format=raw" id)
-           ,@body)
-	 (kill-buffer buf)))))
-
-(defun notmuch-pick-new-mail (&optional prompt-for-sender)
-  "Compose new mail."
-  (interactive "P")
-  (notmuch-pick-close-message-window)
-  (notmuch-mua-new-mail prompt-for-sender ))
-
-(defun notmuch-pick-forward-message (&optional prompt-for-sender)
-  "Forward the current message."
-  (interactive "P")
-  (notmuch-pick-close-message-window)
-  (with-current-notmuch-pick-message
-   (notmuch-mua-new-forward-message prompt-for-sender)))
-
-(defun notmuch-pick-reply (&optional prompt-for-sender)
-  "Reply to the sender and all recipients of the current message."
-  (interactive "P")
-  (notmuch-pick-close-message-window)
-  (notmuch-mua-new-reply (notmuch-pick-get-message-id) prompt-for-sender t))
-
-(defun notmuch-pick-reply-sender (&optional prompt-for-sender)
-  "Reply to the sender of the current message."
-  (interactive "P")
-  (notmuch-pick-close-message-window)
-  (notmuch-mua-new-reply (notmuch-pick-get-message-id) prompt-for-sender nil))
-
 (defun notmuch-pick-clean-address (address)
   "Try to clean a single email ADDRESS for display. Return
 AUTHOR_NAME if present, otherwise return AUTHOR_EMAIL. Return
-- 
1.7.9.1

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

* Re: [PATCH v2 11/11] contrib: pick: use close-message-pane for reply etc
  2013-08-18 12:14 ` [PATCH v2 11/11] contrib: pick: use close-message-pane for reply etc Mark Walters
@ 2013-08-21 20:23   ` Tomi Ollila
  0 siblings, 0 replies; 13+ messages in thread
From: Tomi Ollila @ 2013-08-21 20:23 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Sun, Aug 18 2013, Mark Walters <markwalters1009@gmail.com> wrote:

> We can save some code duplication by using the new close-message-pane
> functionality for reply, forward, and new mail.
> ---
>  contrib/notmuch-pick/notmuch-pick.el |   43 +++------------------------------
>  1 files changed, 4 insertions(+), 39 deletions(-)
>
> diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
> index 0e10c7c..3b86a5a 100644
> --- a/contrib/notmuch-pick/notmuch-pick.el
> +++ b/contrib/notmuch-pick/notmuch-pick.el
> @@ -236,6 +236,10 @@ FUNC."
>      (define-key map "e" (notmuch-pick-to-message-pane #'notmuch-pick-button-activate))
>  
>      ;; bindings from show (or elsewhere) but we close the message pane first.
> +    (define-key map "m" (notmuch-pick-close-message-pane-and #'notmuch-mua-new-mail))
> +    (define-key map "f" (notmuch-pick-close-message-pane-and #'notmuch-show-forward-message))
> +    (define-key map "r" (notmuch-pick-close-message-pane-and #'notmuch-show-reply-sender))
> +    (define-key map "R" (notmuch-pick-close-message-pane-and #'notmuch-show-reply))
>      (define-key map "V" (notmuch-pick-close-message-pane-and #'notmuch-show-view-raw-message))
>      (define-key map "?" (notmuch-pick-close-message-pane-and #'notmuch-help))
>  
> @@ -246,10 +250,6 @@ FUNC."
>      (define-key map "=" 'notmuch-pick-refresh-view)
>      (define-key map "s" 'notmuch-pick-to-search)
>      (define-key map "z" 'notmuch-pick-to-pick)
> -    (define-key map "m" 'notmuch-pick-new-mail)
> -    (define-key map "f" 'notmuch-pick-forward-message)
> -    (define-key map "r" 'notmuch-pick-reply-sender)
> -    (define-key map "R" 'notmuch-pick-reply)
>      (define-key map "n" 'notmuch-pick-next-matching-message)
>      (define-key map "p" 'notmuch-pick-prev-matching-message)
>      (define-key map "N" 'notmuch-pick-next-message)
> @@ -599,41 +599,6 @@ message will be \"unarchived\", i.e. the tag changes in
>  			 target
>  			 (get-buffer buffer-name))))
>  
> -(defmacro with-current-notmuch-pick-message (&rest body)
> -  "Evaluate body with current buffer set to the text of current message"
> -  `(save-excursion
> -     (let ((id (notmuch-pick-get-message-id)))
> -       (let ((buf (generate-new-buffer (concat "*notmuch-msg-" id "*"))))
> -         (with-current-buffer buf
> -	    (call-process notmuch-command nil t nil "show" "--format=raw" id)
> -           ,@body)
> -	 (kill-buffer buf)))))
> -
> -(defun notmuch-pick-new-mail (&optional prompt-for-sender)
> -  "Compose new mail."
> -  (interactive "P")
> -  (notmuch-pick-close-message-window)
> -  (notmuch-mua-new-mail prompt-for-sender ))

This patch series generally LGTM. The only question I have left is how much
it matters that e.g. the pick keybinding for new mail cannot use prefix
argument to make notmuch-mua-new-mail to prompt-for-sender. Also, how is it
made possible that with-current-notmuch-pick-message is not needed anymore ?

Maybe, if there is problem with this prompt-for-sender, a followup patch
could create another function like `notmuch-pick-close-message-pane-and`
which does `(lambda (&optional arg)... and (interactive "P"). and use
that in some keybindings.

Tomi

> -
> -(defun notmuch-pick-forward-message (&optional prompt-for-sender)
> -  "Forward the current message."
> -  (interactive "P")
> -  (notmuch-pick-close-message-window)
> -  (with-current-notmuch-pick-message
> -   (notmuch-mua-new-forward-message prompt-for-sender)))
> -
> -(defun notmuch-pick-reply (&optional prompt-for-sender)
> -  "Reply to the sender and all recipients of the current message."
> -  (interactive "P")
> -  (notmuch-pick-close-message-window)
> -  (notmuch-mua-new-reply (notmuch-pick-get-message-id) prompt-for-sender t))
> -
> -(defun notmuch-pick-reply-sender (&optional prompt-for-sender)
> -  "Reply to the sender of the current message."
> -  (interactive "P")
> -  (notmuch-pick-close-message-window)
> -  (notmuch-mua-new-reply (notmuch-pick-get-message-id) prompt-for-sender nil))
> -
>  (defun notmuch-pick-clean-address (address)
>    "Try to clean a single email ADDRESS for display. Return
>  AUTHOR_NAME if present, otherwise return AUTHOR_EMAIL. Return
> -- 
> 1.7.9.1
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

end of thread, other threads:[~2013-08-21 20:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-18 12:14 [PATCH v2 00/11] contrib: pick: keybindings Mark Walters
2013-08-18 12:14 ` [PATCH v2 01/11] contrib: pick: override notmuch-show-get-prop Mark Walters
2013-08-18 12:14 ` [PATCH v2 02/11] contrib: pick: Link in notmuch-show-pipe-message Mark Walters
2013-08-18 12:14 ` [PATCH v2 03/11] contrib: pick: Link in attachment functions straight from notmuch-show Mark Walters
2013-08-18 12:14 ` [PATCH v2 04/11] contrib: pick: Link in stash map " Mark Walters
2013-08-18 12:14 ` [PATCH v2 05/11] contrib: pick: add in to-message-window function Mark Walters
2013-08-18 12:14 ` [PATCH v2 06/11] contrib: pick: add button press helper Mark Walters
2013-08-18 12:14 ` [PATCH v2 07/11] contrib: pick: pass tab through to the message pane Mark Walters
2013-08-18 12:14 ` [PATCH v2 08/11] contrib: pick: close window function Mark Walters
2013-08-18 12:14 ` [PATCH v2 09/11] contrib: pick: make help close the message pane first Mark Walters
2013-08-18 12:14 ` [PATCH v2 10/11] contrib: pick: add in binding to view raw message Mark Walters
2013-08-18 12:14 ` [PATCH v2 11/11] contrib: pick: use close-message-pane for reply etc Mark Walters
2013-08-21 20:23   ` 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).