emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: Torsten Wagner <torsten.wagner@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>,
	Marcelo de Moraes Serpa <celoserpa@gmail.com>
Subject: Re: [OT] Taskwarrior, nice GTD-oriented CLI thing
Date: Fri, 04 Feb 2011 13:38:35 -0700	[thread overview]
Message-ID: <87tygj1q2e.fsf@gmail.com> (raw)
In-Reply-To: 4D4B79FA.1000604@gmail.com

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

I think such a shell-script wrapper around an emacs-client or emacs
batch Org-mode instance sounds like a very nice idea -- and not overly
difficult to implement.

Here is a quick approach to implementing the org agenda example you
suggested below [1] notice that the script is structured to dispatch on
the first command, currently only "agenda" is implemented but it
shouldn't be difficult to add others.

Also, rather than a single org script like the one attached which
dispatches based on its first argument, we could go the git path i.e.,
we can have org-agenda and org-add in the same way that git has git-log
and git-push.

Best -- Eric

Torsten Wagner <torsten.wagner@gmail.com> writes:

> Hi Marcelo,
>
>> A CLI client would be nice, but IMHO, I don't think it would be faster
>> than the operating org from emacs; perhaps for a couple of basic
>> stuff, but I think that depends strongly on personal tastes.
>
> For me the most nicest part to have a CLI interface to org-mode would
> be the fact that I could use all the command line magic instantaneous.
> E.g.,
>
> git log -n1 | org add "Remember to check the last commit"
>
> could end up in
>
> * Remember to check the last commit
>
> commit b9de5f08ba0833d2b1912d02335667e8e6cc17b
> Author: User Foo <foo@bar.com>
> Date:   Mon Dec 20 14:50:05 2010 -1000
>
> This comment might fixes the bug Totti was dealing with
>
>
> or a simple
>
> ls | org add "The files I have not processed so fare"
>
> could end up in
>
> * "The files I have not processed so fare"
>
> file1
> file2
> file6
> file11
>
> and a
>
> org agenda next | xargs awesome-client notifyme("{}")
>
> could create a pop up in my window manager (awesome wm) informing me
> about the next appointment in my agenda.
>
> Even more into hardware details,
> a udev-rule could be used to send a certain command to org-mode
> whenever a specific USB-stick is inserted in the computer.
> People who like to clock there work might love this feature.
>
> There are actually hundreds of possible nice combinations...
>
>
> All the best
>
> Totti
>
>
>
>
>> Marcelo.
>>
>> On Thu, Feb 3, 2011 at 7:14 PM, Torsten Wagner<torsten.wagner@gmail.com>  wrote:
>>> Hi,
>>>
>>> maybe someone should contact the devs there and invite them (to come to this
>>> email list and/or vice versa).
>>> There is really some beauty in the idea to use dead simple command line
>>> tools to getting things fast and quickly done. On the other hand org-mode
>>> has so many useful functions.
>>> It would be a very nice integration for both sides to settle down on a way
>>> to import/export data from each other seamlessly.
>>> I work often with a shell and this would allow people to use the command
>>> line whenever they just need to do to something quickly and switching to
>>> emacs and org-mode if they need editor capabilities.
>>>
>>> Greetings
>>>
>>> Totti
>>>
>>> _______________________________________________
>>> 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
>>>
>
>
> _______________________________________________
> 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

Footnotes: 
[1]  org script

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org --]
[-- Type: text/x-sh, Size: 1863 bytes --]

#!/bin/sh
# -*- mode: shell-script -*-
# org --- Calls Org-mode from the command line:
#
# Author: Eric Schulte
#
# Usage:
#
#   1. update ORGINSTALL and ORGCONFIG to point to your local
#      org-install.el and your local org-mode configuration
#      (for things like org-agenda-files)
#
#   2. make this file executable
#
#   3. run one of the following commands
#
#      org agenda fmt   ## where fmt is one of txt, html, ps or ics
#      no other commands yet...
#
ORGINSTALL="~/emacs/src/org/lisp/org-install.el"
ORGCONFIG="~/emacs/eschulte-org.el"

