emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* email ui choices?
@ 2015-07-14  0:16 Matt Price
  2015-07-14  8:48 ` Juergen Christoffel
  0 siblings, 1 reply; 18+ messages in thread
From: Matt Price @ 2015-07-14  0:16 UTC (permalink / raw)
  To: Org Mode

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

Hi,

I still use thunderbird for email and will continue to do so for a while --
likely until concurrency is well-enough established that my mail client
hanging doesn't stop me from working.

However: I am jealous of the ease with which everyone emails subtrees
around, and I would like to be able to do that.  My current usecase is
marking student papers. I havea macro that generates this subtree

** Student name

| Clarity of Thesis | |
| Organization | |
| Presentation of Evidence | |
| Etc | |

I want to fill out this form, key in a command, and have emacs prompt me
for an email (or look the email up somewhere?) and generate a mail buffer
with this subtree as its contents; optionally attach a .doc or .pdf
attachement; and send the htmlized buffer for me, saving the sent mail
either to my IMAP Sent folder or my local mbox Sent folder.

It would be nice if it had access to my contacts, either via GMail or
through thunderbbird (those are synced, I think).

What's my best bet?

Thanks as always,
Matt

[-- Attachment #2: Type: text/html, Size: 1258 bytes --]

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

* Re: email ui choices?
  2015-07-14  0:16 email ui choices? Matt Price
@ 2015-07-14  8:48 ` Juergen Christoffel
  2015-07-14 10:51   ` Eric Abrahamsen
  0 siblings, 1 reply; 18+ messages in thread
From: Juergen Christoffel @ 2015-07-14  8:48 UTC (permalink / raw)
  To: emacs-orgmode

On Mon, Jul 13, 2015 at 08:16:29PM -0400, Matt Price wrote:
> [...]
>I want to fill out this form, key in a command, and have emacs prompt me
>for an email (or look the email up somewhere?) and generate a mail buffer
>with this subtree as its contents; optionally attach a .doc or .pdf
>attachement; and send the htmlized buffer for me, saving the sent mail
>either to my IMAP Sent folder or my local mbox Sent folder.

Matt,

you could either use Emacs' RMAIL-Mode to do this. Or you could try mutt
(which is the perfect companion to things like org-mode, IMO) als your
mailer. 

>It would be nice if it had access to my contacts, either via GMail or
>through thunderbbird (those are synced, I think).

I don't know about RMAIL and IMAP/Gmail (as I switched from RMAIL to mutt
years ago) but you should find hwotos for setting up mutt in conjuntion
with Gmail with Google.

Regards, JC

-- 
  A great many of today's security technologies are "secure" only because
  no-one has ever bothered attacking them. -- Peter Gutmann

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

* Re: email ui choices?
  2015-07-14  8:48 ` Juergen Christoffel
@ 2015-07-14 10:51   ` Eric Abrahamsen
  2015-07-14 11:10     ` Matt Price
  2015-07-14 11:35     ` Rasmus
  0 siblings, 2 replies; 18+ messages in thread
From: Eric Abrahamsen @ 2015-07-14 10:51 UTC (permalink / raw)
  To: emacs-orgmode

Juergen Christoffel <jc.org14@cynix.net> writes:

> On Mon, Jul 13, 2015 at 08:16:29PM -0400, Matt Price wrote:
>> [...]
>>I want to fill out this form, key in a command, and have emacs prompt me
>>for an email (or look the email up somewhere?) and generate a mail buffer
>>with this subtree as its contents; optionally attach a .doc or .pdf
>>attachement; and send the htmlized buffer for me, saving the sent mail
>>either to my IMAP Sent folder or my local mbox Sent folder.
>
> Matt,
>
> you could either use Emacs' RMAIL-Mode to do this. Or you could try mutt
> (which is the perfect companion to things like org-mode, IMO) als your
> mailer. 
>
>>It would be nice if it had access to my contacts, either via GMail or
>>through thunderbbird (those are synced, I think).
>
> I don't know about RMAIL and IMAP/Gmail (as I switched from RMAIL to mutt
> years ago) but you should find hwotos for setting up mutt in conjuntion
> with Gmail with Google.

I wonder if it's even necessary to have *any* sort of MUA set up in
Emacs, if all you're doing is sending email? Many email programs paper
over the distinction between sending and receiving/reading email, but I
think the Emacs-based tools preserve that distinction pretty well.

Message-mode is built in, and I use it in conjunction with the msmtp
program, like so:

(setq message-send-mail-function 'message-send-mail-with-sendmail)
(setq sendmail-program "msmtp")

Check the docstring for the *variable* `message-send-mail-function', and
that should get you started. If you're only using a single account for
sending, that should be significantly simpler. Look at
`user-mail-address' and all that.

Then just call `compose-mail'!

