unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] notmuch.el: quote args in notmuch-show to facilitate remote use
@ 2010-01-24 20:22 Jesse Rosenthal
  2010-02-22 21:20 ` Jesse Rosenthal
  2010-04-13 16:17 ` Carl Worth
  0 siblings, 2 replies; 5+ messages in thread
From: Jesse Rosenthal @ 2010-01-24 20:22 UTC (permalink / raw)
  To: notmuch


Put single-quotes around the argument of the `show --entire-thread' command
in notmuch-show. This change should have no effect on normal usage.
However, it allows us to use the notmuch.el client with a remote notmuch
binary and database over ssh (by, e.g., setting `notmuch-command' to a
simple shell script). Without the quotes, ssh will not send the command
properly.

One very simple example script is as follows. (Note that it requires
keypair login to the ssh server.)

        #!/bin/sh

        SSH_BIN="/path/to/local/ssh"
        NOTMUCH_HOST="my.remote.server"
        NOTMUCH_REMOTE_PATH="/path/to/remote/notmuch"

        $SSH_BIN $NOTMUCH_HOST $NOTMUCH_REMOTE_PATH $@

---
 notmuch.el |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index e333f24..e6eef46 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -953,8 +953,10 @@ matching this search term are shown if non-nil. "
       (erase-buffer)
       (goto-char (point-min))
       (save-excursion
-	(let* ((basic-args (list notmuch-command nil t nil "show" "--entire-thread" thread-id))
-		(args (if query-context (append basic-args (list "and (" query-context ")")) basic-args)))
+	(let* ((basic-args (list notmuch-command nil t nil "show" "--entire-thread" "\'" thread-id))
+		(args (if query-context
+			  (append basic-args (list "and (" query-context ")\'"))
+			(append basic-args (list "\'")))))
 	  (apply 'call-process args)
 	  (when (and (eq (buffer-size) 0) query-context)
 	    (apply 'call-process basic-args)))
-- 
1.6.5.3

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

* Re: [PATCH] notmuch.el: quote args in notmuch-show to facilitate remote use
  2010-01-24 20:22 [PATCH] notmuch.el: quote args in notmuch-show to facilitate remote use Jesse Rosenthal
@ 2010-02-22 21:20 ` Jesse Rosenthal
  2010-04-13 16:17 ` Carl Worth
  1 sibling, 0 replies; 5+ messages in thread
From: Jesse Rosenthal @ 2010-02-22 21:20 UTC (permalink / raw)
  To: notmuch

The above patch and script don't deal with attachments or inline html,
both of which require (for now) that the mail file be present
locally. That may not be necessary with planned changed to notmuch in
the future.

For the time being, though, you can get attachments and html to work
with over TRAMP, by adding the following to your .emacs
file, which I'm sharing based on the encouragement of some folks on
IRC:

(setq notmuch-command "/script/in/the/above/message")

(setq notmuch-remote-host "you@your.remote.host")

;; tell notmuch-show-get-filename to use TRAMP to open the file

(defadvice notmuch-show-get-filename (around 
				      notmuch-show-get-remote-filename 
				      activate)
  (setq ad-return-value (concat "/ssh:"
				notmuch-remote-host
				":"
				ad-do-it)))

There's an annoying bit of redundancy in the fact that you have to
define your remote server both in the elisp and in the
shell-script. You could possibly extract it from the script if you
wanted to, but that seems like it might be prone to error.

Like the script, this requires password-less login to your ssh server.

You can also speed this up by using an already open connection, using
the ControlMaster feature in openssh.

All best,
Jesse

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

* Re: [PATCH] notmuch.el: quote args in notmuch-show to facilitate remote use
  2010-01-24 20:22 [PATCH] notmuch.el: quote args in notmuch-show to facilitate remote use Jesse Rosenthal
  2010-02-22 21:20 ` Jesse Rosenthal
@ 2010-04-13 16:17 ` Carl Worth
  2010-04-21 21:22   ` [PATCH] Reintroduce patch to " Jesse Rosenthal
  1 sibling, 1 reply; 5+ messages in thread
From: Carl Worth @ 2010-04-13 16:17 UTC (permalink / raw)
  To: Jesse Rosenthal, notmuch

[-- Attachment #1: Type: text/plain, Size: 627 bytes --]

On Sun, 24 Jan 2010 15:22:33 -0500, Jesse Rosenthal <jrosenthal@jhu.edu> wrote:
> Put single-quotes around the argument of the `show --entire-thread' command
> in notmuch-show.

Thanks for this, Jesse!

I've merged this change now, and (as documented) I don't notice any
change.

I am quite interested in playing with the "use notmuch over ssh" stuff
you've been doing, (and that you described in the original follow-up to
this patch).

Perhaps you (or someone else) would like to maintain a wiki page showing
how that can be used until we get remote support more properly
integrated into notmuch itself.

Thanks again,

-Carl

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* [PATCH] Reintroduce patch to quote args in notmuch-show to facilitate remote use
  2010-04-13 16:17 ` Carl Worth
@ 2010-04-21 21:22   ` Jesse Rosenthal
  2010-04-23 19:00     ` Carl Worth
  0 siblings, 1 reply; 5+ messages in thread
From: Jesse Rosenthal @ 2010-04-21 21:22 UTC (permalink / raw)
  To: Carl Worth, notmuch

This reintroduces the patch committed in 9193455fa1, which was
reverted during the upgrade to the JSON emacs UI.
---
 emacs/notmuch-show.el |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 916b39e..12e5d28 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -470,8 +470,8 @@ function is used. "
     (save-excursion
       (let* ((basic-args (list thread-id))
 	     (args (if query-context
-		       (append basic-args (list "and (" query-context ")"))
-		     basic-args)))
+		       (append (list "\"") basic-args (list "and (" query-context ")\""))
+		     (append (list "\"") basic-args (list "\"")))))
 	(notmuch-show-insert-forest (notmuch-query-get-threads args))
 	;; If the query context reduced the results to nothing, run
 	;; the basic query.
-- 
1.6.5.3

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

* Re: [PATCH] Reintroduce patch to quote args in notmuch-show to facilitate remote use
  2010-04-21 21:22   ` [PATCH] Reintroduce patch to " Jesse Rosenthal
@ 2010-04-23 19:00     ` Carl Worth
  0 siblings, 0 replies; 5+ messages in thread
From: Carl Worth @ 2010-04-23 19:00 UTC (permalink / raw)
  To: Jesse Rosenthal, notmuch

[-- Attachment #1: Type: text/plain, Size: 229 bytes --]

On Wed, 21 Apr 2010 17:22:08 -0400, Jesse Rosenthal <jrosenthal@jhu.edu> wrote:
> This reintroduces the patch committed in 9193455fa1, which was
> reverted during the upgrade to the JSON emacs UI.

Thanks. This is pushed.

-Carl

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2010-04-23 19:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-24 20:22 [PATCH] notmuch.el: quote args in notmuch-show to facilitate remote use Jesse Rosenthal
2010-02-22 21:20 ` Jesse Rosenthal
2010-04-13 16:17 ` Carl Worth
2010-04-21 21:22   ` [PATCH] Reintroduce patch to " Jesse Rosenthal
2010-04-23 19:00     ` Carl Worth

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).