unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Notmuch Ruby bindings
@ 2010-05-22  7:26 Ali Polatel
  2010-11-08 17:44 ` Carl Worth
  0 siblings, 1 reply; 6+ messages in thread
From: Ali Polatel @ 2010-05-22  7:26 UTC (permalink / raw)
  To: notmuch

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


Hey all,
I've written Ruby bindings for the notmuch library.

Here are related links:
Gitweb: http://github.com/alip/notmuch/tree/ruby
Git: git://github.com/alip/notmuch.git (branch ruby)
API documentation: http://dev.exherbo.org/~alip/notmuch/ruby/

Building is simple:
- Clone the git url mentioned above and switch to the ruby branch.
- Build the notmuch library
- cd bindings/ruby
- ruby extconf.rb
- make

This is written in pure C, unlike Python bindings, which uses
ctypes. This means it should be a bit faster but possibly more buggy,
especially the garbage collection routines. I've tried hard to make
Ruby's GC play nice with notmuch's talloc based memory allocation but I
can't be sure if it's bug-free.

I haven't written any examples yet but the API documentation should be
clear enough for one to understand and dive in.

As usual, any comments, patches welcome.

-- 
Regards,
Ali Polatel

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

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

* Re: Notmuch Ruby bindings
  2010-05-22  7:26 Notmuch Ruby bindings Ali Polatel
@ 2010-11-08 17:44 ` Carl Worth
  2010-11-08 17:47   ` Carl Worth
  0 siblings, 1 reply; 6+ messages in thread
From: Carl Worth @ 2010-11-08 17:44 UTC (permalink / raw)
  To: Ali Polatel, notmuch

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

On Sat, 22 May 2010 10:26:52 +0300, Ali Polatel <alip@exherbo.org> wrote:
> I've written Ruby bindings for the notmuch library.

Hi, Ali.

Thanks so much for writing these bindings and sharing them with the
community! I'm sorry it has taken me so long before I've responded to
your message announcing these.

> - Clone the git url mentioned above and switch to the ruby branch.
> - Build the notmuch library
> - cd bindings/ruby

I'm glad to see these implemented within the bindings directory of the
notmuch source code. If you'd be interested, I'd be happy to host these
bindings in the primary repository, (where you could just push changes
directly). I'll send you separate instructions if you're interested in
that.

-Carl

-- 
carl.d.worth@intel.com

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

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

* Re: Notmuch Ruby bindings
  2010-11-08 17:44 ` Carl Worth
@ 2010-11-08 17:47   ` Carl Worth
  2010-11-08 18:02     ` Carl Worth
  0 siblings, 1 reply; 6+ messages in thread
From: Carl Worth @ 2010-11-08 17:47 UTC (permalink / raw)
  To: Ali Polatel, notmuch

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

On Mon, 08 Nov 2010 09:44:53 -0800, Carl Worth <cworth@cworth.org> wrote:
> I'm glad to see these implemented within the bindings directory of the
> notmuch source code. If you'd be interested, I'd be happy to host these
> bindings in the primary repository, (where you could just push changes
> directly). I'll send you separate instructions if you're interested in
> that.

Here are those instructions. Just reply to this message and send me a
public ssh key, then I'll merge your ruby bindings to master, and set
things up so that you can push any future changes.

Thanks,

-Carl

-- 
carl.d.worth@intel.com

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

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

* Re: Notmuch Ruby bindings
  2010-11-08 17:47   ` Carl Worth
@ 2010-11-08 18:02     ` Carl Worth
  2010-11-08 19:21       ` Andreas Amann
  0 siblings, 1 reply; 6+ messages in thread
From: Carl Worth @ 2010-11-08 18:02 UTC (permalink / raw)
  To: Ali Polatel, notmuch

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

On Mon, 08 Nov 2010 09:47:19 -0800, Carl Worth <cworth@cworth.org> wrote:
> Here are those instructions. Just reply to this message and send me a
> public ssh key, then I'll merge your ruby bindings to master, and set
> things up so that you can push any future changes.

Bah. I had intended to send that message only to Ali, and not to the
list.

Now, where was that patch adding a "reply to sender only" binding... 

-Carl

-- 
carl.d.worth@intel.com

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

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

* Re: Notmuch Ruby bindings
  2010-11-08 18:02     ` Carl Worth
