Re: [O] email ui choices?

2015-07-14 Thread Matt Price
On Tue, Jul 14, 2015 at 6:51 AM, Eric Abrahamsen e...@ericabrahamsen.net
wrote:

 Juergen Christoffel jc.or...@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






[O] importing and compliting contacts [WAS:email ui choices?]

2015-07-14 Thread Matt Price
Also, I'm wondering what the best way is to deal with contacts.  Can I
import my existing contacts into org-contacts? And if so, do I get tab
completion in a message-mode buffer for those contacts?


Re: [O] email ui choices?

2015-07-14 Thread Eric Abrahamsen
Juergen Christoffel jc.or...@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





Re: [O] email ui choices?

2015-07-14 Thread Juergen Christoffel

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




Re: [O] email ui choices?

2015-07-14 Thread Eric Abrahamsen
Matt Price mopto...@gmail.com writes:

 On Tue, Jul 14, 2015 at 6:51 AM, Eric Abrahamsen e...@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




Re: [O] email ui choices?

2015-07-14 Thread Rasmus
Eric Abrahamsen e...@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




Re: [O] email ui choices?

2015-07-14 Thread Eric Abrahamsen
Rasmus ras...@gmx.us writes:

 Eric Abrahamsen e...@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 e...@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





Re: [O] email ui choices?

2015-07-14 Thread Rasmus
Eric Abrahamsen e...@ericabrahamsen.net writes:

 Rasmus ras...@gmx.us writes:

 Eric Abrahamsen e...@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 ras...@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 ras...@gmx.us)
   (Organization nil)
   (GCC nnimap+mail:gmx/sent)
   (X-Message-SMTP-Method smtp mail.gmx.com 587 ras...@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




Re: [O] email ui choices?

2015-07-14 Thread Jorge A. Alfaro-Murillo

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.




Re: [O] importing and compliting contacts [WAS:email ui choices?]

2015-07-14 Thread Titus von der Malsburg

On 2015-07-14 Tue 04:12, Matt Price wrote:
 Also, I'm wondering what the best way is to deal with contacts.  Can I
 import my existing contacts into org-contacts? And if so, do I get tab
 completion in a message-mode buffer for those contacts?

I wrote a little python script that reads vCard files and generates
org-contacts:

  https://gist.github.com/tmalsburg/9747104

Titus



signature.asc
Description: PGP signature


Re: [O] importing and compliting contacts [WAS:email ui choices?]

2015-07-14 Thread Jorge A. Alfaro-Murillo

Matt Price writes:

Also, I'm wondering what the best way is to deal with contacts. 
Can I import my existing contacts into org-contacts? 


Where do you have your contacts right now?

And if so, do I get tab completion in a message-mode buffer for 
those contacts?


Yes, at least I'm sure about it in the default message mode which 
is the one that I use.


--
Jorge.




[O] long code blocks making Org Mode very slow

2015-07-14 Thread Angus M
I'm trying to run a long Python code block (~4000 lines) in org mode.  The
code is sandwiched between:
#+begin_src python
python code block
#+end_src

It runs fine, but org mode becomes incredibly slow - when typing text there
is about a 10 second delay before the character appears on the screen.  If I
reduce the number of lines of code in the block there is a noticeable
increase in speed.

I am not using line numbers, and the delay is not ameliorated by turning off
fontification.

If I add a semi-colon before #+begin_src, to comment it off (get rid of src
environment), then org mode returns to it's normal speed.

Do I just have to accept that long code blocks can't be entered into Org Mode?  

Any help would be appreciated.  I am running Org Mode (version 8.2.10) on
Windows 8.

Thanks

Angus M




Re: [O] long code blocks making Org Mode very slow

2015-07-14 Thread Nick Dokos
Angus M anguscmelvi...@gmail.com writes:

 I'm trying to run a long Python code block (~4000 lines) in org mode.  The
 code is sandwiched between:
 #+begin_src python
 python code block
 #+end_src

 It runs fine, but org mode becomes incredibly slow - when typing text there
 is about a 10 second delay before the character appears on the screen.  If I
 reduce the number of lines of code in the block there is a noticeable
 increase in speed.


That's because a) emacs is single-threaded and b) babel blocks are
executed synchronously. emacs waits for the code block to finish
executing before going on with its business.

See e.g. the thread at

http://article.gmane.org/gmane.emacs.orgmode/83704

 I am not using line numbers, and the delay is not ameliorated by turning off
 fontification.

 If I add a semi-colon before #+begin_src, to comment it off (get rid of src
 environment), then org mode returns to it's normal speed.

 Do I just have to accept that long code blocks can't be entered into Org 
 Mode?  