To answer the original question, the org-mime library in Org's
contrib/lisp directory is probably what you want for htmlizing buffers
and sending them as email.

Hope that helps,
Eric

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

* Re: email ui choices?
  2015-07-14 10:51   ` Eric Abrahamsen
@ 2015-07-14 11:10     ` Matt Price
  2015-07-14 11:27       ` Eric Abrahamsen
  2015-07-14 22:29       ` Juergen Christoffel
  2015-07-14 11:35     ` Rasmus
  1 sibling, 2 replies; 18+ messages in thread
From: Matt Price @ 2015-07-14 11:10 UTC (permalink / raw)
  Cc: Org Mode

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

On Tue, Jul 14, 2015 at 6:51 AM, Eric Abrahamsen <eric@ericabrahamsen.net>
wrote:

> Juergen Christoffel <jc.org14@cynix.net> writes:
>
>
> I wonder if it's even necessary to have *any* sort of MUA set up in
> Emacs, if all you're doing is sending email? Many email programs paper
> over the distinction between sending and receiving/reading email, but I
> think the Emacs-based tools preserve that distinction pretty well.
>

I'm wondering that too now!

>
> Message-mode is built in, and I use it in conjunction with the msmtp
> program, like so:
>
> (setq message-send-mail-function 'message-send-mail-with-sendmail)
> (setq sendmail-program "msmtp")
>

thank you for the pointer to msmtp

>
> Check the docstring for the *variable* `message-send-mail-function', and
> that should get you started. If you're only using a single account for
> sending, that should be significantly simpler. Look at
> `user-mail-address' and all that.
>
> Then just call `compose-mail'!
>
> To answer the original question, the org-mime library in Org's
> contrib/lisp directory is probably what you want for htmlizing buffers
> and sending them as email.
>
>
I've made some progress on this but it's not quite perfect.  I have this
function:
(defun mime-send-mail ()
"org-mime-subtree and HTMLize"
(interactive)
(org-mark-subtree)
;; wish I could get the PARENT headline here!
;; then figure out how to set subject to that headline!
(let ((subject  (nth 4 (org-heading-components))))
  (org-mime-subtree)
  (insert "\nBest,\nMP.\n")
  (org-mime-htmlize) ;; had to redefine so it could be called
non-interactively
  (command-execute 'mml-attach-file)
  (message-goto-to))
)

I've been thinking about it, and I would love to just have a link to the
student paper within org itself, and have the attachment added
automatically after org-mime-htmlize runs.  I'm not sure exactly how to do
that but if I figure it out I will let the group know.  I vaguely recall
I've seen other people describe such systems so I would appreciate guidance
if it's available.

Thanks again!
m



> Hope that helps,
> Eric
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 3320 bytes --]

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

* Re: email ui choices?
  2015-07-14 11:10     ` Matt Price
@ 2015-07-14 11:27       ` Eric Abrahamsen
  2015-07-14 20:51         ` Matt Price
  2015-07-14 22:29       ` Juergen Christoffel
  1 sibling, 1 reply; 18+ messages in thread
From: Eric Abrahamsen @ 2015-07-14 11:27 UTC (permalink / raw)
  To: emacs-orgmode

Matt Price <moptop99@gmail.com> writes:

> On Tue, Jul 14, 2015 at 6:51 AM, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:

[...]

> I've been thinking about it, and I would love to just have a link to the student paper within org itself, and have the attachment added automatically after org-mime-htmlize runs. I'm not sure
> exactly how to do that but if I figure it out I will let the group know. I vaguely recall I've seen other people describe such systems so I would appreciate guidance if it's available. 

I'll include a shameless-plug-cum-general-recommendation: I use
org-attach a lot to keep files associated with Org headings, and to me
this feels like a natural use-case for that.

I wrote a library called Gnorb (in the package manager) that provides
some glue-code between Gnus and Org (and BBDB), and there are a few
hooks in there that might be useful to you.

It sounds like you're digesting quite a bit all at once, so you probably
don't want to install all of Gnorb. If you're interested in some of the
bits, I might be able to peel those off into separate functions:
specifically, taking files from the org-attach directory and attaching
them to outgoing emails being sent from an Org heading. I can't promise
I could do it cleanly, but I'd be happy to look into it.

Eric

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