@ 2010-11-08 19:21       ` Andreas Amann
  2010-11-10  3:44         ` Rob Browning
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Amann @ 2010-11-08 19:21 UTC (permalink / raw)
  To: notmuch

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

On Mon, 08 Nov 2010 10:02:31 -0800, Carl Worth <cworth@cworth.org> wrote:
> Now, where was that patch adding a "reply to sender only" binding... 
> 

After a number of embarrassing mails I use the attached patch, which
changes the default behaviour of "r" to "reply to sender only". Usual
reply to everybody is "R". Maybe you prefer reversed binding?


Andreas



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-reply-to-sender-only-functionality.patch --]
[-- Type: text/x-patch, Size: 5731 bytes --]

Add reply to sender only functionality

This changes the default keybinding "r" in notmuch emacs interface to
mean "reply to sender only". This is an adapted version of a patch by
Michal Sojka.
---
 emacs/notmuch-mua.el  |    2 +-
 emacs/notmuch-show.el |   10 ++++++++--
 emacs/notmuch.el      |   12 ++++++++++--
 notmuch-reply.c       |    9 +++++++--
 notmuch.1             |    6 ++++++
 notmuch.c             |    3 +++
 6 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index dc7b386..2cf846e 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -75,7 +75,7 @@ list."
     ;; really only that the headers come first followed by a blank
     ;; line and then the body.
     (with-temp-buffer
-      (call-process notmuch-command nil t nil "reply" query-string)
+      (apply 'call-process (append (list notmuch-command nil t nil "reply") query-string))
       (goto-char (point-min))
       (if (re-search-forward "^$" nil t)
 	  (save-excursion
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 98a2fbc..b634b8d 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -563,7 +563,8 @@ function is used. "
 	(define-key map "s" 'notmuch-search)
 	(define-key map "m" 'notmuch-mua-mail)
 	(define-key map "f" 'notmuch-show-forward-message)
-	(define-key map "r" 'notmuch-show-reply)
+	(define-key map "R" 'notmuch-show-reply)
+	(define-key map "r" 'notmuch-show-reply-to-sender)
 	(define-key map "|" 'notmuch-show-pipe-message)
 	(define-key map "w" 'notmuch-show-save-attachments)
 	(define-key map "V" 'notmuch-show-view-raw-message)
@@ -870,7 +871,12 @@ any effects from previous calls to
 (defun notmuch-show-reply ()
   "Reply to the current message."
   (interactive)
-  (notmuch-mua-reply (notmuch-show-get-message-id)))
+  (notmuch-mua-reply (list (notmuch-show-get-message-id))))
+
+(defun notmuch-show-reply-to-sender ()
+  "Reply to the current message (only to the sender)."
+  (interactive)
+  (notmuch-mua-reply (list "--sender-only" (notmuch-show-get-message-id))))
 
 (defun notmuch-show-forward-message ()
   "Forward the current message."
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 2a87ab9..8897d09 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -203,7 +203,8 @@ For a mouse binding, return nil."
     (define-key map ">" 'notmuch-search-last-thread)
     (define-key map "p" 'notmuch-search-previous-thread)
     (define-key map "n" 'notmuch-search-next-thread)
-    (define-key map "r" 'notmuch-search-reply-to-thread)
+    (define-key map "R" 'notmuch-search-reply-to-thread)
+    (define-key map "r" 'notmuch-search-reply-to-thread-sender)
     (define-key map "m" 'notmuch-mua-mail)
     (define-key map "s" 'notmuch-search)
     (define-key map "o" 'notmuch-search-toggle-order)
@@ -427,7 +428,14 @@ Complete list of currently available key bindings:
   "Begin composing a reply to the entire current thread in a new buffer."
   (interactive)
   (let ((message-id (notmuch-search-find-thread-id)))
-    (notmuch-mua-reply message-id)))
+    (notmuch-mua-reply (list message-id))))
+
+(defun notmuch-search-reply-to-thread-sender ()
+  "Begin composing a reply to the sender only of the  current thread in a new buffer."
+  (interactive)
+  (let ((message-id (notmuch-search-find-thread-id)))
+    (notmuch-mua-reply (list "--sender-only" message-id))))
+
 
 (defun notmuch-call-notmuch-process (&rest args)
   "Synchronously invoke \"notmuch\" with the given list of arguments.
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 23d04b8..886157a 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -24,6 +24,8 @@
 #include "gmime-filter-reply.h"
 #include "gmime-filter-headers.h"
 
+static notmuch_bool_t sender_only = FALSE;
+
 static void
 reply_part_content (GMimeObject *part)
 {
@@ -272,6 +274,7 @@ add_recipients_from_message (GMimeMessage *reply,
     };
     const char *from_addr = NULL;
     unsigned int i;
+    unsigned int max;
 
     /* Some mailing lists munge the Reply-To header despite it being A Bad
      * Thing, see http://www.unicom.com/pw/reply-to-harmful.html
@@ -288,8 +291,8 @@ add_recipients_from_message (GMimeMessage *reply,
 	reply_to_map[0].header = "from";
 	reply_to_map[0].fallback = NULL;
     }
-
-    for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) {
+    max = sender_only ? 1 : ARRAY_SIZE (reply_to_map);
+    for (i = 0; i < max; i++) {
 	const char *addr, *recipients;
 
 	recipients = notmuch_message_get_header (message,
@@ -595,6 +598,8 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
 		fprintf (stderr, "Invalid value for --format: %s\n", opt);
 		return 1;
 	    }
+	} else if (STRNCMP_LITERAL (argv[i], "--sender-only") == 0) {
+	    sender_only = TRUE;
 	} else {
 	    fprintf (stderr, "Unrecognized option: %s\n", argv[i]);
 	    return 1;
diff --git a/notmuch.1 b/notmuch.1
index 2c33749..6bd5dc0 100644
--- a/notmuch.1
+++ b/notmuch.1
@@ -353,6 +353,12 @@ Includes subject and quoted message body.
 .BR headers\-only
 Only produces In\-Reply\-To, References, To, Cc, and Bcc headers.
 .RE
+.TP 4
+.B \-\-sender\-only
+
+Only setup the To: header as described above, not the additional Cc
+headers.
+.RE
 
 See the
 .B "SEARCH SYNTAX"
diff --git a/notmuch.c b/notmuch.c
index 030e494..1780dbe 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -297,6 +297,9 @@ command_t commands[] = {
       "\t\t\tOnly produces In-Reply-To, References, To\n"
       "\t\t\tCc, and Bcc headers.\n"
       "\n"
+      "\t\t--sender-only\n"
+      "\t\t\tReply only to sender.\n"
+      "\n"
       "\tSee \"notmuch help search-terms\" for details of the search\n"
       "\tterms syntax." },
     { "tag", notmuch_tag_command,
-- 
1.7.2.3


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

* Re: Notmuch Ruby bindings
  2010-11-08 19:21       ` Andreas Amann
@ 2010-11-10  3:44         ` Rob Browning
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Browning @ 2010-11-10  3:44 UTC (permalink / raw)
  To: Andreas Amann; +Cc: notmuch

Andreas Amann <amann@physik.tu-berlin.de> writes:

> After a number of embarrassing mails I use the attached patch, which
> changes the default behaviour of "r" to "reply to sender only". Usual
> reply to everybody is "R". Maybe you prefer reversed binding?

At least in gnus:

 r - start reply to author
 R - start reply to author, including a copy of the original
 f - start reply to all
 F - start reply to all, including a copy of the original

I believe f/F probably respect Mail-Followup-To.

FWIW
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4

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

end of thread, other threads:[~2010-11-10  3:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-22  7:26 Notmuch Ruby bindings Ali Polatel
2010-11-08 17:44 ` Carl Worth
2010-11-08 17:47   ` Carl Worth
2010-11-08 18:02     ` Carl Worth
2010-11-08 19:21       ` Andreas Amann
2010-11-10  3:44         ` Rob Browning

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