Quantcast

Notmuch Emacs reply format=JSON

classic Classic list List threaded Threaded
6 messages Options
bserrao bserrao
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Notmuch Emacs reply format=JSON

Hello,

I need some help in changing the default reply format to JSON in notmuch-emacs.
I've looked in the docs and there's this option:

"Supported options for reply include

--format=(default|json|sexp|headers-only)"

But i can't figure out how to setup emacs to use this option. (Sorry, i guess it's an easy one, but i'm new to the emacs world)

Also i've searched the forum and the web, and the only thing i've found was some old posts with patches to notmuch itself. I guess it was meant to be used before this option has been included.

Thanks,
Cheers
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Notmuch Emacs reply format=JSON

bserrao <[hidden email]> writes:

> Hello,
>
> I need some help in changing the default reply format to JSON in
> notmuch-emacs.
> I've looked in the docs and there's this option:
>

I'm afraid I don't understand what behaviour you want.  Internally
notmuch-emacs uses --format=sexp to communicate with the CLI, but this
output contains the same information --format=json.

d
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
bserrao bserrao
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Notmuch Emacs reply format=JSON

Well, at work almost everyone uses Outlook (Exchange Server) and send HTML mails. I've made a script to convert mail to html before sending, but when replying emacs uses de '>' character has quotation and because of it the mail gets messed up when i do the conversion.
From what i've read i've concluded that if using the format=json those HTML pieces were handled differently...maybe i'm wrong. I was just trying to find a solution/workaround to deal with this.

Thanks, and sorry for my bad english.

Bruno

On Sat, Mar 11, 2017 at 5:17 PM David Bremner-2 [via notmuch] <[hidden email]> wrote:
bserrao <[hidden email]> writes:

> Hello,
>
> I need some help in changing the default reply format to JSON in
> notmuch-emacs.
> I've looked in the docs and there's this option:
>

I'm afraid I don't understand what behaviour you want.  Internally
notmuch-emacs uses --format=sexp to communicate with the CLI, but this
output contains the same information --format=json.

d
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch



If you reply to this email, your message will be added to the discussion below:
http://notmuch.198994.n3.nabble.com/Notmuch-Emacs-reply-format-JSON-tp4037188p4037213.html
To unsubscribe from Notmuch Emacs reply format=JSON, click here.
NAML
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Notmuch Emacs reply format=JSON

bserrao <[hidden email]> writes:

> Well, at work almost everyone uses Outlook (Exchange Server) and send HTML
> mails. I've made a script to convert mail to html before sending, but when
> replying emacs uses de '>' character has quotation and because of it the
> mail gets messed up when i do the conversion.
> From what i've read i've concluded that if using the format=json those HTML
> pieces were handled differently...maybe i'm wrong. I was just trying to
> find a solution/workaround to deal with this.

I guess the first step is to test on the command line with

% notmuch reply --format=json id:foo

and

% notmuch reply --format=sexp id:foo

where id:foo is some message-id in your notmuch database.

In both cases you'll get a kind of data structure that you can process
how you like, but I think the strings inside are pretty much the same.

If you're trying to modify elisp, the actual function is
notmuch-mua-reply

I'm afraid I don't have any specific advice about sending HTML.

d

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Brian Sniffen-2 Brian Sniffen-2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Notmuch Emacs reply format=JSON

In reply to this post by bserrao
You might like
[org-mime](http://orgmode.org/worg/org-contrib/org-mime.html) or
`mimedown`:

    ; For writing pretty mail
    (defun mimedown ()
      (interactive)
      (save-excursion
        (message-goto-body)
        (mml-unsecure-message)
        (let* ((sig-point (save-excursion (message-goto-signature) (forward-line -1) (point)))
               (orig-txt (buffer-substring-no-properties (point) sig-point)))
          (shell-command-on-region (point) sig-point "/usr/local/bin/pandoc --from markdown --to html --smart --standalone" nil t)
          (insert "
\n") (exchange-point-and-mark) (insert "\n

At least as seeds for your own work.  Mimedown copes smoothly with `>`
for replies, and was used for this message.  org-mime not so much---it
preserves line breaks, but leaves them as `>` prefixes, rather than
using a blockquote.

-Brian

bserrao <[hidden email]> writes:

> Well, at work almost everyone uses Outlook (Exchange Server) and send HTML
> mails. I've made a script to convert mail to html before sending, but when
> replying emacs uses de '>' character has quotation and because of it the
> mail gets messed up when i do the conversion.
> From what i've read i've concluded that if using the format=json those HTML
> pieces were handled differently...maybe i'm wrong. I was just trying to
> find a solution/workaround to deal with this.
>
> Thanks, and sorry for my bad english.
>
> Bruno
>
> On Sat, Mar 11, 2017 at 5:17 PM David Bremner-2 [via notmuch] <
> [hidden email]> wrote:
>
>> bserrao <[hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=4037213&i=0>> writes:
>>
>> > Hello,
>> >
>> > I need some help in changing the default reply format to JSON in
>> > notmuch-emacs.
>> > I've looked in the docs and there's this option:
>> >
>>
>> I'm afraid I don't understand what behaviour you want.  Internally
>> notmuch-emacs uses --format=sexp to communicate with the CLI, but this
>> output contains the same information --format=json.
>>
>> d
>> _______________________________________________
>> notmuch mailing list
>> [hidden email] <http:///user/SendEmail.jtp?type=node&node=4037213&i=1>
>> https://notmuchmail.org/mailman/listinfo/notmuch
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://notmuch.198994.n3.nabble.com/Notmuch-Emacs-reply-format-JSON-tp4037188p4037213.html
>> To unsubscribe from Notmuch Emacs reply format=JSON, click here
>> <
>> .
>> NAML
>> <
http://notmuch.198994.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
>
> --
> View this message in context: http://notmuch.198994.n3.nabble.com/Notmuch-Emacs-reply-format-JSON-tp4037188p4037238.html
> Sent from the notmuch mailing list archive at Nabble.com.
> _______________________________________________
> notmuch mailing list
> [hidden email]
> https://notmuchmail.org/mailman/listinfo/notmuch

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
bserrao bserrao
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Notmuch Emacs reply format=JSON

Brian, thank you :D
The org-mime did it, sorry for the late reply but only now i had some time to try it... I'm only facing some trouble when forwarding messages, but i'm pretty sure i can find a solution for it.

Cheers!!
Loading...