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

This is v3 of this patch set. v2 is at
id:1376828079-21455-1-git-send-email-markwalters1009@gmail.com

This fixes the problem pointed out by Tomi in
id:m238q294je.fsf@guru.guru-group.fi : by using call-interactively
rather than funcall the prefix argument gets passed on to the called
function so things like ctrl-u m work (ie it prompts for sender)

To answer Tomi's other question: with-current-notmuch-pick-message is
not needed because it is identical to
with-current-notmuch-show-message except it uses
notmuch-pick-get-message-id instead of notmuch-show-get-message-id.
But patch 1 of this series makes the function
notmuch-show-get-message-id work in either show or pick (by doing
slightly different things based on whether the major mode is show or
pick).

(In fact the differentiation occurs slightly lower in
notmuch-show-get-prop which is called by notmuch-show-get-message-id)


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] 14+ messages in thread

* [PATCH v3 01/11] contrib: pick: override notmuch-show-get-prop
  2013-08-22 17:10 [PATCH v3 00/11] contrib: pick: keybindings Mark Walters
@ 2013-08-22 17:10 ` Mark Walters
  2013-08-22 17:10 ` [PATCH v3 02/11] contrib: pick: Link in notmuch-show-pipe-message Mark Walters
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mark Walters @ 2013-08-22 17:10 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] 14+ messages in thread

* [PATCH v3 02/11] contrib: pick: Link in notmuch-show-pipe-message
  2013-08-22 17:10 [PATCH v3 00/11] contrib: pick: keybindings Mark Walters
  2013-08-22 17:10 ` [PATCH v3 01/11] contrib: pick: override notmuch-show-get-prop Mark Walters
@ 2013-08-22 17:10 ` Mark Walters
  2013-08-22 17:10 ` [PATCH v3 03/11] contrib: pick: Link in attachment functions straight from notmuch-show Mark Walters
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mark Walters @ 2013-08-22 17:10 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] 14+ messages in thread

* [PATCH v3 03/11] contrib: pick: Link in attachment functions straight from notmuch-show
  2013-08-22 17:10 [PATCH v3 00/11] contrib: pick: keybindings Mark Walters
  2013-08-22 17:10 ` [PATCH v3 01/11] contrib: pick: override notmuch-show-get-prop Mark Walters
  2013-08-22 17:10 ` [PATCH v3 02/11] contrib: pick: Link in notmuch-show-pipe-message Mark Walters
@ 2013-08-22 17:10 ` Mark Walters
  2013-08-22 17:10 ` [PATCH v3 04/11] contrib: pick: Link in stash map " Mark Walters
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mark Walters @ 2013-08-22 17:10 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] 14+ messages in thread

* [PATCH v3 04/11] contrib: pick: Link in stash map straight from notmuch-show
  2013-08-22 17:10 [PATCH v3 00/11] contrib: pick: keybindings Mark Walters
                   ` (2 preceding siblings ...)
  2013-08-22 17:10 ` [PATCH v3 03/11] contrib: pick: Link in attachment functions straight from notmuch-show Mark Walters
@ 2013-08-22 17:10 ` Mark Walters
  2013-08-22 17:10 ` [PATCH v3 05/11] contrib: pick: add in to-message-window function Mark Walters
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mark Walters @ 2013-08-22 17:10 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] 14+ messages in thread

* [PATCH v3 05/11] contrib: pick: add in to-message-window function
  2013-08-22 17:10 [PATCH v3 00/11] contrib: pick: keybindings Mark Walters
                   ` (3 preceding siblings ...)
  2013-08-22 17:10 ` [PATCH v3 04/11] contrib: pick: Link in stash map " Mark Walters
@ 2013-08-22 17:10 ` Mark Walters
  2013-08-22 17:10 ` [PATCH v3 06/11] contrib: pick: add button press helper Mark Walters
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mark Walters @ 2013-08-22 17:10 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..9c1864b 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
+	 (call-interactively #',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] 14+ messages in thread

* [PATCH v3 06/11] contrib: pick: add button press helper
  2013-08-22 17:10 [PATCH v3 00/11] contrib: pick: keybindings Mark Walters
                   ` (4 preceding siblings ...)
  2013-08-22 17:10 ` [PATCH v3 05/11] contrib: pick: add in to-message-window function Mark Walters
@ 2013-08-22 17:10 ` Mark Walters
  2013-08-22 17:10 ` [PATCH v3 07/11] contrib: pick: pass tab through to the message pane Mark Walters
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mark Walters @ 2013-08-22 17:10 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 9c1864b..f24f2b3 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
 	 (call-interactively #',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] 14+ messages in thread

* [PATCH v3 07/11] contrib: pick: pass tab through to the message pane
  2013-08-22 17:10 [PATCH v3 00/11] contrib: pick: keybindings Mark Walters
                   ` (5 preceding siblings ...)
  2013-08-22 17:10 ` [PATCH v3 06/11] contrib: pick: add button press helper Mark Walters
@ 2013-08-22 17:10 ` Mark Walters
  2013-08-22 17:10 ` [PATCH v3 08/11] contrib: pick: close window function Mark Walters
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mark Walters @ 2013-08-22 17:10 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 f24f2b3..3b1f85c 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] 14+ messages in thread

* [PATCH v3 08/11] contrib: pick: close window function
  2013-08-22 17:10 [PATCH v3 00/11] contrib: pick: keybindings Mark Walters
                   ` (6 preceding siblings ...)
  2013-08-22 17:10 ` [PATCH v3 07/11] contrib: pick: pass tab through to the message pane Mark Walters
@ 2013-08-22 17:10 ` Mark Walters
  2013-08-22 17:10 ` [PATCH v3 09/11] contrib: pick: make help close the message pane first Mark Walters
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mark Walters @ 2013-08-22 17:10 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 3b1f85c..6d73269 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)
+     (call-interactively #',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] 14+ messages in thread

* [PATCH v3 09/11] contrib: pick: make help close the message pane first
  2013-08-22 17:10 [PATCH v3 00/11] contrib: pick: keybindings Mark Walters
                   ` (7 preceding siblings ...)
  2013-08-22 17:10 ` [PATCH v3 08/11] contrib: pick: close window function Mark Walters
@ 2013-08-22 17:10 ` Mark Walters
  2013-08-22 17:10 ` [PATCH v3 10/11] contrib: pick: add in binding to view raw message Mark Walters
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mark Walters @ 2013-08-22 17:10 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 6d73269..344609f 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] 14+ messages in thread

* [PATCH v3 10/11] contrib: pick: add in binding to view raw message
  2013-08-22 17:10 [PATCH v3 00/11] contrib: pick: keybindings Mark Walters
                   ` (8 preceding siblings ...)
  2013-08-22 17:10 ` [PATCH v3 09/11] contrib: pick: make help close the message pane first Mark Walters
@ 2013-08-22 17:10 ` Mark Walters
  2013-08-22 17:10 ` [PATCH v3 11/11] contrib: pick: use close-message-pane for reply etc Mark Walters
  2013-08-22 17:18 ` [PATCH v3 00/11] contrib: pick: keybindings Mark Walters
  11 siblings, 0 replies; 14+ messages in thread
