[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Re: Clean capture from command line?
From: |
Matt Lundin |
Subject: |
[Orgmode] Re: Clean capture from command line? |
Date: |
Wed, 17 Nov 2010 21:18:33 -0500 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) |
Eric S Fraga <address@hidden> writes:
> tycho garen <address@hidden> writes:
>
>>> One of the things I'd like to be able to do is capture a new TODO from a
>>> command line. e.g.
>>
>> I use the following code that I got from Jack Moffit
>> (http://www.metajack.im), that does more or less what you're looking
>> for, I think. Add the following block to your org configs.
>>
>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>
>> (defadvice capture-finalize (after delete-capture-frame activate)
>> "Advise capture-finalize to close the frame if it is the capture frame"
>> (if (equal "capture" (frame-parameter nil 'name))
>> (delete-frame)))
>>
>> (defadvice capture-destroy (after delete-capture-frame activate)
>> "Advise capture-destroy to close the frame if it is the rememeber frame"
>> (if (equal "capture" (frame-parameter nil 'name))
>> (delete-frame)))
>>
>> (defun make-capture-frame ()
>> "Create a new frame and run org-capture."
>> (interactive)
>> (make-frame '((name . "capture")))
>> (select-frame-by-name "capture")
>> (delete-other-windows)
>> (org-capture)
>> )
>>
>>
>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>
>> Then call emacs as follows:
>>
>> emacsclient -n -e '(make-capture-frame)'
>
> Doesn't work for me, for some strange reason.
>
> I think you may have forgotten to say that the advices have to be
> activated? If so, I assume this would be done by:
>
> (ad-activate 'capture-finalize)
> (ad-activate 'capture-destroy)
>
> But, in any case, this doesn't seem to make any difference in my case.
>
Yes, that is not the problem. The advice is already activated in the
definition itself (see the "activate" parameter).
> The capture process itself works. I get my menu of templates just fine.
> Org captures the information when it should, i.e. if I finish normally
> (C-c C-c), and ignores it if I abort (C-c C-k). In either case, the
> frame, named "capture", remains.
> Hitting my "delete-frame" button (the Windows menu key to the right of
> my spacebar -- had to use these keys for something) works just fine so
> the problem is not with the delete frame function.
>
> Any suggestions? There's no error of any form that I can see.
The problem is that the functions capture-finalize and capture-destroy
do not exist. I imagine the original code was designed for remember mode
(which does have the functions remember-destroy and remember-finalize).
The relevant function in org-capture.el, I believe, is
org-capture-finalize. I think the following defadvice should work:
--8<---------------cut here---------------start------------->8---
(defadvice org-capture-finalize (after delete-capture-frame activate)
"Advise capture-finalize to close the frame if it is the capture frame"
(if (equal "capture" (frame-parameter nil 'name))
(delete-frame)))
--8<---------------cut here---------------end--------------->8---
Best,
Matt