Now I'm confused: are you executing the code block or aren't you?

IIUC, code blocks can be of arbitrary length: but if you try to run one, you
gotta wait till it finishes. Is that what you are complaining about or
do you see something else?

 Any help would be appreciated.  I am running Org Mode (version 8.2.10) on
 Windows 8.


Nick




Re: [O] ox-latex: default packages cleaning

2015-07-14 Thread Marcin Borkowski

On 2015-07-07, at 16:53, Rasmus ras...@gmx.us wrote:

 Hi,

Hi,

and sorry for my delay – I have a huge email backlog...

 We could do some cleaning of org-default-package-alist before Org 8.3.

Yes, yes, yes!

 * tolerance

 Why is \\tolerance=1000 part of org-default-package-alist?  Is this
 value good for all languages?  If we keep it, it should be configurable.
 But people who explicitly wants this behavior can probably add it
 themselves.

 If it's a means to archive high-quality paragraphs, maybe microtype is
 probably the 'proper' fix...

My suggestion: forget about \tolerance.  It’s low-level TeX stuff,
hardly anybody knows what it does, really (it is one of the dozen or two
parameters governing the line-breaking algorithm), and most people would
not see any difference anyway.  I wouldn’t add microtype, OTOH.  One
reason: it issues a lot of warnings when you use a font it does not
know.  It doesn’t hurt, but some people don’t like warnings.  Also, some
people might not really /want/ microtype – it messes around with font
widths, and even with the default settings (which are rather
conservative), it can look a bit strange.

 * Fixltx2e

 This packages is depreciated with TL2015 cf. LaTeX News 22.  We can use
 \RequirePackage[current]{latexrelease} but there's no point in that
 AFAIK latexrelease only useful for backwards compatibility.

Didn’t even know that.

 * marvosym¹ 
 * Wasysym² 

My opinion: remove both.

 Rasmus

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



Re: [O] email ui choices?

2015-07-14 Thread Matt Price
On Tue, Jul 14, 2015 at 7:27 AM, Eric Abrahamsen e...@ericabrahamsen.net
wrote:

 Matt Price mopto...@gmail.com writes:

  On Tue, Jul 14, 2015 at 6:51 AM, Eric Abrahamsen 
 e...@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


[O] file or headline-local template for new subtree?

2015-07-14 Thread Matt Price
I have this new system, in which I create a new subtree for every paper I
grade. I'd love to have the new subtree automatically populated by a
mostly-empty table on cration. Is this something I can do on a per-file
basis; or perhaps even something I can change with every level 1 heading?
I can think of a couple uses for this, actually.

Thx,
matt


Re: [O] long code blocks making Org Mode very slow

2015-07-14 Thread Sebastien Vauban
Angus M anguscmelvi...@gmail.com writes:
 I'm trying to run a long Python code block (~4000 lines) in org mode.  The
 code is sandwiched between:
 #+begin_src python
 python code block
 #+end_src

 It runs fine, but org mode becomes incredibly slow - when typing text there
 is about a 10 second delay before the character appears on the screen.  If I
 reduce the number of lines of code in the block there is a noticeable
 increase in speed.

 I am not using line numbers, and the delay is not ameliorated by turning off
 fontification.

 If I add a semi-colon before #+begin_src, to comment it off (get rid of src
 environment), then org mode returns to it's normal speed.

The best thing to do, now, is run the profiler:

M-x profiler-start
... type one character (which takes 10 s to be rendered)
M-x profiler-report

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] file or headline-local template for new subtree?

2015-07-14 Thread Rasmus
Matt Price mopto...@gmail.com writes:

 I have this new system, in which I create a new subtree for every paper I
 grade. I'd love to have the new subtree automatically populated by a
 mostly-empty table on cration. Is this something I can do on a per-file
 basis; or perhaps even something I can change with every level 1 heading?
 I can think of a couple uses for this, actually.

I'm fond of org-structure-template-alist, but it might not be powerful
enough for what you want here.  On a per file basis you could bind some
letter in org-structure-template-alist.  ATM it cannot guess how to insert
a subtree.  But there's org-insert-subheading.

Rasmus

-- 
El Rey ha muerto. ¡Larga vida al Rey!




Re: [O] long code blocks making Org Mode very slow