From: Mark Walters @ 2013-08-22 17:10 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 344609f..6e71fef 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] 14+ messages in thread

* [PATCH v3 11/11] contrib: pick: use close-message-pane for reply etc
  2013-08-22 17:10 [PATCH v3 00/11] contrib: pick: keybindings Mark Walters
                   ` (9 preceding siblings ...)
  2013-08-22 17:10 ` [PATCH v3 10/11] contrib: pick: add in binding to view raw message Mark Walters
@ 2013-08-22 17:10 ` Mark Walters
  2013-08-22 17:18 ` [PATCH v3 00/11] contrib: pick: keybindings Mark Walters
  11 siblings, 0 replies; 14+ messages in thread
From: Mark Walters @ 2013-08-22 17:10 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 6e71fef..37dc161 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] 14+ messages in thread

* Re: [PATCH v3 00/11] contrib: pick: keybindings
  2013-08-22 17:10 [PATCH v3 00/11] contrib: pick: keybindings Mark Walters
                   ` (10 preceding siblings ...)
  2013-08-22 17:10 ` [PATCH v3 11/11] contrib: pick: use close-message-pane for reply etc Mark Walters
@ 2013-08-22 17:18 ` Mark Walters
  2013-08-22 17:49   ` Tomi Ollila
  11 siblings, 1 reply; 14+ messages in thread
From: Mark Walters @ 2013-08-22 17:18 UTC (permalink / raw)
  To: notmuch


Here is the diff diff that I should have included in the previous email

Sorry about that!

Mark

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index 3b86a5a..37dc161 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -198,7 +198,7 @@ open (if the message pane is closed it does nothing)."
      (interactive)
      (when (window-live-p notmuch-pick-message-window)
        (with-selected-window notmuch-pick-message-window
-	 (funcall #',func)))))
+	 (call-interactively #',func)))))
 
 (defun notmuch-pick-button-activate (&optional button)
   "Activate BUTTON or button at point
@@ -218,7 +218,7 @@ FUNC."
       ,(concat "(Close message pane and) " (documentation func t))
      (interactive)
      (notmuch-pick-close-message-window)
-     (funcall #',func)))
+     (call-interactively #',func)))
 
 (defvar notmuch-pick-mode-map
   (let ((map (make-sparse-keymap)))

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

* Re: [PATCH v3 00/11] contrib: pick: keybindings
  2013-08-22 17:18 ` [PATCH v3 00/11] contrib: pick: keybindings Mark Walters
@ 2013-08-22 17:49   ` Tomi Ollila
  0 siblings, 0 replies; 14+ messages in thread
From: Tomi Ollila @ 2013-08-22 17:49 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Thu, Aug 22 2013, Mark Walters <markwalters1009@gmail.com> wrote:

> Here is the diff diff that I should have included in the previous email

LGTM.

> Sorry about that!
>
> Mark

Tomi

>
> diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
> index 3b86a5a..37dc161 100644
> --- a/contrib/notmuch-pick/notmuch-pick.el
> +++ b/contrib/notmuch-pick/notmuch-pick.el
> @@ -198,7 +198,7 @@ open (if the message pane is closed it does nothing)."
>       (interactive)
>       (when (window-live-p notmuch-pick-message-window)
>         (with-selected-window notmuch-pick-message-window
> -	 (funcall #',func)))))
> +	 (call-interactively #',func)))))
>  
>  (defun notmuch-pick-button-activate (&optional button)
>    "Activate BUTTON or button at point
> @@ -218,7 +218,7 @@ FUNC."
>        ,(concat "(Close message pane and) " (documentation func t))
>       (interactive)
>       (notmuch-pick-close-message-window)
> -     (funcall #',func)))
> +     (call-interactively #',func)))
>  
>  (defvar notmuch-pick-mode-map
>    (let ((map (make-sparse-keymap)))
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

end of thread, other threads:[~2013-08-22 17:49 UTC | newest]

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