emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Alfred workflow for org-capture
@ 2013-09-12 14:27 Robert P. Goldman
  2013-09-12 18:51 ` Haider Rizvi
  0 siblings, 1 reply; 7+ messages in thread
From: Robert P. Goldman @ 2013-09-12 14:27 UTC (permalink / raw)
  To: Org Mode

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

I know there have been versions before that worked with Quicksilver,
which is quite similar.

Thought I would ask before trying to roll my own.

Thanks!

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

* Re: Alfred workflow for org-capture
  2013-09-12 14:27 Alfred workflow for org-capture Robert P. Goldman
@ 2013-09-12 18:51 ` Haider Rizvi
  2013-09-13  7:45   ` Alan Schmitt
  2013-09-13 18:41   ` Damon Haley
  0 siblings, 2 replies; 7+ messages in thread
From: Haider Rizvi @ 2013-09-12 18:51 UTC (permalink / raw)
  To: emacs-orgmode

"Robert P. Goldman" <rpgoldman@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

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

* Re: Alfred workflow for org-capture
  2013-09-12 18:51 ` Haider Rizvi
@ 2013-09-13  7:45   ` Alan Schmitt
  2013-09-13  8:14     ` Alexander Baier
  2013-09-13 18:41   ` Damon Haley
  1 sibling, 1 reply; 7+ messages in thread
From: Alan Schmitt @ 2013-09-13  7:45 UTC (permalink / raw)
  To: Haider Rizvi; +Cc: emacs-orgmode

harizvi@gmail.com writes:

> "Robert P. Goldman" <rpgoldman@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

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

* Re: Alfred workflow for org-capture
  2013-09-13  7:45   ` Alan Schmitt
@ 2013-09-13  8:14     ` Alexander Baier
  2013-09-13  9:19       ` Alan Schmitt
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Baier @ 2013-09-13  8:14 UTC (permalink / raw)
  To: emacs-orgmode

Hi Alan,

Alan Schmitt <alan.schmitt@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

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

* Re: Alfred workflow for org-capture
  2013-09-13  8:14     ` Alexander Baier
@ 2013-09-13  9:19       ` Alan Schmitt
  2013-09-13  9:30         ` Alan Schmitt
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Schmitt @ 2013-09-13  9:19 UTC (permalink / raw)
  To: Alexander Baier; +Cc: emacs-orgmode

lexi.baier@gmail.com writes:

> Hi Alan,
>
> Alan Schmitt <alan.schmitt@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

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

* Re: Alfred workflow for org-capture
  2013-09-13  9:19       ` Alan Schmitt
@ 2013-09-13  9:30         ` Alan Schmitt
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Schmitt @ 2013-09-13  9:30 UTC (permalink / raw)
  To: Alexander Baier; +Cc: emacs-orgmode

alan.schmitt@polytechnique.org writes:

> lexi.baier@gmail.com writes:
>
>> Hi Alan,
>>
>> Alan Schmitt <alan.schmitt@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

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

* Re: Alfred workflow for org-capture
  2013-09-12 18:51 ` Haider Rizvi
  2013-09-13  7:45   ` Alan Schmitt
@ 2013-09-13 18:41   ` Damon Haley
  1 sibling, 0 replies; 7+ messages in thread
From: Damon Haley @ 2013-09-13 18:41 UTC (permalink / raw)
  To: emacs-orgmode

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 <harizvi@gmail.com> writes:

> "Robert P. Goldman" <rpgoldman@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

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

end of thread, other threads:[~2013-09-13 18:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-12 14:27 Alfred workflow for org-capture Robert P. Goldman
2013-09-12 18:51 ` Haider Rizvi
2013-09-13  7:45   ` Alan Schmitt
2013-09-13  8:14     ` Alexander Baier
2013-09-13  9:19       ` Alan Schmitt
2013-09-13  9:30         ` Alan Schmitt
2013-09-13 18:41   ` Damon Haley

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