2015-07-14 Thread Angus M
Sebastien Vauban sva-news@... writes:

 
 Angus M anguscmelville@... writes:
  I'm trying to run a long Python code block (~4000 lines) in org mode.  The
  code is sandwiched between:
  #+begin_src python
  python code block
  #+end_src
 
  It runs fine, but org mode becomes incredibly slow - when typing text there
  is about a 10 second delay before the character appears on the screen.  If I
  reduce the number of lines of code in the block there is a noticeable
  increase in speed.
 
  I am not using line numbers, and the delay is not ameliorated by turning off
  fontification.
 
  If I add a semi-colon before #+begin_src, to comment it off (get rid of src
  environment), then org mode returns to it's normal speed.
 
 The best thing to do, now, is run the profiler:
 
 M-x profiler-start
 ... type one character (which takes 10 s to be rendered)
 M-x profiler-report
 
 Best regards,
   Seb
 

Many thanks.

I've run the profiler, but am not quite sure what to make of the result
(fully expanded):

- ...1199  99%
 - while 1194  98%
  - cond 1194  98%
   - setq1194  98%
- org-footnote-at-reference-p1194  98%
 - if1194  98%
  - save-excursion   1179  97%
   - org-footnote-in-valid-context-p 1179  97%
- let1179  97%
 - unwind-protect1179  97%
  - progn1179  97%
   - not 1179  97%
- or 1179  97%
 - org-in-block-p1177  97%
  - let  1177  97%
   - unwind-protect  1177  97%
- progn  1177  97%
 - catch 1177  97%
  - let  1177  97%
   - mapc1168  96%
- #lambda 0x1bd609a3   1168  96%
 - let   1168  96%
  - if   1168  96%
   - org-between-regexps-p   1168  96%
- let1168  96%
 - unwind-protect1168  96%
  - progn1167  96%
   - let 1167  96%
- or  672  55%
 - save-excursion 672  55%
outline-next-heading478  39%
outline-previous-heading193  15%
- save-excursion  495  40%
 - and495  40%
  - or291  24%
   - org-at-regexp-p1   0%
- catch 1   0%
 - save-excursion   1   0%
let 1   0%
not   115   9%
   - save-excursion 9   0%
  outline-previous-heading  8   0%
  outline-next-heading  1   0%
 - org-in-verbatim-emphasis 2   0%
  - let 2   0%
   - unwind-protect 2   0%
- progn 2   0%
 - and  2   0%
  - org-in-regexp   2   0%
   - catch  2   0%
- let   2   0%
 - save-excursion   1   0%
  - beginning-of-line   1   0%
   

Re: [O] long code blocks making Org Mode very slow

2015-07-14 Thread Angus M
Nick Dokos ndokos at gmail.com writes:

Many thanks for your help Nick - see comments below

  I'm trying to run a long Python code block (~4000 lines) in org mode.  The
  code is sandwiched between:
  #+begin_src python
  python code block
  #+end_src
 
  It runs fine, but org mode becomes incredibly slow - when typing text there
  is about a 10 second delay before the character appears on the screen.  If I
  reduce the number of lines of code in the block there is a noticeable
  increase in speed.
 
 
 That's because a) emacs is single-threaded and b) babel blocks are
 executed synchronously. emacs waits for the code block to finish
 executing before going on with its business.

Perhaps I should have been clearer: org mode is incredibly slow to respond
(to a key press or to scrolling) even before a block is executed.  It is not
an issue with waiting for a code block to finish executing.  

  I am not using line numbers, and the delay is not ameliorated by turning off
  fontification.
 
  If I add a semi-colon before #+begin_src, to comment it off (get rid of src
  environment), then org mode returns to it's normal speed.
 
  Do I just have to accept that long code blocks can't be entered into Org
Mode?  
 
 
 Now I'm confused: are you executing the code block or aren't you?
 
 IIUC, code blocks can be of arbitrary length: but if you try to run one, you
 gotta wait till it finishes. Is that what you are complaining about or
 do you see something else?

No, I wasn't executing the code block.  I just wanted to point out that the
org mode slow down was only when the system could see that the long code
block was present, i.e. by removing the src environment, by commenting off
the #+begin_src marker, the delay disappeared.








Re: [O] email ui choices?

2015-07-14 Thread Eric Abrahamsen
Matt Price mopto...@gmail.com writes:

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


  Matt Price mopto...@gmail.com writes:

   On Tue, Jul 14, 2015 at 6:51 AM, Eric Abrahamsen e...@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




Re: [O] email ui choices?

2015-07-14 Thread Juergen Christoffel

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




