Re: [O] Alfred workflow for org-capture

2013-09-13 Thread Alan Schmitt
hari...@gmail.com writes:

 Robert P. Goldman rpgold...@sift.info writes:

 Does anyone have a workflow for the Alfred Mac app launcher that will
 interact with org-capture?

 If Alfred can trigger an Applescript, I use the following with Quicksilver: 

 Applescript: 

 property eclient : /Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n 
 -e 
 do shell script eclient  '(make-orgcapture-frame)'

 elisp in init.el or ...: 

 (defun make-orgcapture-frame ()  
   Create a new frame and run org-capture.  
   (interactive)  
   (make-frame '((name . remember) (width . 80) (height . 16)
 (top . 400) (left . 300)
 (font . 
 -apple-Monaco-medium-normal-normal-*-13-*-*-*-m-0-iso10646-1)
 ))
   (select-frame-by-name remember)  
   (org-capture))

This is a great suggestion! I have one comment and one question.

The comment: if you have capture-templates set up, you can bypass them
by calling `(org-capture nil t)' if you want that template.

The question: is there a way to:
- present only the capture buffer in the new frame (right now it's split
with the scratch buffer)?
- delete the window at the end of capture?

According to some old discussion
(https://lists.gnu.org/archive/html/emacs-orgmode/2011-11/msg00482.html)
it is not possible, but things may have changed since then.

Alan



Re: [O] Alfred workflow for org-capture

2013-09-13 Thread Alexander Baier
Hi Alan,

Alan Schmitt alan.schm...@polytechnique.org writes:

[...]

 The question: is there a way to:
 - present only the capture buffer in the new frame (right now it's split
 with the scratch buffer)?
 - delete the window at the end of capture?


How about `org-capture-after-finalize-hook'? What I can get from the
pcumentation string it seems to be what you are looking for.  You could
try something like this:

  (add-hook org-capture-after-finalize-hook 'delete-frame)

Just tried that, and on my machine this works.


 According to some old discussion
 (https://lists.gnu.org/archive/html/emacs-orgmode/2011-11/msg00482.html)
 it is not possible, but things may have changed since then.

 Alan


Regards,
Alex




Re: [O] Alfred workflow for org-capture

2013-09-13 Thread Alan Schmitt
lexi.ba...@gmail.com writes:

 Hi Alan,

 Alan Schmitt alan.schm...@polytechnique.org writes:

 [...]

 The question: is there a way to:
 - present only the capture buffer in the new frame (right now it's split
 with the scratch buffer)?
 - delete the window at the end of capture?


 How about `org-capture-after-finalize-hook'? What I can get from the
 pcumentation string it seems to be what you are looking for.  You could
 try something like this:

   (add-hook org-capture-after-finalize-hook 'delete-frame)

 Just tried that, and on my machine this works.

Thanks, here is my modified version, if someone finds it useful. It
tests for the frame name (there may be a simpler way to get it, but I
could not find it) before deleting the frame.

--8---cut here---start-8---
(add-hook 'org-capture-after-finalize-hook
  (lambda ()
(when (equal
   (cdr (assoc 'name (frame-parameters (selected-frame
   remember)
  (delete-frame
--8---cut here---end---8---

Alan



Re: [O] Alfred workflow for org-capture

2013-09-13 Thread Alan Schmitt
alan.schm...@polytechnique.org writes:

 lexi.ba...@gmail.com writes:

 Hi Alan,

 Alan Schmitt alan.schm...@polytechnique.org writes:

 [...]

 The question: is there a way to:
 - present only the capture buffer in the new frame (right now it's split
 with the scratch buffer)?

Following the idea from Alexander, I tried to find a hook where I could
call delete-other-windows. Unfortunately adding it to
org-capture-hook does not work. Is there a place to do it?

Thanks,

Alan



Re: [O] Alfred workflow for org-capture

2013-09-13 Thread Damon Haley
In addition to Alfred/Applescript,  the Quickkeys application allows once to
directly access emacs keybindings (without emacsclient) and then let emacs
call call apple script to retrieve useful context for org-capture.

My solution is completely stolen from John Wiegley,  but it works great.

After calling org-smart-capture with quickkeys,  quickkeys calls the
appropriate org-insert functions
from here:

https://github.com/jwiegley/dot-emacs/blob/master/dot-org.el#L534

Quickkeys just needs to know the frontmost application when capture was
called,  which is easy to configure, and then it types the relevant org-insert 
keybinding.

John, has also written a function called smart-capture that goes directly to
the capture template of one's choice:

https://github.com/jwiegley/dot-emacs/blob/master/lisp/org-smart-capture.el

Quickkeys is also worth its price for automating tons of actions with or
without Apple Script.

Damon

 Haider Rizvi hari...@gmail.com writes:

 Robert P. Goldman rpgold...@sift.info writes:
 Does anyone have a workflow for the Alfred Mac app launcher that will
 interact with org-capture?

 If Alfred can trigger an Applescript, I use the following with Quicksilver:

 Applescript: 

 property eclient : /Applications/Emacs.app/Contents/MacOS/bin/emacsclient
 -n -e  do shell script eclient  '(make-orgcapture-frame)'

 elisp in init.el or ...: 

 (defun make-orgcapture-frame ()  
   Create a new frame and run org-capture.  
   (interactive)  
   (make-frame '((name . remember) (width . 80) (height . 16)
 (top . 400) (left . 300)
 (font . 
 -apple-Monaco-medium-normal-normal-*-13-*-*-*-m-0-iso10646-1)
 ))
   (select-frame-by-name remember)  
   (org-capture))

 Regards, 
-- 
app: https://alpha.app.net/haleyscomet | 
net: https://identi.ca/vinylisl | 
git: https://github.com/dhaley | 
irc: dkh on #drupal-colorado/irc/freenode.net




Re: [O] Alfred workflow for org-capture

2013-09-12 Thread Haider Rizvi
Robert P. Goldman rpgold...@sift.info writes:

 Does anyone have a workflow for the Alfred Mac app launcher that will
 interact with org-capture?

If Alfred can trigger an Applescript, I use the following with Quicksilver: 

Applescript: 

property eclient : /Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n 
-e 
do shell script eclient  '(make-orgcapture-frame)'

elisp in init.el or ...: 

(defun make-orgcapture-frame ()  
  Create a new frame and run org-capture.  
  (interactive)  
  (make-frame '((name . remember) (width . 80) (height . 16)
(top . 400) (left . 300)
(font . 
-apple-Monaco-medium-normal-normal-*-13-*-*-*-m-0-iso10646-1)
))
  (select-frame-by-name remember)  
  (org-capture))


Regards, 
-- 
Haider