emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] [OT] Taskwarrior, nice GTD-oriented CLI thing


From: Eric Schulte
Subject: Re: [Orgmode] [OT] Taskwarrior, nice GTD-oriented CLI thing
Date: Fri, 04 Feb 2011 13:38:35 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

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 <address@hidden> 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 <address@hidden>
> 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<address@hidden>  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.
>>> address@hidden
>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Footnotes: 
[1]  org script
#!/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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]