Re: [O] email ui choices?

2015-07-14 Thread Matt Price
On Tue, Jul 14, 2015 at 6:29 PM, Juergen Christoffel jc.or...@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





Re: [O] email ui choices?

2015-07-14 Thread Eric Abrahamsen
Rasmus ras...@gmx.us writes:

 Eric Abrahamsen e...@ericabrahamsen.net writes:

 Rasmus ras...@gmx.us writes:

 Eric Abrahamsen e...@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 ras...@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 ras...@gmx.us)
(Organization nil)
(GCC nnimap+mail:gmx/sent)
(X-Message-SMTP-Method smtp mail.gmx.com 587 ras...@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




Re: [O] ox-latex: default packages cleaning

2015-07-14 Thread Marcin Borkowski

On 2015-07-07, at 21:35, Suvayu Ali fatkasuvayu+li...@gmail.com wrote:

 I would like to second microtype.  In fact as far as I know, now a days
 it is recommended to load that for almost all documents with significant
 text on TeX.SX.

As I wrote a minute ago, I would rather not add microtype, though it's
a minor thing, really.

 I would also suggest removing inputenc.  At the moment, it is loaded
 with the AUTO option.  AFAIK, this is redundant since most recent
 (meaning for quite a few years) TeX engines already use the encoding of
 the file if nothing is specified.

Can you elaborate on that?  AFAIK, XeTeX and LuaTeX use UTF-8 by
default, but pdfetex (which is the default LaTeX engine) does not.  And
quite a lot of people ose pdfetex (me included;-)).  I haven't heard
about any heuristic determination of encoding by TeX (and I hope nothing
like that happens, since it could be disastrous).

 The next one would be fontenc, now it is loaded with T1.  I'm not sure
 if this is needed.  Maybe LaTeX experts like Marcin or Fabrice could
 comment.

Thanks for calling me an expert, though I'm not one regarding fonts and
their encodings;-).

With fontenc, the thing is tricky.  I do not know much about other
languages, but you actually can't use LaTeX to typeset texts in Polish
without changing the default LaTeX's font encoding (which is OT1, and it
doesn't support some Polish letters).  (Usually, I do not use fontenc
for that, since there is a specialized package for Polish typesetting.)

I guess that removing fontenc for non-English texts might lead to
erroneous results – at least in case of presence of certain Polish words
(e.g., some names in bibliographies).  I guess we don’t want that.

OTOH, one thing we /might/ want to add is \usepackage{lmodern}.  The
Latin Modern family of fonts is a drop-in replacement for the default
Computer Modern, but with all sorts of accented characters.  Using this
font family has the advantage that accented characters are not build
from letters and accents, but are single glyphs in the font.  AFAIR,
this makes words containing accented letters hyphenatable.  Not a huge
gain, but sometimes may be important (especially in some languages, and
with narrow columns).

 We could also take this opportunity to provide users an easy way to
 switch between TeX engines.

I second that!

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



Re: [O] file or headline-local template for new subtree?

2015-07-14 Thread Mike McLean
On Tue, Jul 14, 2015 at 5:31 PM, Rasmus ras...@gmx.us wrote:

 Matt Price mopto...@gmail.com writes:

  I have this new system, in which I create a new subtree for every paper I
  grade. I'd love to have the new subtree automatically populated by a
  mostly-empty table on cration. Is this something I can do on a per-file
  basis; or perhaps even something I can change with every level 1 heading?
  I can think of a couple uses for this, actually.

 I'm fond of org-structure-template-alist, but it might not be powerful
 enough for what you want here.  On a per file basis you could bind some
 letter in org-structure-template-alist.  ATM it cannot guess how to insert
 a subtree.  But there's org-insert-subheading.


Something I do alot of is have Org Capture templates as files. This lets me
write a more complex capture template (in my case for one of several
“roles” that I take on ad-hoc but recurring basis during meetings).

I call the template with an entry like the following in
org-capture-templates.

(Mg Grammarian
 entry
 (file+headline ~/Documents/OrgMaster/org/Toastmasters.org Miscellaneous
and Non-Goal roles 2015)
 (file ~/.init/emacs/org-capture-templates/grammarian.org_template)
 :jump-to-captured t :immediate-finish t)

In this specific case, it places the entry under a special pre-defined Org
heading, but I could always call org-capture with a `C-0' (zero) prefix to
insert a template at point.

I can edit the template file as things change, and it can be pretty complex
(some of my represent Projects: A header, several sub headers as tasks,
etc.).