## wrappers for the eval command sent to Emacs
ORGSTARTUPOPEN=$(cat <<EOF )
(progn
  (add-to-list 'load-path (expand-file-name "~/emacs/src/org/lisp/"))
  (add-to-list 'load-path (expand-file-name "~/emacs/src/org/contrib/lisp/"))
  (require 'org)(require 'org-exp)
EOF
ORGSTARTUPCLOSE=")"

## dispatch on the first command -- currently only "agenda" is supported
case $1 in
    agenda) # write the agenda to stdout in format of $2
    FILLER=$(cat <<EOF )
;; function definitions -- could be placed in org-mode/contrib
(defun org-agenda-to-string (fmt)
  (let ((tmp-file (make-temp-file "org-tmp" nil (concat "." fmt)))
        output)
    (save-window-excursion
      (org-batch-agenda "a")
      (org-write-agenda tmp-file))
    (with-temp-buffer
      (insert-file-contents-literally tmp-file)
      (setq output (buffer-string)))
    (delete-file tmp-file)
    output))
(org-agenda-to-string "$2")
EOF
        ;;
    *)
        echo "unknown";;
esac

# Notice the use of `princ' to write to STDOUT and use of
# `with-output-to-temp-buffer' command to ensure nothing else is
# written to STDOUT.
EL=$(cat <<EOF )
$ORGSTARTUPOPEN
(princ (with-output-to-temp-buffer "*trash*" $FILLER))
$ORGSTARTUPCLOSE
EOF

# echo "$EL" ## testing
emacs -Q --batch -l $ORGINSTALL -l $ORGCONFIG --eval "$EL" 2> /dev/null

[-- 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:[~2011-02-04 20:51 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03  4:34 [OT] Taskwarrior, nice GTD-oriented CLI thing Marcelo de Moraes Serpa
2011-02-03 12:41 ` Eric S Fraga
2011-02-03 18:29   ` Marcelo de Moraes Serpa
2011-02-03 18:32     ` Marcelo de Moraes Serpa
2011-02-03 19:11       ` Erik Iverson
2011-02-03 21:01         ` Eric S Fraga
2011-02-03 21:05           ` Erik Iverson
2011-02-03 22:04             ` Marcelo de Moraes Serpa
2011-02-11 11:14               ` Bastien
2011-02-11 19:48                 ` Marcelo de Moraes Serpa
2011-02-04  1:14 ` Torsten Wagner
2011-02-04  2:59   ` John Hendy
2011-02-04  3:12     ` Torsten Wagner
2011-02-04  3:51       ` Marcelo de Moraes Serpa
2011-02-04  4:03         ` Torsten Wagner
2011-02-04  4:23           ` Mark Elston
2011-02-04 19:16             ` Eric Schulte
2011-02-04 21:53               ` Mark Elston
2011-02-04 16:22           ` Christopher Allan Webber
2011-02-04 18:03             ` Marcelo de Moraes Serpa
2011-02-07 15:45               ` Christopher Allan Webber
2011-02-04 15:48       ` Matt Lundin
2011-02-04  9:19     ` Eric S Fraga
2011-02-05  9:25       ` Dirk-Jan C. Binnema
2011-02-05 20:52         ` Eric S Fraga
2011-02-06 17:50           ` Dirk-Jan C. Binnema
2011-02-06 19:14             ` Eric S Fraga
2011-02-06 17:52           ` Dirk-Jan C. Binnema
2011-02-04  2:59   ` Marcelo de Moraes Serpa
2011-02-04  4:00     ` Torsten Wagner
2011-02-04 20:38       ` Eric Schulte [this message]

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=87tygj1q2e.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=celoserpa@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=torsten.wagner@gmail.com \
    /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).