emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: asr@ufl.edu (Allen S. Rout)
To: emacs-orgmode@gnu.org
Subject: Re: Clean capture from command line?
Date: Thu, 18 Nov 2010 12:32:53 -0500	[thread overview]
Message-ID: <874obebkqi.fsf@ufl.edu> (raw)
In-Reply-To: 20101116233531.GA7642@taupan.ath.cx

[-- Attachment #1: Type: text/plain, Size: 1307 bytes --]


Friedrich Delgado <friedel@nomaden.org> writes:

> 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);
> `----

Woot, one step. 

Then I also did a quick filter.

---
use URI::Escape qw/ uri_escape uri_escape_utf8 /;
use Cwd qw/getcwd abs_path/;

print uri_escape_utf8(<>);
---

At that point, I could do: 

---

emacsclient  -c org-protocol://capture:/I/file:`~/bin/uriescapepwd`/`~/bin/uriescapepwd`/`/usr/bin/zenity --entry --text="New TODO" |~/bin/uriescape`

----

The 'I' selects template, in which I'm using :immediate-finish.  That's
one.

For the 'Close the client frame' purpose, I applied the attached patch,
and then I could, in my own myorg.el file:

-----

( defun asr-org-capture-finalize ()
  "If we set the correct property in the capture template, then delete frame."
  ( if (org-capture-get :asr-delete-frame-on-finalize)
     (delete-frame)
  )
)


(add-hook 'org-capture-after-finalize-hook 'asr-org-capture-finalize )

-----


which lets me define a capture template with property

:asr-delete-frame-on-finalize 1

and then use that template.

Thanks, Eric and Friedrich... 


- Allen S. Rout



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Add post-finalize hook --]
[-- Type: text/x-diff, Size: 1104 bytes --]

From 2086fe4be30d5383b9db4d5db91da6b03357c128 Mon Sep 17 00:00:00 2001
From: Allen S. Rout <asr@ufl.edu>
Date: Wed, 17 Nov 2010 12:52:02 -0500
Subject: [PATCH 3/3] Add post-finalize hook

---
 lisp/org-capture.el |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 2abe5c7..5d2f8d3 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -313,6 +313,12 @@ The remember buffer is still current when this hook runs."
   :group 'org-capture
   :type 'hook)
 
+(defcustom org-capture-after-finalize-hook nil
+  "Hook that is run right after a capture process is finalized.
+  Suitable for window cleanup"
+  :group 'org-capture
+  :type 'hook)
+
 ;;; The property list for keeping information about the capture process
 
 (defvar org-capture-plist nil
@@ -548,6 +554,8 @@ bypassed."
 
       ;; Restore the window configuration before capture
       (set-window-configuration return-wconf))
+
+    (run-hooks 'org-capture-after-finalize-hook)
     (when abort-note
       (cond
        ((equal abort-note 'clean)
-- 
1.7.0.4


[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

  reply	other threads:[~2010-11-18 17:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-16 20:43 Clean capture from command line? Allen S. Rout
2010-11-16 22:26 ` Eric S Fraga
2010-11-16 23:35   ` Friedrich Delgado
2010-11-18 17:32     ` Allen S. Rout [this message]
2010-11-27  6:56       ` [Accepted] " Carsten Dominik
2010-11-17 18:24 ` tycho garen
2010-11-17 19:11   ` Eric S Fraga
2010-11-18  2:18     ` Matt Lundin
2010-11-18  7:20       ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874obebkqi.fsf@ufl.edu \
    --to=asr@ufl.edu \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).