* Re: email ui choices?
  2015-07-14 10:51   ` Eric Abrahamsen
  2015-07-14 11:10     ` Matt Price
@ 2015-07-14 11:35     ` Rasmus
  2015-07-14 11:41       ` Eric Abrahamsen
  1 sibling, 1 reply; 18+ messages in thread
From: Rasmus @ 2015-07-14 11:35 UTC (permalink / raw)
  To: emacs-orgmode

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> (setq message-send-mail-function 'message-send-mail-with-sendmail)
> (setq sendmail-program "msmtp")

Emacs is pretty good at talking to smtp servers.  You can simply add a
header like this to your message (e.g. via `gnus-posting-styles' or
`message-default-headers'):

    X-Message-Smtp-Method: smtp smtp.email.com 465 rasmus

For saving the sent mail, Gnus uses the GCC header.  I don't know what
you'd do in the case of plain message.el.

Rasmus

-- 
Slaa Patienten ihjel, saa siger Feberen Pas

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

* Re: email ui choices?
  2015-07-14 11:35     ` Rasmus
@ 2015-07-14 11:41       ` Eric Abrahamsen
  2015-07-14 12:01         ` Rasmus
  0 siblings, 1 reply; 18+ messages in thread
From: Eric Abrahamsen @ 2015-07-14 11:41 UTC (permalink / raw)
  To: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> (setq message-send-mail-function 'message-send-mail-with-sendmail)
>> (setq sendmail-program "msmtp")
>
> Emacs is pretty good at talking to smtp servers.  You can simply add a
> header like this to your message (e.g. via `gnus-posting-styles' or
> `message-default-headers'):
>
>     X-Message-Smtp-Method: smtp smtp.email.com 465 rasmus
>
> For saving the sent mail, Gnus uses the GCC header.  I don't know what
> you'd do in the case of plain message.el.

I looked at my .gnus.el file, and found this:

;;; the following might be obviated by the X-SMTP-METHOD headers,
;;; except I don't think it will work for my case: the header is supposed to contain 
(defun cg-feed-msmtp ()
  (if (message-mail-p)
      (save-excursion
	(let* ((from
		(save-restriction
		  (message-narrow-to-headers)
		  (message-fetch-field "from")))
	       (account
		(cond
		 ;; I use email address as account label in ~/.msmtprc
		 ((string-match "eric@ericabrahamsen.net" from) "ea")
                 ;; many accounts...
		 ))
	  (setq message-sendmail-extra-arguments (list '"-a" account))))))

(setq message-sendmail-envelope-from 'header)
(add-hook 'message-send-mail-hook 'cg-feed-msmtp)


"the header is suppose to contain" WHAT?!? I will never know how that
comment was supposed to end, and it eats at me...

E

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

* Re: email ui choices?
  2015-07-14 11:41       ` Eric Abrahamsen
@ 2015-07-14 12:01         ` Rasmus
  2015-07-14 14:47           ` Jorge A. Alfaro-Murillo
  2015-07-15  1:14           ` Eric Abrahamsen
  0 siblings, 2 replies; 18+ messages in thread
From: Rasmus @ 2015-07-14 12:01 UTC (permalink / raw)
  To: emacs-orgmode

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Rasmus <rasmus@gmx.us> writes:
>
>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>
>>> (setq message-send-mail-function 'message-send-mail-with-sendmail)
>>> (setq sendmail-program "msmtp")
>>
>> Emacs is pretty good at talking to smtp servers.  You can simply add a
>> header like this to your message (e.g. via `gnus-posting-styles' or
>> `message-default-headers'):
>>
>>     X-Message-Smtp-Method: smtp smtp.email.com 465 rasmus
>>
>> For saving the sent mail, Gnus uses the GCC header.  I don't know what
>> you'd do in the case of plain message.el.
>
> I looked at my .gnus.el file, and found this:
>
> ;;; the following might be obviated by the X-SMTP-METHOD headers,
> ;;; except I don't think it will work for my case: the header is
> supposed to contain

How very frustrating....  My guess is that you have got bit rot on your
system.  Better call a professional.

In any case, I have moved ALL sending configuration to gnus-posting-style
and it's brilliant.  Before I was messing with hooks to change variables
before dispatching.


(setq gnus-posting-styles
        '(((lambda ()
             (rasmus/gnus-posting-style-identify
              '(".*") '(("To". "mymail\\.net")) nil "mymail"))
           (GCC "nnimap+mail:mymail/sent")
           (X-Message-SMTP-Method "smtp mymail.net 465 rasmus")
           (signature
            (or (ignore-errors
                  (cookie (concat user-emacs-directory "signatures") "" ""))
                "Send from my Emacs"))
           (Face (gnus-random-face))
           (address "rasmus@mymail.net")
           (Organization nil)
           (eval (setq smtpmail-stream-type 'ssl)))
           ;; work email omitted
          ((lambda ()
             (rasmus/gnus-posting-style-identify
              '("gmx\\|gmane\\|sunsite\\|emacs")
              '(("To" . "rasmus@gmx\\.us"))
              '(message-news-p)
              "gmx"))
           (name "Rasmus")
           (address "rasmus@gmx.us")
           (Organization nil)
           (GCC "nnimap+mail:gmx/sent")
           (X-Message-SMTP-Method "smtp mail.gmx.com 587 rasmus@gmx.us")
           (eval (setq smtpmail-stream-type nil)))))

`gnus-configure-posting-styles' is handy when changing profile OTG.

Rasmus

-- 
The Kids call him Billy the Saint

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

* Re: email ui choices?
  2015-07-14 12:01         ` Rasmus
@ 2015-07-14 14:47           ` Jorge A. Alfaro-Murillo
  2015-07-15  1:14           ` Eric Abrahamsen
  1 sibling, 0 replies; 18+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2015-07-14 14:47 UTC (permalink / raw)
  To: emacs-orgmode

Rasmus writes:

> In any case, I have moved ALL sending configuration to 
> gnus-posting-style and it's brilliant.  Before I was messing 
> with hooks to change variables before dispatching.

I agree, gnus-posting-styles is the way to go. Check: 

(info "(gnus) Posting Styles")

Best,
-- 
Jorge.

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

* Re: email ui choices?
  2015-07-14 11:27       ` Eric Abrahamsen
@ 2015-07-14 20:51         ` Matt Price
  2015-07-15  1:46           ` Eric Abrahamsen
  0 siblings, 1 reply; 18+ messages in thread
From: Matt Price @ 2015-07-14 20:51 UTC (permalink / raw)
  To: Org Mode

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

On Tue, Jul 14, 2015 at 7:27 AM, Eric Abrahamsen <eric@ericabrahamsen.net>
wrote:

> Matt Price <moptop99@gmail.com> writes:
>
> > On Tue, Jul 14, 2015 at 6:51 AM, Eric Abrahamsen <
> eric@ericabrahamsen.net> wrote:
>
> [...]
>
>
> I'll include a shameless-plug-cum-general-recommendation: I use
> org-attach a lot to keep files associated with Org headings, and to me
> this feels like a natural use-case for that.
>

Yes, it sounds like a pretty good idea.  I am trying to figure out a couple
of attachment issues; to start with, I was hoping to set a dnd-handler,
anmd have drag-and-dropping local files create an attachment. I am close,
but the actual attachment isn't being created. This is what I have:

(setq dnd-protocol-alist
      `(("^\\(file\\)://" . mwp-file-dnd) ,@dnd-protocol-alist))

(defun mwp-file-dnd (uri action)
  (cond ((eq major-mode 'org-mode)
         ;; (message uri)
         (insert "[[%s][Description Property")
         (org-attach-attach uri nil "lns" ) ;; this appears to work, but
doesn't create the link
         )
        (t
         (let ((dnd-protocol-alist
                (rassq-delete-all
                 'mwp-file-dnd
                 (copy-alist dnd-protocol-alist))))
           (dnd-handle-one-url nil action uri)))
        ))


> I wrote a library called Gnorb (in the package manager) that provides
> some glue-code between Gnus and Org (and BBDB), and there are a few
> hooks in there that might be useful to you.
>
> It sounds like you're digesting quite a bit all at once, so you probably
> don't want to install all of Gnorb. If you're interested in some of the
> bits, I might be able to peel those off into separate functions:
> specifically, taking files from the org-attach directory and attaching
> them to outgoing emails being sent from an Org heading. I can't promise
> I could do it cleanly, but I'd be happy to look into it.
>

If you could do that, that would be just super.  Right now my lone mailing
function sends me to message-mode:

  (defun mime-send-mail ()
    "org-mime-subtree and HTMLize"
    (interactive)
    (org-mark-subtree)
    (let ((subject  (nth 4 (org-heading-components))))
      (org-mime-subtree)
      (insert "\nBest,\nMP.\n")
      (org-mime-htmlize)
      (command-execute 'mml-attach-file)
      (message-goto-to)
      )
    )

mml-attach-file asks a whole bunch of questions about mime type, etc.  I
don't know how to fill those values in automatically, but I guess it would
be, in pseudo code

(dolist (thisfile org-attach-all-attachments) (mml-attach-file thisfile
FILL IN OTHER ARGUMENTS)

If you have something like that in gnorb that'd be awesome.  Thanks once
again,
Matt

[-- Attachment #2: Type: text/html, Size: 3836 bytes --]

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

* Re: email ui choices?
  2015-07-14 11:10     ` Matt Price
  2015-07-14 11:27       ` Eric Abrahamsen
@ 2015-07-14 22:29       ` Juergen Christoffel
  2015-07-14 23:22         ` Matt Price
  1 sibling, 1 reply; 18+ messages in thread
From: Juergen Christoffel @ 2015-07-14 22:29 UTC (permalink / raw)
  To: emacs-orgmode

On Tue, Jul 14, 2015 at 07:10:20AM -0400, Matt Price wrote:
> [...]
>(defun mime-send-mail ()
>"org-mime-subtree and HTMLize"
>(interactive)
>(org-mark-subtree)
>;; wish I could get the PARENT headline here!
>;; then figure out how to set subject to that headline!

Matt,

you can get to the PARENT headline like this:

(defun org-inspect ()
  (interactive)
  (org-mark-subtree)
  (save-excursion
    (re-search-backward "^\\* ")
    (message (nth 4 (org-heading-components)))
    (sit-for 2)))

and still have your marked subtree afterwards. Inserting these as headers
should be possible: 

 - set up a buffer with your subtree
 - go to the beginning of the buffer
 - add To: <your target address>
 - add Subject: <the heading component>
 - add empty line

Call (mail-send-and-exit) to send the message. Tested in Aquamacs under
OSX with its defaults, this brought up a Thunderbird [*] window with the To
and Subject filled in from the buffer. 

Selecting another MUA via Emacs' variables might work the same.

	--jc

[*] Yes, while I use mutt, Thunderbird is, for organizational reasons, my
unbeloved default mailer on this machine.

-- 
  A great many of today's security technologies are "secure" only because
  no-one has ever bothered attacking them. -- Peter Gutmann

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

* Re: email ui choices?
  2015-07-14 22:29       ` Juergen Christoffel
@ 2015-07-14 23:22         ` Matt Price
  0 siblings, 0 replies; 18+ messages in thread
From: Matt Price @ 2015-07-14 23:22 UTC (permalink / raw)
  To: Juergen Christoffel; +Cc: Org Mode

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

On Tue, Jul 14, 2015 at 6:29 PM, Juergen Christoffel <jc.org14@cynix.net>
wrote:

> On Tue, Jul 14, 2015 at 07:10:20AM -0400, Matt Price wrote:
>
>> [...]
>> (defun mime-send-mail ()
>> "org-mime-subtree and HTMLize"
>> (interactive)
>> (org-mark-subtree)
>> ;; wish I could get the PARENT headline here!
>> ;; then figure out how to set subject to that headline!
>>
>
> Matt,
>
> you can get to the PARENT headline like this:
>
> (defun org-inspect ()
>  (interactive)
>  (org-mark-subtree)
>  (save-excursion
>    (re-search-backward "^\\* ")
>    (message (nth 4 (org-heading-components)))
>    (sit-for 2)))
>
> and still have your marked subtree afterwards. Inserting these as headers
> should be possible:
> - set up a buffer with your subtree
> - go to the beginning of the buffer
> - add To: <your target address>
> - add Subject: <the heading component>
> - add empty line
>
> Call (mail-send-and-exit) to send the message. Tested in Aquamacs under
> OSX with its defaults, this brought up a Thunderbird [*] window with the To
> and Subject filled in from the buffer.
> Selecting another MUA via Emacs' variables might work the same.
>

Huh, that is totally cool.  Do you think it would be possible to do the
same thing with a mime/multipart message? WHen I try to run
org-mime-htmlize first, thunderbird doesn't recognize the parts.

>
>         --jc
>
> [*] Yes, while I use mutt, Thunderbird is, for organizational reasons, my
> unbeloved default mailer on this machine.
>
>
> --
>  A great many of today's security technologies are "secure" only because
>  no-one has ever bothered attacking them. -- Peter Gutmann
>
>
>

[-- Attachment #2: Type: text/html, Size: 2487 bytes --]

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

* Re: email ui choices?
  2015-07-14 12:01         ` Rasmus
  2015-07-14 14:47           ` Jorge A. Alfaro-Murillo
@ 2015-07-15  1:14           ` Eric Abrahamsen
  2015-07-15  8:56             ` Rasmus
  1 sibling, 1 reply; 18+ messages in thread
From: Eric Abrahamsen @ 2015-07-15  1:14 UTC (permalink / raw)
  To: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Rasmus <rasmus@gmx.us> writes:
>>
>>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>>
>>>> (setq message-send-mail-function 'message-send-mail-with-sendmail)
>>>> (setq sendmail-program "msmtp")
>>>
>>> Emacs is pretty good at talking to smtp servers.  You can simply add a
>>> header like this to your message (e.g. via `gnus-posting-styles' or
>>> `message-default-headers'):
>>>
>>>     X-Message-Smtp-Method: smtp smtp.email.com 465 rasmus
>>>
>>> For saving the sent mail, Gnus uses the GCC header.  I don't know what
>>> you'd do in the case of plain message.el.
>>
>> I looked at my .gnus.el file, and found this:
>>
>> ;;; the following might be obviated by the X-SMTP-METHOD headers,
>> ;;; except I don't think it will work for my case: the header is
>> supposed to contain
>
> How very frustrating....  My guess is that you have got bit rot on your
> system.  Better call a professional.
>
> In any case, I have moved ALL sending configuration to gnus-posting-style
> and it's brilliant.  Before I was messing with hooks to change variables
> before dispatching.
>
>
> (setq gnus-posting-styles
>         '(((lambda ()
>              (rasmus/gnus-posting-style-identify
>               '(".*") '(("To". "mymail\\.net")) nil "mymail"))
>            (GCC "nnimap+mail:mymail/sent")
>            (X-Message-SMTP-Method "smtp mymail.net 465 rasmus")
>            (signature
>             (or (ignore-errors
>                   (cookie (concat user-emacs-directory "signatures") "" ""))
>                 "Send from my Emacs"))
>            (Face (gnus-random-face))
>            (address "rasmus@mymail.net")
>            (Organization nil)
>            (eval (setq smtpmail-stream-type 'ssl)))
>            ;; work email omitted
>           ((lambda ()
>              (rasmus/gnus-posting-style-identify
>               '("gmx\\|gmane\\|sunsite\\|emacs")
>               '(("To" . "rasmus@gmx\\.us"))
>               '(message-news-p)
>               "gmx"))
>            (name "Rasmus")
>            (address "rasmus@gmx.us")
>            (Organization nil)
>            (GCC "nnimap+mail:gmx/sent")
>            (X-Message-SMTP-Method "smtp mail.gmx.com 587 rasmus@gmx.us")
>            (eval (setq smtpmail-stream-type nil)))))
>
> `gnus-configure-posting-styles' is handy when changing profile OTG.

But how does this handle composing new blank messages? What does
`rasmus/gnus-posting-style-identity' do exactly?

E

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

* Re: email ui choices?
  2015-07-14 20:51         ` Matt Price
@ 2015-07-15  1:46           ` Eric Abrahamsen
  0 siblings, 0 replies; 18+ messages in thread
From: Eric Abrahamsen @ 2015-07-15  1:46 UTC (permalink / raw)
  To: emacs-orgmode

Matt Price <moptop99@gmail.com> writes:

> On Tue, Jul 14, 2015 at 7:27 AM, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
>
>
>  Matt Price <moptop99@gmail.com> writes:
>
>  > On Tue, Jul 14, 2015 at 6:51 AM, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
>
>  [...]
>
>  I'll include a shameless-plug-cum-general-recommendation: I use
>  org-attach a lot to keep files associated with Org headings, and to me
>  this feels like a natural use-case for that.
>
>
> Yes, it sounds like a pretty good idea. I am trying to figure out a couple of attachment issues; to start with, I was hoping to set a dnd-handler, anmd have drag-and-dropping local files create an
> attachment. I am close, but the actual attachment isn't being created. This is what I have: 
>
> (setq dnd-protocol-alist
> `(("^\\(file\\)://" . mwp-file-dnd) ,@dnd-protocol-alist))
>
> (defun mwp-file-dnd (uri action)
> (cond ((eq major-mode 'org-mode)
> ;; (message uri)
> (insert "[[%s][Description Property")
> (org-attach-attach uri nil "lns" ) ;; this appears to work, but doesn't create the link
> )
> (t
> (let ((dnd-protocol-alist
> (rassq-delete-all
> 'mwp-file-dnd
> (copy-alist dnd-protocol-alist))))
> (dnd-handle-one-url nil action uri))) 
> ))

Unfortunately I've never used drag-and-drop anything, so won't really be
able to help there.

[...]

>  It sounds like you're digesting quite a bit all at once, so you probably
>  don't want to install all of Gnorb. If you're interested in some of the
>  bits, I might be able to peel those off into separate functions:
>  specifically, taking files from the org-attach directory and attaching
>  them to outgoing emails being sent from an Org heading. I can't promise
>  I could do it cleanly, but I'd be happy to look into it.
>
>
> If you could do that, that would be just super. Right now my lone mailing function sends me to message-mode: 
>
> (defun mime-send-mail ()
> "org-mime-subtree and HTMLize"
> (interactive)
> (org-mark-subtree)
> (let ((subject (nth 4 (org-heading-components))))
> (org-mime-subtree)
> (insert "\nBest,\nMP.\n")
> (org-mime-htmlize)
> (command-execute 'mml-attach-file)
> (message-goto-to)
> )
> )
>
> mml-attach-file asks a whole bunch of questions about mime type, etc. I don't know how to fill those values in automatically, but I guess it would be, in pseudo code
>
> (dolist (thisfile org-attach-all-attachments) (mml-attach-file thisfile FILL IN OTHER ARGUMENTS)
>
> If you have something like that in gnorb that'd be awesome. Thanks once again,

I've extracted some code that ought to be useful.

(defun org-attachment-list (&optional id)
  "Get a list of files (absolute filenames) attached to the
current heading, or the heading indicated by optional argument ID."
  (when (featurep 'org-attach)
    (let* ((attach-dir
	    (save-excursion
	      (when id
		(org-id-goto id))
	      (org-attach-dir t)))
	   (files
	    (mapcar
	     (lambda (f)
	       (expand-file-name f attach-dir))
	     (org-attach-file-list attach-dir))))
      files)))

(defun query-attach-files (files)
  (map-y-or-n-p
   (lambda (a) (format "Attach %s to outgoing message? "
		       (file-name-nondirectory a)))
   (lambda (a)
     (mml-attach-file a (mm-default-file-encoding a)
		      nil "attachment"))
   files
   '("file" "files" "attach")))

Then your entry point function could use those functions:

(defun mime-send-mail ()
  "org-mime-subtree and HTMLize"
  (interactive)
  (org-mark-subtree)
  (let ((subject (nth 4 (org-heading-components)))
	(files (org-attachment-list)))
    (org-mime-subtree)
    (insert "\nBest,\nMP.\n")
    (org-mime-htmlize)
    (query-attach-files files)
    (message-goto-to)))

See how that works for now -- there will be plenty of adjustments you
might want to make.

One thing that occurred to me is, because `org-mime-subtree' uses the
export process, you can use property substitution in the body of the
subtree/email. So if you have a property like "GRADE" or something, you
can insert that into the body at export time using
{{{property(GRADE)}}}. You didn't really ask for that, but I'll bet it
might come in handy.

Eric

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

* Re: email ui choices?
  2015-07-15  1:14           ` Eric Abrahamsen
@ 2015-07-15  8:56             ` Rasmus
  2015-07-15  9:27               ` Eric Abrahamsen
  0 siblings, 1 reply; 18+ messages in thread
From: Rasmus @ 2015-07-15  8:56 UTC (permalink / raw)
  To: emacs-orgmode

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> But how does this handle composing new blank messages?

When composing a new message it checks conditions (the first entry in a
list).  So in your gnus buffer you can put your cursor on the mail group
you want to send from and it'll pick up the appropriate profile.

Though personally I typically change the profile with
`rasmus/message-change-posting-style' after starting a new message buffer
(see below).  Sort of like how "Gnus Alias" but for posting-styles.

> What does `rasmus/gnus-posting-style-identity' do exactly?

I put the code here.  The λ you mention is just a way to combine more
match possibilities into one call to not repeat code.

        https://gitlab.com/snippets/6486

Rasmus

-- 
Don't panic!!!

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

* Re: email ui choices?
  2015-07-15  8:56             ` Rasmus
@ 2015-07-15  9:27               ` Eric Abrahamsen
  2015-07-15  9:37                 ` Rasmus
  0 siblings, 1 reply; 18+ messages in thread
From: Eric Abrahamsen @ 2015-07-15  9:27 UTC (permalink / raw)
  To: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> But how does this handle composing new blank messages?
>
> When composing a new message it checks conditions (the first entry in a
> list).  So in your gnus buffer you can put your cursor on the mail group
> you want to send from and it'll pick up the appropriate profile.
>
> Though personally I typically change the profile with
> `rasmus/message-change-posting-style' after starting a new message buffer
> (see below).  Sort of like how "Gnus Alias" but for posting-styles.

Ah, that's what I thought -- I really don't like having to go to a group
to compose a message of a certain type. I should probably just start
using gnus alias...

>> What does `rasmus/gnus-posting-style-identity' do exactly?
>
> I put the code here.  The λ you mention is just a way to combine more
> match possibilities into one call to not repeat code.
>
>         https://gitlab.com/snippets/6486

Thanks!

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

* Re: email ui choices?
  2015-07-15  9:27               ` Eric Abrahamsen
@ 2015-07-15  9:37                 ` Rasmus
  2015-07-16  3:27                   ` Eric Abrahamsen
  0 siblings, 1 reply; 18+ messages in thread
From: Rasmus @ 2015-07-15  9:37 UTC (permalink / raw)
  To: emacs-orgmode

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Rasmus <rasmus@gmx.us> writes:
>
>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>
>>> But how does this handle composing new blank messages?
>>
>> When composing a new message it checks conditions (the first entry in a
>> list).  So in your gnus buffer you can put your cursor on the mail group
>> you want to send from and it'll pick up the appropriate profile.
>>
>> Though personally I typically change the profile with
>> `rasmus/message-change-posting-style' after starting a new message buffer
>> (see below).  Sort of like how "Gnus Alias" but for posting-styles.
>
> Ah, that's what I thought -- I really don't like having to go to a group
> to compose a message of a certain type. I should probably just start
> using gnus alias...

I found GA not to be as "stable" as gnus-posting-style.  With the latter,
I always have the right reply address.  Gnus alias was somehow worse at
guessing this, though I don't remember the details any longer.

In my setup I can change the From-profile via C-c p, much like GA.  I
dream of adding such functionality to Gnus-proper one day (maybe after you
replaced nnoo with eieio :).

Rasmus

-- 
ツ

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

* Re: email ui choices?
  2015-07-15  9:37                 ` Rasmus
@ 2015-07-16  3:27                   ` Eric Abrahamsen
  0 siblings, 0 replies; 18+ messages in thread
From: Eric Abrahamsen @ 2015-07-16  3:27 UTC (permalink / raw)
  To: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Rasmus <rasmus@gmx.us> writes:
>>
>>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>>
>>>> But how does this handle composing new blank messages?
>>>
>>> When composing a new message it checks conditions (the first entry in a
>>> list).  So in your gnus buffer you can put your cursor on the mail group
>>> you want to send from and it'll pick up the appropriate profile.
>>>
>>> Though personally I typically change the profile with
>>> `rasmus/message-change-posting-style' after starting a new message buffer
>>> (see below).  Sort of like how "Gnus Alias" but for posting-styles.
>>
>> Ah, that's what I thought -- I really don't like having to go to a group
>> to compose a message of a certain type. I should probably just start
>> using gnus alias...
>
> I found GA not to be as "stable" as gnus-posting-style.  With the latter,
> I always have the right reply address.  Gnus alias was somehow worse at
> guessing this, though I don't remember the details any longer.
>
> In my setup I can change the From-profile via C-c p, much like GA.  I
> dream of adding such functionality to Gnus-proper one day (maybe after you
> replaced nnoo with eieio :).

Let's neither of us hold our breath on that one :)

But yes, it has always seemed to me like there was something missing in
Gnus proper here...

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

end of thread, other threads:[~2015-07-16  3:27 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-14  0:16 email ui choices? Matt Price
2015-07-14  8:48 ` Juergen Christoffel
2015-07-14 10:51   ` Eric Abrahamsen
2015-07-14 11:10     ` Matt Price
2015-07-14 11:27       ` Eric Abrahamsen
2015-07-14 20:51         ` Matt Price
2015-07-15  1:46           ` Eric Abrahamsen
2015-07-14 22:29       ` Juergen Christoffel
2015-07-14 23:22         ` Matt Price
2015-07-14 11:35     ` Rasmus
2015-07-14 11:41       ` Eric Abrahamsen
2015-07-14 12:01         ` Rasmus
2015-07-14 14:47           ` Jorge A. Alfaro-Murillo
2015-07-15  1:14           ` Eric Abrahamsen
2015-07-15  8:56             ` Rasmus
2015-07-15  9:27               ` Eric Abrahamsen
2015-07-15  9:37                 ` Rasmus
2015-07-16  3:27                   ` Eric Abrahamsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).