Re: [Orgmode] Clean capture from command line?

2010-11-17 Thread tycho garen
 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)'

Even better than calling from the command line in my experience is
triggering directly from your window manager, or something like
quicksliver if you use OS X... 

I hope this is a start 

-- 
tycho(ish) @
 ga...@tychoish.com
  http://www.tychoish.com/
  http://www.cyborginstitute.com/
  don't get it right, get it written -- james thurber


pgpUZ7Fu0t5nw.pgp
Description: PGP signature
___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Clean capture from command line?

2010-11-17 Thread Eric S Fraga
tycho garen ga...@tychoish.com 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:

--8---cut here---start-8---
(ad-activate 'capture-finalize)
(ad-activate 'capture-destroy)
--8---cut here---end---8---

But, in any case, this doesn't seem to make any difference in my case.

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.

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 23.2.1
: using Org-mode version 7.3 (release_7.3.86.gb3d6f)

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Clean capture from command line?

2010-11-16 Thread Allen S. Rout


I'm one of the legion gradually slipping more and more of my day-to-day
process into org-mode.  (Thanks, Carsten!)

One of the things I'd like to be able to do is capture a new TODO from a
command line.  e.g.

shell$ capture Fred wants a new database VM, 60G

and maybe eventually something obnoxious with e.g. zenity, so that a key
chord popped up a text dialog which would just seamlessly get fed to
org-capture.  Basically, I want to make the notation and just keep
sailing. Of course, I've got the relevant org files open in an emacs on
another desktop: miles and miles away. :) The obvious solution

shell$ emacsclient -c -e (org-capture)

(and maybe a '-t', to keep it in the tty) 

has a problem: when I finish the capture, I'm left with the session, and
worse, when I try to close the emacsclient, (C-x #) it tells me No
server buffers remain to edit, and I have to M-x delete-frame.
Harshing my buzz, definitely.


A gmane search on 'capture command line' in this group didn't seem to
help much.  Am I thinking about the problem the wrong way?  How do
you-all do that sort of ad-hoc capture?



- Allen S. Rout


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Clean capture from command line?

2010-11-16 Thread Eric S Fraga
a...@ufl.edu (Allen S. Rout) writes:

 I'm one of the legion gradually slipping more and more of my day-to-day
 process into org-mode.  (Thanks, Carsten!)

 One of the things I'd like to be able to do is capture a new TODO from a
 command line.  e.g.

 shell$ capture Fred wants a new database VM, 60G

 and maybe eventually something obnoxious with e.g. zenity, so that a key
 chord popped up a text dialog which would just seamlessly get fed to
 org-capture.  Basically, I want to make the notation and just keep
 sailing. Of course, I've got the relevant org files open in an emacs on
 another desktop: miles and miles away. :) The obvious solution

 shell$ emacsclient -c -e (org-capture)

 (and maybe a '-t', to keep it in the tty) 

 has a problem: when I finish the capture, I'm left with the session, and
 worse, when I try to close the emacsclient, (C-x #) it tells me No
 server buffers remain to edit, and I have to M-x delete-frame.
 Harshing my buzz, definitely.

I tried the following:

: $ emacsclient -t -e (progn (org-capture) (delete-frame))

which /sort of/ works: it brings up capture, allows me to type in
various bits of the capture template (like headline and tags, if
requested) but then quits immediately (and deletes the frame) when org
is supposed to give me a chance to add to the entry I have created.

So this is a halfway point to a solution to your problem maybe?

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 23.2.1
: using Org-mode version 7.3 (release_7.3.78.g9b811)

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Clean capture from command line?

2010-11-16 Thread Friedrich Delgado
I use zsh and I already use this:

,[ ~/bin/uriescapepwd.pl ]
  #!/usr/bin/perl -w
  use URI::Escape qw/ uri_escape uri_escape_utf8 /;
  use Cwd qw/getcwd abs_path/;
  $pwd = abs_path(getcwd);
  print uri_escape_utf8($pwd);
`

,[ .zshrc snippet ]
  # bind f9n to org-store-link
  bindkey -s \e[20~n 'emacsclient 
org-protocol://store-link://file:`uriescapepwd.pl`\n'
`

(I stole this from somewhere, can't remember where, possibly this
list.)

it should be easy to just do
,
  # bind f9t to org-remember
  bindkey -s \e[20~t 'emacsclient 
org-protocol://remember://file:`uriescapepwd.pl`\n'
`

(I'm old school.)

or even
,
  # bind f9t to org-remember
  bindkey -s \e[20~t 'emacsclient 
org-protocol://capture://file:`uriescapepwd.pl`\n'
`


I didn't test this, since I very rarely even use the first binding.

I'm pretty sure this must be possible with bash and other shells as
well.

Of course this leaves you in the emacsclient again, so you probably
want to follow Eric's hints on top of that.

Eric S Fraga schrieb:
 a...@ufl.edu (Allen S. Rout) writes:
  One of the things I'd like to be able to do is capture a new TODO from a
  command line.  e.g.
 
  shell$ capture Fred wants a new database VM, 60G
 
  and maybe eventually something obnoxious with e.g. zenity, so that a key
  chord popped up a text dialog which would just seamlessly get fed to
  org-capture.  Basically, I want to make the notation and just keep
  sailing. Of course, I've got the relevant org files open in an emacs on
  another desktop: miles and miles away. :) The obvious solution
 
  shell$ emacsclient -c -e (org-capture)
 
  (and maybe a '-t', to keep it in the tty) 
 
  has a problem: when I finish the capture, I'm left with the session, and
  worse, when I try to close the emacsclient, (C-x #) it tells me No
  server buffers remain to edit, and I have to M-x delete-frame.
  Harshing my buzz, definitely.
 
 I tried the following:
 
 : $ emacsclient -t -e (progn (org-capture) (delete-frame))
 
 which /sort of/ works: it brings up capture, allows me to type in
 various bits of the capture template (like headline and tags, if
 requested) but then quits immediately (and deletes the frame) when org
 is supposed to give me a chance to add to the entry I have created.
 
 So this is a halfway point to a solution to your problem maybe?
 
---Zitatende---

-- 
Friedrich Delgado frie...@nomaden.org
 TauPan on Ircnet and Freenode ;)

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode