Re: [O] using pdf as output of src-block doesn't show an inline image

2016-02-07 Thread Arun Persaud
Hi

managed to get pdfs to display ;)

Here is what I added in my .emacs file:

(add-to-list 'image-type-file-name-regexps '("\\.pdf\\'" . imagemagick))
(add-to-list 'image-file-name-extensions "pdf")
(setq imagemagick-types-inhibit (remove 'PDF imagemagick-types-inhibit))
(setq org-image-actual-width 600)

This works for me, but I always need to run org-display-inline-images by
hand after I changed something in my python code. That is, the images
don't update automatically, which they did for pngs. Any idea why that is?

Another question I have now, is if the above code messes up other modes,
I guess there was/is a reason to inhibit pdfs with imagemagick. How do I
make the above changes only apply to org-mode buffers?

Arun



[O] using pdf as output of src-block doesn't show an inline image

2016-02-05 Thread Arun Persaud
Hi

I use org mode more and more to plot data using python source blocks. If
I create pngs, org mode will display these results as an inline image,
which is nice. Since I also export my org buffer via latex to pdf, it
would be nice to create pdf plots with python, so that I get vector
graphics in the pdf. This is easy to do in python's matplotlib, but once
I change to pdf output, the images don't get displayed inline in
org-mode anymore :( instead, I just get a file: link.

I had a quick look, but can't figure out how to enable this. Should be
relatively easy I would think, since emacs already can display pdfs and
right-clicking on the file: link will open a new frame with the
pdf. Is there any reason not to display them inline?

The closest I found is:
http://stackoverflow.com/questions/15407485/inline-pdf-images-in-org-mode

If it is not that easy, is there a way to run a pre-export and
post-export hook that changes my *.png files to *pdf before the export
and then changes them back to *.png after the export?

Here is a test file



#+STARTUP: inlineimages

* test

#+NAME: checkfilename
#+HEADER: :var fileout="test--checkfilename.pdf"
#+BEGIN_SRC python :session :results file
import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1)
X = np.linspace(1, 10)
Y = np.sin(X)
ax.plot(X, Y)
fig.savefig(fileout)
plt.close(fig)
fileout
#+END_SRC

-

to create a png, just replace the .pdf in the HEADER with .png


this uses ipython and cpaste
---

; use ipython in org mode
(setq org-babel-python-command "ipython3 --no-banner --classic
--no-confirm-exit")

; use %cpaste to paste code into ipython in org mode
(defadvice org-babel-python-evaluate-session
  (before org-python-use-cpaste
  (session body  result-type result-params) activate)
  "Add a %cpaste and '--' to the body, so that ipython does the right
thing."
  (setq body (concat "%cpaste -q\n" body "\n--")))

---

Arun



Re: [O] feature request for empty blocks in customized agenda

2015-06-13 Thread Arun Persaud
Hi

 I'm not sure if someone will find this feature useful enough to
 incorporate.  However, even if it doesn't get added, I think you can get
 the behavior you want using org-agenda-finalize-hook.  Hopefully the
 snippet below can be a useful starting point.
 
 #+begin_src elisp
   (defun org-agenda-delete-empty-blocks ()
 Remove empty agenda blocks.
   A block is identified as empty if there are fewer than 2
   non-empty lines in the block (excluding the line with
   `org-agenda-block-separator' characters).
 (when org-agenda-compact-blocks
   (user-error Cannot delete empty compact blocks))
 (setq buffer-read-only nil)
 (save-excursion
   (goto-char (point-min))
   (let* ((blank-line-re ^\\s-*$)
  (content-line-count (if (looking-at-p blank-line-re) 0 1))
  (start-pos (point))
  (block-re (format %c\\{10,\\} org-agenda-block-separator)))
 (while (and (not (eobp)) (forward-line))
   (cond
((looking-at-p block-re)
 (when ( content-line-count 2)
   (delete-region start-pos (1+ (point-at-bol
 (setq start-pos (point))
 (forward-line)
 (setq content-line-count (if (looking-at-p blank-line-re) 0 1)))
((not (looking-at-p blank-line-re))
 (setq content-line-count (1+ content-line-count)
 (when ( content-line-count 2)
   (delete-region start-pos (point-max)))
 (goto-char (point-min))
 ;; The above strategy can leave a separator line at the beginning
 ;; of the buffer.
 (when (looking-at-p block-re)
   (delete-region (point) (1+ (point-at-eol))
 (setq buffer-read-only t))
 
   (add-hook 'org-agenda-finalize-hook #'org-agenda-delete-empty-blocks)
 #+end_src

a starting point seems to be an understatement ;) this seems to work
exactly as intended. Thanks!

Completely blanked out the use of any hooks, although it seems the
obvious thing to do ;)

Thanks again

Arun




[O] feature request for empty blocks in customized agenda

2015-06-13 Thread Arun Persaud
Hi

I just started using a customized agenda with many blocks and some of my
blocks are often empty. However, org-mode still insert the header and
the separator between blocks. Is there a way to skip empty blocks
completely?

I had a quick look at org-agenda.el and it seems that it directly
inserts text, e.g. the header, into the buffer, before it even knows how
many items it added. I guess one could remember point at the beginning,
count the items inserted and if that's 0, delete backwards to the saved
point?
My elisp knowledge is probably not good enough to add this though and it
also seems one would have to add it at different location
(org-agenda-list, org-agenda-todo, etc).

I also checked org-agenda-compact-blocks, but that removes the separator
from all blocks, which is not what I want.

Any chance to get something like this added?

Thanks

Arun



Re: [O] [PATCH] lisp/ox-html.el: reorder output of meta data in head

2015-06-08 Thread Arun Persaud
Hi

just as a quick follow up. I found this earlier message on the topic

http://thread.gmane.org/gmane.emacs.orgmode/84306/focus=84355

I would like to push for a change though. I don't have a test case where
charset doesn't work, but
https://code.google.com/p/doctype-mirror/wiki/MetaCharsetAttribute
claims that a title tag before a charset tag would not work in all
browsers which would be nice and seems easy to fix.

Arun



Re: [O] Insert a line separator in table results

2014-07-16 Thread Arun Persaud
This works for me.

#+BEGIN_SRC python
x = [[label 1, label 2, label 3]]
x.append(None)
x.append((4, 5, 6))
x.append((7, 8, 9))
return (x)
#+END_SRC

#+RESULTS:
| label 1 | label 2 | label 3 |
|-+-+-|
|   4 |   5 |   6 |
|   7 |   8 |   9 |

Arun



Re: [O] Export to iCalendar only not DONE, scheduled tasks?

2014-05-14 Thread Arun Persaud
Hi

On 05/10/2014 07:55 AM, Chris Poole wrote:
 On Mon, May 5, 2014 at 11:08 PM, Arun Persaud apers...@lbl.gov
 mailto:apers...@lbl.gov wrote:
 
 pretty sure this can be done. I export only events to an ics file that
 have a start and an end date and are not in a certain category. For this
 I use
 
 
 That's great, thank you. I have this, but it doesn't work:
 
 (defun filter-scheduled-todo-tasks (content backend info)
   Filter iCalendar export to include only TODO tasks that are
 not done, but which are scheduled or have a deadline.
   (when (eq backend 'icalendar)
 (if (and (org-entry-is-todo-p)
  (not (org-entry-is-done-p))
  (or (org-get-scheduled-time (point))
  (org-get-deadline-time (point
 content nil)))
 
 ... called with:
 
 (let ((org-export-filter-final-output-functions
  '(filter-scheduled-todo-tasks)))
 (org-icalendar-combine-agenda-files))

had another look and org-export-filter-final-output-functions is the
wrong function to use. I'm not really using the ical export anymore and
when the org exporter got updated a while ago, I apparently didn't
update this correctly. Sorry about that.

I think the correct way is probably something like:

(defun filter-scheduled-todo-tasks (data backend info)
   ; add check for backend
  (org-element-map data 'headline 'my-debug info)
  data)

(defun org-mycal-export ()
  (let ((org-export-filter-parse-tree-functions
'(filter-scheduled-todo-tasks)))
(org-icalendar-combine-agenda-files)))

the filter function is called before each entry is transcoded into ical
format and gets the whole parse tree. You can then loop through the
parse tree with org-element-map looking at each headline (not 100% sure
if headline is the correct thing to use). Each headline has for example
properties set that you can use to filter. You can access them using
things like:

(defun my-debug (e)
(message +)
(message (buffer-substring (org-element-property :begin e)
(org-element-property :end e)))
(message --)
(message %S (org-element-property :raw-value e))
(message -- todo)
(message %S (org-element-property :todo-keyword e))
(message -- todo type)
(message %S (org-element-property :todo-type e))
(message -- tags)
(message %S (org-element-property :tags e))
(message -- level)
(message %S (org-element-property :level e))
(message *))

To ignore a headline, I think, you can mark it using

(org-export-ignore-element headline info)

where headline would be the same as argument 'e' in my-debug, but I
haven't played around with this yet. I found

http://searchcode.com/codesearch/view/48068680

which uses the function and perhaps you can get an idea how things work
from it.

Arun




Re: [O] Export to iCalendar only not DONE, scheduled tasks?

2014-05-05 Thread Arun Persaud
Hi

 I've been searching round the manual, and blogs, to find a way to do this.
 
 I want to export all of the scheduled/deadline tasks that are not in a
 DONE state to an iCalendar file.
 
 Can this be done?

pretty sure this can be done. I export only events to an ics file that
have a start and an end date and are not in a certain category. For this
I use

(defun org-mycal-export-limit (content backend info)
  Limit the export to items that have a date, time and a range. Also
exclude certain categories.
  (when (eq backend 'icalendar)
(setq org-tst-regexp \\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ...
[0-9]\\{2\\}:[0-9]\\{2\\}[^\r\n]*?\\))
(setq org-tstr-regexp (concat org-tst-regexp --?-? org-tst-regexp))
(save-excursion
  ; get categories
  (setq mycategory (org-get-category))
  ; get start and end of tree
  (org-back-to-heading t)
  (setq mystart(point))
  (org-end-of-subtree)
  (setq myend  (point))
  (goto-char mystart)
  ; search for timerange
  (setq myresult (re-search-forward org-tstr-regexp myend t))
  ; search for categories to exclude
  (setq mycatp (member mycategory org-export-exclude-category))
  ; return text if ok, nil when not ok
  (if (and myresult (not mycatp)) content nil

(defun org-mycal-export ()
  (let ((org-export-filter-final-output-functions
'(org-mycal-export-limit)))
(org-icalendar-combine-agenda-files)))

NB org-export-exclude-category is defined somewhere else

You can look up org-export-filter-final-output-functions and other hooks
at http://orgmode.org/worg/doc.html. I overwrite that hook and have it
return the content if I like the item and skip it by returning nil if I
don't like it.

You can probably use org-entry-is-done-p or org-get-todo-state to figure
out if your entry is DONE or not and org-get-scheduled-time/
org-get-deadline-time to figure out if it's scheduled.

HTH

Arun



Re: [O] Export Agenda to Google Calendar ICS Format

2014-05-05 Thread Arun Persaud
Hi

On 05/05/2014 02:24 AM, Tory S. Anderson wrote:
 Cross-posted from 
 http://stackoverflow.com/questions/23463962/emacs-export-calendar-bad-timezone-format-in-ics
 
 Using orgmode I export my agenda to an ics file, upload it to my site, and 
 import it into Google calendar. This seems like an easy ideal solution, but 
 when I check the calendar I find that it is not recognizing the time zone of 
 my ics file and so is assuming GMT, making my imported times uselessly off. 
 The problem seems to be the same as the one described here:
 
 http://blog.jonudell.net/2011/10/17/x-wr-timezone-considered-harmful/
 
 Checking my exported ics, sure enough, it is using X-WR-TIMEZONE:EST, which 
 Google calendar does not respect. This must be a well-known problem, but I 
 haven't been able to locate a solution anywhere. Help would be appreciated: 
 how can I get the right time on my events (and they must be a feed; the add 
 to calendar trick is no good)?

I have this in my .emacs file to set the timezone.

(setq org-icalendar-timezone America/Los_Angeles)

HTH

Arun



Re: [O] org babel question: reference tables in remote file

2014-04-17 Thread Arun Persaud
Hi

 Is there a reason not to allow link-syntax like
 remote(file:path::tablename, cellref)?
 
 Well, probably histerical raisins, as Stefan would say...
 
 But the concept of a link is really twofold: it's a reference,
 and an object you can interactively act uppon by following it.
 
 Using the link syntax for something is used solely as a ref
 would be confusing IMHO.

thanks for the answer. It would be nice to be able to reference tables
in other files easily though, so some form of path:tablename would
be great for the remote call. Is there some special ref syntax that
could be used here?

Arun



[O] org babel question: reference tables in remote file

2014-04-05 Thread Arun Persaud
Hi

I would like to reference a table in a different file in some org-babel
python code via the :var variables.  The manual mentions that you can
use #+NAME for tables in the same file or IDs for tables in other files.
Is there a reason not to allow link-syntax like
remote(file:path::tablename, cellref)?

Thanks

Arun



Re: [O] [Patch] don't add indent for empty line when exiting, a code edit

2014-03-14 Thread Arun Persaud
On 03/14/2014 02:00 AM, Bastien wrote:
 Hi Florian,
 
 Florian Beck f...@miszellen.de writes:
 
 On 13.03.2014 20:46, Bastien wrote:
 Ok, let me take some fresh air and come back to this later on.

 How about this:

 (while (re-search-forward \\(^\\).+ nil t)
   (replace-match indent nil nil nil 1)))
 
 Works fine here, I pushed this solution.  Thanks!

Thanks everyone for fixing this!

Arun



[O] [Patch] don't add indent for empty line when exiting, a code edit

2014-03-10 Thread Arun Persaud
Hi

I started using org babel for python, but when using C-c ' I always
ended up with white space added to the empty lines in the source code
when returning into the org buffer. This especially shows up
(setq-default show-trailing-whitespace t).

I tried to fix this in org. It seems to work over here, but my elisp as
well as my understanding of org-mode is not perfect ;) Let me know if it
needs more work.

Arun
From e393fed9dbb132fdefff66d304f67f7def643140 Mon Sep 17 00:00:00 2001
From: Arun Persaud a...@nubati.net
Date: Mon, 10 Mar 2014 17:09:12 -0700
Subject: [PATCH] lisp/org-src.el: don't add indent for empty line when exiting
 a code edit

Using C-c ' to edit code blocks adds an indent to all lines when exiting from
the code edit. This leaves trailing whitespace in the buffer, which can be especially
annoying when using show-trailing-whitespace.
---
 lisp/org-src.el | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index d1f6879..ef09bd6 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -737,8 +737,10 @@ with \,*\, \,#+\, \,,*\ and \,,#+\.
   (unless (or single preserve-indentation (= total-nindent 0))
 	(setq indent (make-string total-nindent ?\ ))
 	(goto-char (point-min))
-	(while (re-search-forward ^ nil t)
-	  (replace-match indent)))
+(while (re-search-forward ^ nil t)
+  (if (not (looking-at $))
+  (replace-match indent)
+	(forward-char 1
   (if (org-bound-and-true-p org-edit-src-picture)
 	  (setq total-nindent (+ total-nindent 2)))
   (setq code (buffer-string))
-- 
1.9.0



[O] babel: using empty lines in python code while using session

2014-03-10 Thread Arun Persaud
Hi

I started using python in org babel. The manual, for example [1], points
to the fact that in session mode you can't have empty lines, since they
will be interpreted differently. However, if you use ipython you can get
around this, by using the following in your .emacs:



; use ipython in org mode
(setq org-babel-python-command ipython3 --no-banner --classic
--no-confirm-exit)

; use %cpaste to paste code into ipython in org mode
(defadvice org-babel-python-evaluate-session
  (around org-python-use-cpaste
  (session body optional result-type result-params) activate)
  Add a %cpaste and '--' to the body, so that ipython does the right
thing.
  (setq body (concat %cpaste\n body \n--))
  ad-do-it
  (if (stringp ad-return-value)
  (setq ad-return-value (replace-regexp-in-string \\(^Pasting code;
enter '--' alone on the line to stop or use Ctrl-D\.[\r\n]:*\\) 
ad-return-value

-

I found it much easier, if I don't have to worry about the empty lines
when writing python code. Might be useful for someone else, so I thought
I post it here.

Also, in ipython 2.0 you will be able to use %cpaste -q to suppress
cpaste output, which will simplify the above a bit.

thanks again for org-mode, it's getting more useful all the time ;)

Arun

[1] http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html



Re: [O] Babel python question: use of ipython and %cpaste

2013-12-03 Thread Arun Persaud
Hi

On 12/03/2013 03:44 AM, Rasmus wrote:
 [ipython in org mode]
 For Org you could do: 
 
   (setq org-babel-python-command ipython --no-banner --classic 
 --no-confirm-exit)
 
 You should now be able to do
 
 #+BEGIN_SRC python :results output
 %timeit 1+1
 #+END_SRC
[...]

nice ;) that works well for me. Thanks!

Since I now have ipython as an interpreter, is there a way to have org
mode use %cpaste to copy the code into the python buffer?

That way empty lines would be handled correctly, e.g.

#+BEGIN_SRC python :results output :session
  for i in range(2):
 print(i)

 print(next)

  print(done)
#+END_SRC

would work. I got it to work using something like this

; use %cpaste to paste code into ipython in org mode
(defadvice org-babel-python-evaluate-session
  (around org-python-use-cpaste
  (session body optional result-type result-params) activate)
  add a %cpaste and '--' to the body, so that ipython does the right
thing.
  (setq body (concat %cpaste\n body \n--))
  ad-do-it
  (setq ad-return-value (replace-regexp-in-string \\(^Pasting code;
enter '--' alone on the line to stop or use Ctrl-D\.[\r\n]:*\\) 
ad-return-value)))

I also put a request in to have a %cpaste -q option to suppress output.
But I'm wondering if there is a better way of doing this...

thanks again

Arun



[O] Babel python question: use of ipython and %cpaste

2013-12-02 Thread Arun Persaud
Hi

being able to use python as a source block is great, but I often stumble
over the fact that when using sessions you have to treat empty lines in
a special way (i.e. as the end of an indentation block).

I was wondering if it would be easy to create an ipython mode, something
like

#+BEGIN_SRC ipython ...

where the content for a session is copied over to an ipython buffer
using the ipython magic %cpaste. This way empty lines should be treated
correctly.

It would also have the nice side effect of giving access to other magic
commands within org-babel, such as %timeit or profiling.

Unfortunately, I don't know how to modify ob-python.el to achieve this.
Apart from setting py-shell, I'm not sure how to copy the body of the
source block over to use %cpaste and also how to create a trigger for
BEGIN_SRC ipython...

Would this work? Any idea on how to implement this?

Thanks

Arun



Re: [O] Has anybody noticed ellipses instead of the top line of the window?

2013-02-28 Thread Arun Persaud
On 02/28/2013 09:59 AM, Samuel Wales wrote:
 The ellipses still occur.
 
 Here is an ECM.
 
 ===
 # -*- coding: utf-8 -*-
 #+CATEGORY: executive
 
 the long line and logbook are necessary.  try with fewer
 lines and columns.
 
 * a
 *** a /a/ a a a a a a a a a a
 a a a a a a
 :LOGBOOK:
 - Not scheduled, was 2012-08-01 Wed 02:00 .+1d on [2012-12-01 Sat 02:29]
 :END:
 *** REF cycling this always puts the ellipsis in   :norefile:
[...]

can't reproduce this on my computer. If I move the cursor onto cycling
and do shift-TAB everything seems normal.

First shift-tab collapses everything to * a..., second time I get all
the headlines (e.g. just the lines that start with a *), third time I
also see the second line of the a-entry and the folded LOGBOOG and
PROPERTY drawers. If I remove LOGBOOK and/or make the lines shorter
things stay the same.

I'm using release_7.9.3f-1257-g5bdb84.

Arun



Re: [O] logdone enhancement

2013-02-27 Thread Arun Persaud
Hi

 * project
 ** TODO headline  :repeat:
a longer description of what the todo item is about
SCHEDULED: 2013-06-18 Tue +1m
 
 The SCHEDULED line should be right after the headline, see the manual.
 It can sometimes work when it is on another line, but this is
 accidental, you should put the line right after the headline.

I just tried

* project
** TODO headline :repeat:
   SCHEDULED: 2013-06-18 Tue +1m
   a longer description of what the todo item is about

but this will still add the state-changed-line between the SCHEDULED
line and the longer description (it will also add the property drawer
there, if it doesn't exist). If you track some daily changes this can
move the longer description away from the top quite fast, which is what
I would like to avoid.

Arun




Re: [O] logdone enhancement

2013-02-27 Thread Arun Persaud
Hi

 Isn't that what the LOGBOOK drawer is for? You put the mess in there, so
 it's available when you open it, but you don't have to look at it most of
 the time.

nice! I didn't know about this one. This will solve my problem, although
I still would prefer that drawers, etc are added at the very end of the
entry and not before my additional description. But with LOGBOOK, I will
only have them separated by 3 lines (scheduled, logbook and properties)
which is not too bad.

Thanks for the tip!

Arun




Re: [O] org-cycle hook recenter question

2013-02-26 Thread Arun Persaud
On 02/26/2013 07:29 AM, Bastien wrote:
 Hi Samuel and all,
 
 Samuel Wales samolog...@gmail.com writes:
 
 This is the infamous meaningless ellipses at the top of the buffer
 problem.
 
 ... which should now be fixed.
 
 Thanks for confirming,

Thanks for fixing it! Just tested the latest git and the problem is gone.

Arun




[O] logdone enhancement

2013-02-26 Thread Arun Persaud
Hello

if I have something like the following

#+STARTUP: logdone

* project
** TODO headline :repeat:
   a longer description of what the todo item is about
   SCHEDULED: 2013-06-18 Tue +1m
   - State DONE   from WAITING[2013-02-26 Tue 21:56]
   - State DONE   from WAITING[2013-01-14 Mon 18:18]
   - State DONE   from WAITING[2012-09-30 Sun 19:36]
   - State DONE   from WAITING[2012-09-02 Sun 10:28]
   - State DONE   from WAITING[2012-06-28 Thu 11:08]
   - State DONE   from WAITING[2012-05-07 Mon 10:56]


and then cycle through the TODO states the new '- State Done...'
message shows up between the headline and the description. Is there a
way to always add the new line after the SCHEDULED or perhaps better
before the first log-message in the task? That way they could be kept
easily at any position in the task.

Thanks

Arun



[O] org-cycle hook recenter question

2013-02-23 Thread Arun Persaud
Hi

when I cycle using shift-TAB and I go from all-content, that is just
the headlines, I often don't see the top headlines in the buffer,
although there would be enough space to show them. The top is truncated
and a ... is shown and I need to do a ctrl-l or scroll upward to see
everything.

I was wondering if it would be possible to automatically recenter when
the cycle goes from all-content?

I tried to change the org-cycle-hook to include a line like:

 ((eq state 'content)  (recenter 1))

and I also tried to add a (recenter-top-bottom) in org.el where
org-cycle-global-status is being set to 'contents. But couldn't get it
to work... what's the correct place to do this and is there a reason not
to recenter by default during this cycle operation?

NB: in org-cycle-hook state is tested for 'content, should it be
'contents? org-cycle-hook and org-pre-cycle-hook list both content and
contents and both show up in org.el, but org-cycle-global-state seems to
be only set to 'contents

Arun



Re: [O] org-cycle hook recenter question

2013-02-23 Thread Arun Persaud
Hi

[...]
 This is the infamous meaningless ellipses at the top of the buffer problem.
 
 If you can provide a way to reproduce using emacs -Q, it would really help.

I can reproduce this with emacs -Q tmp.org. Where tmp.org is one of my
org files where I removed the headers (#+...), so it's just a bunch of
headlines and sublevels, starting with a toplevel headline in the first
line.

I'm running:

C-h C-a

GNU Emacs 24.2.1 (x86_64-suse-linux-gnu, GTK+ Version 3.4.4)
 of 2012-10-10 on build20

org-version 7.8.11

I also have the latest git-version installed, but am not sure how to use
that with -Q?

Let me know if I should try anything else.

Arun



Re: [O] agenda question about representing items [PATCH]

2013-01-23 Thread Arun Persaud
Hi

thanks everyone for the feedback! With it I managed to use the
%(expression) in org-agenda-prefix-format to show the breadcrumbs. In
case that's useful for other people too, I attached a patch that adds a
%b option to org-agenda-prefix-format to does the same. Would be great,
if this could be included.

Thanks

Arun
From 2b22b753485bbb522f1f08902bd37c673b241637 Mon Sep 17 00:00:00 2001
From: Arun Persaud apers...@lbl.gov
Date: Wed, 23 Jan 2013 15:21:31 -0800
Subject: [PATCH] added option %b to dispaly breadcrumbs in agenda

if org file has the structure

* project
** task1
*** TODO item1

then when using %b in org-agenda-prefix-format will display
project-taks1-TODO item1
---
 lisp/org-agenda.el | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index f48ff6f..9716345 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1522,6 +1522,7 @@ This format works similar to a printf format, with the following meaning:
   %T   the last tag of the item (ignore inherited tags, which come first)
   %t   the HH:MM time-of-day specification if one applies to the entry
   %s   Scheduling/Deadline information, a short string
+  %b   show breadcrumbs, i.e., the names of the higher levels
   %(expression) Eval EXPRESSION and replace the control string
 by the result
 
@@ -6301,6 +6302,9 @@ The flag is set if the currently compiled format contains a `%T'.)
 (defvar org-prefix-has-effort nil
   A flag, set by `org-compile-prefix-format'.
 The flag is set if the currently compiled format contains a `%e'.)
+(defvar org-prefix-has-breadcrumbs nil
+  A flag, set by `org-compile-prefix-format'.
+The flag is set if the currently compiled format contains a `%b'.)
 (defvar org-prefix-category-length nil
   Used by `org-compile-prefix-format' to remember the category field width.)
 (defvar org-prefix-category-max-length nil
@@ -6448,6 +6452,10 @@ Any match of REMOVE-RE will be removed from TXT.
 ..)))
 			 (t ))
 	  extra (or (and (not habitp) extra) )
+	  breadcrumbs (let ((m (org-get-at-bol 'org-marker)))
+			 (org-with-point-at m
+			   (let ((s (org-display-outline-path nil nil - t)))
+ (concat s -
 	  category (if (symbolp category) (symbol-name category) category)
 	  thecategory (copy-sequence category)
 	  level (or level ))
@@ -6478,6 +6486,7 @@ Any match of REMOVE-RE will be removed from TXT.
 	  'duration duration
 	  'effort effort
 	  'effort-minutes neffort
+	  'breadcrumbs breadcrumbs
 	  'txt txt
 	  'level level
 	  'time time
@@ -6577,7 +6586,8 @@ and stored in the variable `org-prefix-format-compiled'.
   (setq org-prefix-has-time nil
 	org-prefix-has-tag nil
 	org-prefix-category-length nil
-	org-prefix-has-effort nil)
+	org-prefix-has-effort nil
+	org-prefix-has-breadcrumbs nil)
   (let ((s (cond
 	((stringp org-agenda-prefix-format)
 	 org-agenda-prefix-format)
@@ -6586,11 +6596,11 @@ and stored in the variable `org-prefix-format-compiled'.
 	(t   %-12:c%?-12t% s)))
 	(start 0)
 	varform vars var e c f opt)
-(while (string-match %\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/]?\\)\\([cltsei]\\|(.+)\\)
+(while (string-match %\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/]?\\)\\([cltseib]\\|(.+)\\)
 			 s start)
   (setq var (or (cdr (assoc (match-string 4 s)
 '((c . category) (t . time) (l . level) (s . extra)
-  (i . category-icon) (T . tag) (e . effort
+  (i . category-icon) (T . tag) (e . effort) (b . breadcrumbs
 		'eval)
 	c (or (match-string 3 s) )
 	opt (match-beginning 1)
@@ -6598,6 +6608,7 @@ and stored in the variable `org-prefix-format-compiled'.
   (if (equal var 'time) (setq org-prefix-has-time t))
   (if (equal var 'tag)  (setq org-prefix-has-tag  t))
   (if (equal var 'effort) (setq org-prefix-has-effort t))
+  (if (equal var 'breadcrumbs) (setq org-prefix-has-breadcumbs t))
   (setq f (concat % (match-string 2 s) s))
   (when (equal var 'category)
 	(setq org-prefix-category-length
@@ -6624,7 +6635,8 @@ and stored in the variable `org-prefix-format-compiled'.
 	 `((org-prefix-has-time ,org-prefix-has-time)
 	   (org-prefix-has-tag ,org-prefix-has-tag)
 	   (org-prefix-category-length ,org-prefix-category-length)
-	   (org-prefix-has-effort ,org-prefix-has-effort))
+	   (org-prefix-has-effort ,org-prefix-has-effort)
+	   (org-prefix-has-has-breadcrumbs ,org-prefix-has-breadcrumbs))
 	 `(format ,s ,@vars))
 
 (defun org-set-sorting-strategy (key)
-- 
1.8.1.1



[O] agenda question about representing items

2013-01-22 Thread Arun Persaud
Hi

many of my projects have the following form:

* project name
** subtask
*** TODO item1
  SCHEDULED: timestamp

sometimes it looks like

* project name
** subtask
*** TODO item2 [1/3]
  - [X] task1
  - [ ] task2
  - [ ] task3
  SCHEDULED: timestamp

currently my agenda view shows something like

filename: time TODO text next to TODO item in file tags

e.g.
home: Scheduled: TODO look into customize agenda views

I'm wondering if it is possible to customize this, so that it will
display something like the following:

filename: time projectname-subtask-TODO look into customize agenda
views

that is adding some breadcrumbs in front of the item to make it clearer
what the context of the TODO item is.

For the second kind of items it would be nice to see something like this
in the agenda:

filename: time projectname-subtask-TODO item2 - task2

e.g. also add the next item in the list that needs to be done.

Any ideas?

Thanks

Arun



Re: [O] question/suggestions about org-refile

2012-09-23 Thread Arun Persaud
Hello

On 09/23/2012 01:08 AM, Bastien wrote:
 Hi Arun,
 
 Arun Persaud apers...@lbl.gov writes:
 
 I'm using org-capture together with org-refile to organize my
 todo-items. I also have my notes distributed over several org-files, so
 I have set org-refile-use-outline-path to file. There are two things
 that I wished org-refile could do, but don't know how to achieve:

 a) Include local headers for level1 (instead of only file names)

 Using org-refile-use-outline-path=file the path for org refile always
 has to start with the file name. It would be great, if in case I don't
 give a file name, the current file name would be assumed and tab would
 show org-file names and current top headings for the first level. This
 would be helpful, since I mostly refile to the same file, but sometimes
 move things to other files.
 
 Did you try this?
 
 (setq org-refile-use-outline-path t)

I used to have this set to file, but then I _always_ had to add the file
name even for local headlines. I now switched to ido using:

(setq ido-everywhere t)
(setq ido-enable-flex-matching t)
(setq ido-max-directory-size 10)
(ido-mode (quote both))

(setq org-refile-use-outline-path nil)
(setq org-completion-use-ido t)
(setq org-outline-path-complete-in-steps nil)
(setq org-refile-targets '((org-agenda-files :maxlevel . 5)
((~/org/all.org_done ~/org/work.org_done) :maxlevel . 5) ))

(defun ap/verify-refile-target ()
  Exclude todo keywords with a done state from refile targets
  (or (not (member (nth 2 (org-heading-components)) org-done-keywords)))
  (save-excursion (org-goto-first-child))
  )
(setq org-refile-target-verify-function 'ap/verify-refile-target)

which works very well for me, especially once I added the
verify-refile-target.

 b) creating sublevels on the fly

 It would be nice, if I could create new a sublevel during the refiling
 process. 
 
 (setq org-refile-allow-creating-parent-nodes t)

exactly what I wanted :)

Thanks

Arun



Re: [O] question/suggestions about org-refile

2012-09-23 Thread Arun Persaud
On 09/23/2012 08:27 AM, Bastien wrote:
 Hi Arun,
 
 Arun Persaud apers...@lbl.gov writes:
 
 I used to have this set to file, but then I _always_ had to add the file
 name even for local headlines. 
 
 It does not require the file name here and now.  
 Maybe an old behavior.
 
 I now switched to ido using:

 [...]

 which works very well for me, especially once I added the
 verify-refile-target.
 
 Nice.  Maybe you could add this somewhere on Worg?

sure, should I create a new headline refile on the tutorial place or
should it go somewhere else?

Arun




Re: [O] syncing with google calendar, file changed on disk

2012-09-13 Thread Arun Persaud
Hi

I use the following bash script via cron to sync with google and revert
the buffer. I also keep my files in git, so there are some git commands
in here too:

#+BEGIN_SRC bash
#update calendar (this runs the awk script)
/home/arun/bin/google-get-calendar

#check if have any local changes, if so commit them
emacsclient -e (org-save-all-org-buffers)
git commit -am automatic update

# pull and push with rebase
git pull --rebase
git push

# git is synced now = auto-revert buffers
emacsclient -e (revbufs)

# export ics file, so that items show up on google
emacs --batch -l ~/.emacs  --eval '(defun ask-user-about-lock (file opp)
nil)' -f org-mycal-export

# copy to xxx.xxx.xxx, if ssh-agent knows about the key

if [ -e ~/.sshagent ] ; then
   . ~/.sshagent
fi

ssh-add -l |grep cf:c4:58  scp -v ~/org/org.ics
xxx.xxx.xxx:public_html/cryptic-file-name.ics

#+END_SRC

and the export is handled by:

#+BEGIN_SRC emacs-lisp
;;; org - google export via .ics
(setq org-icalendar-use-UTC-date-time nil)
(setq org-icalendar-timezone America/Los_Angeles)

(defun org-mycal-export-limit ()
  Limit the export to items that have a date, time and a range. Also
exclude certain categories.
  (setq org-tst-regexp \\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ...
[0-9]\\{2\\}:[0-9]\\{2\\}[^\r\n]*?\\))
  (setq org-tstr-regexp (concat org-tst-regexp --?-? org-tst-regexp))
  (save-excursion
; get categories
(setq mycategory (org-get-category))
; get start and end of tree
(org-back-to-heading t)
(setq mystart(point))
(org-end-of-subtree)
(setq myend  (point))
(goto-char mystart)
; search for timerange
(setq myresult (re-search-forward org-tstr-regexp myend t))
; search for categories to exclude
(setq mycatp (member mycategory org-export-exclude-category))
; return t if ok, nil when not ok
(if (and myresult (not mycatp)) t nil)))

(defun org-mycal-export ()
  (let ((org-icalendar-verify-function 'org-mycal-export-limit))
(org-export-icalendar-combine-agenda-files)))
#+END_SRC

HTH

Arun



[O] question/suggestions about org-refile

2012-09-02 Thread Arun Persaud
Hello

I'm using org-capture together with org-refile to organize my
todo-items. I also have my notes distributed over several org-files, so
I have set org-refile-use-outline-path to file. There are two things
that I wished org-refile could do, but don't know how to achieve:

a) Include local headers for level1 (instead of only file names)

Using org-refile-use-outline-path=file the path for org refile always
has to start with the file name. It would be great, if in case I don't
give a file name, the current file name would be assumed and tab would
show org-file names and current top headings for the first level. This
would be helpful, since I mostly refile to the same file, but sometimes
move things to other files.

b) creating sublevels on the fly

It would be nice, if I could create new a sublevel during the refiling
process. That is, if I have something like

* A
** B

I could refile to A/B/new/ and org-mode would ask me if I want to create
a new subheading with a y/n question. At the moment I get a no match
error.

Is this already possible with the current org-mode or can it easily be
added?

thanks

ARUN



[O] my setup for remember the milk (one way import to org-mode via org-feed.el)

2012-03-04 Thread Arun Persaud
Hi

I recently needed to add entries from remember the milk(RTM)[1] to my
org files... I found a script that converts to an orgfile[2], but also
the standard org-feed.el that can handle atom feeds. I played around a
bit with the latter and came up with the functions below that parse the
atom feed from RTM and also parse things like the due-date, tags, etc.

I also filter the feed by only including items that have a due date set
via the filter function.

Perhaps this is interesting for someone else, so I thought I post it
here. I could also upload it to Worg if there is interest, but am not
sure where it would go (don't use Worg that much lately).

cheers

Arun

[1] www.rememberthemilk.com/
[2] https://gist.github.com/1379125

; set up RTM
(defun org-feed-parse-RTM-entry (entry)
  Parse the `:item-full-text' as a sexp and create new properties.
  (let ((xml (car (read-from-string (plist-get entry :item-full-text)
;; Get first link href='foo'/.
(setq entry (plist-put entry :link
   (xml-get-attribute
(car (xml-get-children xml 'link))
'href)))
;; Add title/ as :title.
(setq entry (plist-put entry :title
   (xml-substitute-special
(car (xml-node-children
  (car (xml-get-children xml 'title)))
;; look for some other information that's in the content of the entry
;; the structure looks something like:
;; contentdiv   div item span itemname/spanspan
itemvalue/span/div...
(let* ((content (car (xml-get-children xml 'content)))
   (main  (car (xml-get-children content 'div)))
   (items (xml-get-children main 'div)))
  (when items
; iterate over all items and check for certain classes
(while items
  (setq item (car items))
  ; get the second span entry
  (setq valuesub (car (cdr (xml-node-children item
 (cond
  ((string= (xml-get-attribute item 'class) rtm_due)
   (setq entry (plist-put entry :due (car (xml-node-children
valuesub
   (setq mydate (car (xml-node-children valuesub)))
   (if (string= mydate never)
   nil
 (progn
  (string-match ^\\([a-zA-Z]*\\) \\([0-9]*\\) \\([a-zA-Z]*\\)
\\([0-9]*\\)$ mydate)
  (setq mydate (concat 20 (match-string 4 mydate)   
(match-string
3 mydate)   (match-string 2 mydate)  00:00:01))
  (setq mydate (parse-time-string mydate))
  (setq mydate (apply #'encode-time mydate))
  (setq mydate (format-time-string (car org-time-stamp-formats) 
mydate))
  (setq entry (plist-put entry :dueorgformat mydate)
  ((string= (xml-get-attribute item 'class) rtm_tags)
   (setq entry (plist-put entry :tags (car (xml-node-children
valuesub)
  ((string= (xml-get-attribute item 'class) rtm_time_estimate)
   (setq entry (plist-put entry :timeestimate (car
(xml-node-children valuesub)
  ((string= (xml-get-attribute item 'class) rtm_priority)
   (setq entry (plist-put entry :priority (car (xml-node-children
valuesub)
  ((string= (xml-get-attribute item 'class) rtm_location)
   (setq entry (plist-put entry :location (car (xml-node-children
valuesub))
  (setq items (cdr items))
  )))
entry))

(defun org-feed-RTM-filter-non-scheduled (entry)
  filter out all entries that don't have a due date set
  (if (string= (plist-get entry :due) never)
  nil
entry))

(setq org-feed-alist
  '((Remember The Milk
 add your link to the RTM atom feed here
 ~/org/RTM.org
 Remember The Milk
 :parse-feed org-feed-parse-atom-feed
 :parse-entry org-feed-parse-RTM-entry
 :template * TODO %title\n SCHEDULED:%dueorgformat\n Due:
%due\n Location: %location\n Priority:%priority\n Tags:%tags\n %a\n 
 :filter org-feed-RTM-filter-non-scheduled
 )))

;;* rtm feed timer
(run-at-time 3600 3600 'org-feed-update-all)



[O] bug/feature request: refiling and creation of non-existing nodes

2012-03-04 Thread Arun Persaud
Hi

I often use refile to move nodes around in my org-file. I recently
learned about org-refile-allow-creating-parent-nodes, but it seems to be
limited to one level, e.g. if I have set the variable to t and have the
following tree

* A
* to refile

I can move the second node to

A/
or
A/B/

but not to

A/B/C/

is it possible to add this to org (I'm using 7.8.02)?

This would also enable (I assume) to retain the tree structure during
archiving (i.e. moving it to the same path in the archive file), which
is another feature that I think would be great to have ;)

Unfortunately my lisp skill is not good enough to supply a patch for
this... any ideas on how this could be done would be helpful though.

cheers
ARUN



Re: [O] ICS import?

2012-01-25 Thread Arun Persaud
Hello

 I only need import. Two way sync is (currently) not required. I just
 need to get data into Org. Famous last words I know. ;]

perhaps you can modify the script on the following page to do what you want:
http://orgmode.org/worg/org-tutorials/org-google-sync.html

The script can be used to import from google calendar into org mode, but
doesn't handle all ics cases, timezones, etc. It's working for me (but
then again, I don't use google calendar that often).

It would be nice to have this directly in emacs using icalender or
something similar though and real two way-sync would be great ;)

Arun



[O] org-refile-use-outline-path question

2011-10-11 Thread Arun Persaud
Hi

I use the following settings to refile tasks

(setq org-refile-use-outline-path 'file)
(setq org-refile-targets '((org-agenda-files . (:maxlevel . 5

this has the nice effect that I can refile across different files, which
I do use every now and then.
For this I use:

file/level1/level2/...

However mostly I refile to the same file and therefore I wish I could
just use something like:

level1/level2/...

and it would refile using the current file, which at the moment doesn't
work for me (at least the level1s of the current file are not part of
the autocomplete, only files are).

Is there a way that this can be done or can this be added?

Thanks

Arun




Re: [O] iCalendar export

2011-07-25 Thread Arun Persaud
Hi

 And have anyone got this information to their mobile devices? Android?

I do a simple two-way sync (well, kind of two-way) using the method
described here:

http://orgmode.org/worg/org-tutorials/org-google-sync.html

ARUN



Re: [O] Status google calendar sync

2011-06-10 Thread Arun Persaud
Hi

On 06/10/2011 09:58 AM, Stephen Eglen wrote:
 Was there any update regarding this interesting topic?  I'm keen to get
 something working - what is current best practice for getting
 .ics files made by org put onto google calendar, so that I can view them
 on android?
 
 Thanks, Stephen

Have a look at:

http://orgmode.org/worg/org-tutorials/org-google-sync.html

The above works well for me, so I haven't changed anything on it
recently, but let us know in case something doesn't work for you and we
can see if we can fix it.

Arun



Re: [O] Status google calendar sync

2011-06-10 Thread Arun Persaud
Hi

 When going from org - google, do I need to do anything about using
 org-icalendar-store-UID?  I'd rather not have to populate my org files
 with :ID: entries.

I don't... however, I have to admit that I don't really know that much
about .ics files and the use of UID. The setup at the moment just works
for me and the appointments I want show up in google calendar (only ones
with a start and end time). One issue I still have is that they only
show up in an extra calendar and I have to copy them by hand into my
main calendar (so that other people can see them too)... this is ok for
me, since I don't have too many entries that go from org-google, mostly
I use the other direction google-org.

So there is still lots of room for improvement ;)

Anyway, here is the relevant part from my .emacs file just in case

;;; org - google export via .ics
(setq org-icalendar-use-UTC-date-time nil)
(setq org-icalendar-timezone America/Los_Angeles)

(defun org-mycal-export-limit ()
  Limit the export to items that have a date, time and a range. Also
exclude certain categories.
  (setq org-tst-regexp \\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ...
[0-9]\\{2\\}:[0-9]\\{2\\}[^\r\n]*?\\))
  (setq org-tstr-regexp (concat org-tst-regexp --?-? org-tst-regexp))
  (save-excursion
; get categories
(setq mycategory (org-get-category))
; get start and end of tree
(org-back-to-heading t)
(setq mystart(point))
(org-end-of-subtree)
(setq myend  (point))
(goto-char mystart)
; search for timerange
(setq myresult (re-search-forward org-tstr-regexp myend t))
; search for categories to exclude
(setq mycatp (member mycategory org-export-exclude-category))
; return t if ok, nil when not ok
(if (and myresult (not mycatp)) t nil)))

(defun org-mycal-export ()
  (let ((org-icalendar-verify-function 'org-mycal-export-limit))
(org-export-icalendar-combine-agenda-files)))

and I export via a cron script doing

emacs --batch -l ~/.emacs  --eval '(defun ask-user-about-lock (file opp)
nil)' -f org-mycal-export

cheers
ARUN



[O] ical2org updated

2011-02-28 Thread Arun Persaud
Hi

updated ical2org a bit according to Eric's comments:

- removed SCHEDULED
- removed GCAL tag
- moved location and status to properties

also wrote up a bit in Worg on how to export from org-google. Feel free
to edit or comment on it.

http://orgmode.org/worg/org-tutorials/org-google-sync.html#sec-3

Arun

___
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] Re: ical2org (better timezone recognition and better default for max_age option)

2011-02-23 Thread Arun Persaud
Hi

 however, I'm a little concerned with some of the other changes, 
 specifically that all timed events have become scheduled todo
 entries (of type GCAL) which really doesn't fit in with my use case
 at all unfortunately.

probably should make this configurable. How about defining a string that
is attached to all entries, this could then be GCAL, TODO or just
empty .

The reason that I added the GCAL is that when I want to exclude them
from being exported back into google, so a tag worked fine, but I guess
this could also be done in other ways.

 I think scheduled events should be restricted to TODO entries --
 maybe it's a matter of figuring out how google exports tasks and keep
 diary entries as just that?

I'm not using google tasks or emacs diary, so I can't really say how
this would work

 I do like that you are picking up the LOCATION and STATUS fields.  I 
 wonder if these could be made into properties for the org headlines
 you create, much as is done with the UID entry?

should be easy.

ARUN

___
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] iCalendar selective export

2011-02-19 Thread Arun Persaud
Hi

On Fri, Feb 11, 2011 at 12:04 PM, Bastien bastien.gue...@wikimedia.fr
wrote:
 You now set ̀org-icalendar-honor-noexport-tag' to t to prevent export of
 entries with a :noexport: tag.

works. Thanks!

Arun

___
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] need help with lisp for export function regarding timestamps

2011-02-19 Thread Arun Persaud
Hi

 but I can't figure out how to check for these? Do I need to write my own
 reg-exp for this and test the whole entry or is there some org internal
 function for this? 
 
 I'm afraid you need to write your own regexp...

thanks for the answer. Played around with it and got it working now.
Will post it in Worg under google sync after I cleaned it up a bit.

Arun

___
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] Re: ical2org (better timezone recognition and better default for max_age option)

2011-02-16 Thread Arun Persaud
Hi

[option to ignore entries older than N days]
 Very useful option!  Thanks.
 
 I would be tempted to make the default ignore any old events.  Any
 thoughts on this?

I changed it to ignore everything older than one week.

I also updated the timezone parsing a bit after reading part of section
4.3.5 of RFC2445 (ical). There seem to be 3 ways to specify a timezone

date+T+time   floating timezone= assume local time
date+T+timeZ  always UTC
TZID=timezone;date+T+time   time given in timezone

ical2org should now parse the first two correctly. Let me know in case
this doesn't work correctly. If I have more time, I'll play with the
third timezone spec too...

cheers

Arun

___
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] ical2org

2011-02-02 Thread Arun Persaud
Hi

updated the script and added a small config section. I had to change the
time conversion a bit, since most of my entries are in local time in the
.ics file. I also got a lot of really old events, that I'm not
interested anymore and which slowed down the agenda view, so I added an
option to only convert entries that are not older than N days.
The default behavior is the same as before.

The updated script is in Worg (in /code/awk/)

cheers
ARUN

___
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] adding to /contrib/scripts

2011-02-01 Thread Arun Persaud
Hi

 It is in Worg now:
 
   http://orgmode.org/worg/code/awk/

Thanks, didn't know that there is also code in Worg... the script was
already in Worg at

http://orgmode.org/worg/org-tutorials/org-google-sync.html

but I thought that keeping a script inside a documentation page wouldn't
be the best place for it and contrib/scripts seemed better ;)

 Feel free to pull the last two commits (Eric's original script and my
 changes) from that tree.
 
 Feel free to ask Matt for Worg's access and push your changes on Worg! 

already got access... will update the page to reflect the new location
of the awk script in the next days.

thanks

Arun

___
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] adding to /contrib/scripts

2011-01-30 Thread Arun Persaud
Hi

it would be great, if the awk script at

http://orgmode.org/worg/org-tutorials/org-google-sync.html

could be added to contrib/scripts, so that we can version control it.

The file is by Eric Fraga with some minor changes by myself. What's the
best way to do this? I uploaded a copy of the file at

http://nubati.net/cgi-bin/cgit.cgi/org-mode/

I'm not sure what the policy on copyright/GPL header for files in
contrib/script is, but am happy to change things accordingly.

Feel free to pull the last two commits (Eric's original script and my
changes) from that tree.

cheers
  ARUN

___
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] Status google calendar sync

2011-01-30 Thread Arun Persaud
Hi

On 01/30/2011 06:09 AM, Eric S Fraga wrote:
 [...]
 : (setq org-icalendar-store-UID t)
 
 in my org customisation which may be necessary to have this feature.  I
 cannot remember how to ensure that each exported entry has an ID
 property, however.  Maybe somebody else can chime in or you might want
 to check the exporting section in the org manual.

Haven't tried using UID for google yet, if an entry has changed in
org-mode and google which version will be used when it encounters two
edited entries with the same UID?
At the moment I'm thinking of just exporting non-google items back into
google (by excluding category google during export), but this way I can
only edit google-entries in google and org-entries in org... so using
UIDs seems a lot better...

 Google will load an ics file from a location on the web periodically so
 you could always export your org as an ics file and tell Google where to
 find it.  The key problem with this is that the file has to be
 publicly accessible although, of course, you can obfuscate the path and
 protect it from web robots to some degree.

One of my problems is that when I upload to google with a .ics file it
seems that I can only import into a secondary calendar and not my main
one, so if other people look at my calendar they would miss all the
org-mode entries... anyone solved this issue?
Using googlecl on the other hand allows me to edit my main calendar
directly, but then I don't know how to edit them...

cheers
ARUN

___
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] Status google calendar sync

2011-01-28 Thread Arun Persaud
Hi

started writing something up for Worg, can't push to the main repository
at the moment (working on it though), but you can look at it at:

http://nubati.net/cgi-bin/cgit.cgi/Worg/

I also tried the ics2org script, but run into some problems there... the
script didn't recognize the timestamps, which for me look like:

DTSTART;TZID=America/Los_Angeles:20110127T11

and I think the timezone messes things up. I wanted to ask if the script
exists on github or somewhere similar, if not it would be great, if we
could upload it, so that it is easy to work on it for several people...

Eric:I could upload it if this is ok for you? (what's the license on the
file?)

cheers
   ARUN

___
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] Status google calendar sync

2011-01-27 Thread Arun Persaud
Hi

 I try this and get absolutely nothing.  Just an empty calendar line.
 I am using the latest (0.9.12), BTW.  If you enter
 
   google --help
 
 part of the help is:
 
   --fields=FIELDS   Fields to list with list task.

I got an older version (0.9.5)... all of this makes me think that it
probably is better to just use .ics files for everything. Just found out
that google offers a 'private' link to each calendar as xml, ical or
html so that you can easily download it using wget without needing to
log in...

[...]
 Perhaps, but one of the things I want to do is to share a couple of my
 Google calendars with specific groups of people. I have a home, work,
 and two different teaching calendars.  If I have an .ics file on my
 machine that doesn't help much in the sharing, does it?  I don't know
 as I have never used an .ics file for anything yet.

 I would like to maintain info about upcoming classes in my org file and,
 when things change, update the calendar with the appropriate
 information.  Occasionally I have had to reschedule classes, for
 example, or break a single session into two sessions.  What I want is
 to publish the resulting information after all my org file manipulations
 are done so my students can see the results.

You can point google calendar to an .ics file and it will import it
(settings-import calendar) (see [1]), so I would think you could create
different .ics files via org-export-icalendar-..., upload them to a
public webpage (but with a cryptic name and directory browsing disabled,
so that only you and google calendar can find the files) and google
imports them as different calendars and updates them too.

Arun

[1] http://www.google.com/support/calendar/bin/answer.py?hl=enanswer=37100

___
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] need help with lisp for export function regarding timestamps

2011-01-27 Thread Arun Persaud
Hi

trying to get the export to ics working using

org-icalendar-verify-function

and

org-export-icalendar-combine-agenda-files

At the moment I'm using the following as a verify function:

(defun mycal-export ()
  (setq mycategory (org-get-category))
  (setq myrepeat (org-get-repeat))
  (and (not (member mycategory org-export-exclude-category))
   (eval myrepeat

which excludes categories listed in org-export-exclude-category and also
only export repeated items at the moment. I would like to add items that
have a start and an end date, that is something like

SCHEDULED: date1 day1 time1--date2 day2 time2

but I can't figure out how to check for these? Do I need to write my own
reg-exp for this and test the whole entry or is there some org internal
function for this? I only found org-get-scheduled-time, but that does
only seem to return the first timestamp?

Any ideas on how to accomplish this?

Thanks

Arun

___
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] Status google calendar sync

2011-01-26 Thread Arun Persaud
Hi

 You are right that googlecl is poorly documented, and worse, it doesn't
 even work as the documentation says it should.  Try retrieving calendar
 events with --fields=title,when and see what happens.  I get the
 title printed out but the when always comes out as None.

my man pages for googlecl don't mention a fields options. Doing

google calendar list when,where,title

works for me though (using googlecl that comes with openSUSE 11.3).

 However, I have had better luck with the python gdata interface.  The
 docs aren't much better but I have managed to figure out how to modify
 an existing event using it.  And, there are examples of how to search
 for specific events...

cool, do you have this integrated with org? if so could you post the code?

 While using googlecl might be interesting it would probably be simpler
 to come up with a specific library for doing the things that need to
 be done directly with gdata (which is what googlecl uses anyway) and
 calling scripts that make use of this specific library, instead.

I guess one could also use google calendar completely without googlecl
or gdata, since you can point google at an .ics file to import it into
google's calendar and Eric's script already handles the other way
(google-org).

Arun

___
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] Status google calendar sync

2011-01-25 Thread Arun Persaud
Hi

On 01/21/2011 03:58 PM, Eric S Fraga wrote:
 I also have been syncing between my Google calendar and org.  A while
 back, I posted this message onto this list:
 
 http://article.gmane.org/gmane.emacs.orgmode/26848
 
 but check out later messages in the thread for an updated awk script.

I had problems using wget, since we don't use google login, but get
redirected to our institute from google, so I would have to use
--load-cookie but couldn't really figure it out... however using
googlecl seems to work fine, so I'm also using this to download the entries

 This dealt with converting a Google calendar into an org file.  I still
 use this.
 
 For the other route, org to Google, I use the googlecl (command line)
 interface:
 
 http://article.gmane.org/gmane.emacs.orgmode/27214

don't really know that much lisp, but I guess you add the entries
directly to google when you create them via org-capture? What happens if
you later edit an entry, say change the time/date? This is something I
do very often and I would need google to reflect those changes. I also
only want to export certain tags and entries that have a date-range
(e.g. start and stop time), but I guess that could be easily arranged in
the lisp function that you wrote?

Arun

___
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] Status google calendar sync

2011-01-21 Thread Arun Persaud
Hi

I'm in the middle of setting something up, at the moment I import google
events into org by using the google command line interface on my linux
machine. For this I changed the line in the config for googcl to print
out an org timestamp and also changed the fields to be printed by using:

date_print_format = %Y-%m-%d %a %H:%M
list_style = title,when,where,url-site

in the general option of .googlecl/config. With this I create a .org
file with all my google calendar entries by running the following script
every N minutes (header + one line sed):

---script start---
#!/bin/bash

# get my google calendar items and create a org-mode file

# output header
echo #+STARTUP: overview
#+TAGS: @google(g)
#+FILETAGS: @google
#+SEQ_TODO: GCAL
#+STARTUP: hidestars

  ~/org/mygooglecal.org

# output entries
google calendar list | sed -e 's/\(.*\),\(.*\) - \(.*\),\(.*\),\(.*\)/*
GCAL \1\n  SCHEDULED: \2--\3\n  Location: \4\n  link: [[\5][link]]/' 
~/org/mygooglecal.org

script end

and by just adding this file to my agenda everything seems to be working
fine...

To sync between different computers I use git with an automated commit,
pull and push, which makes the google entries available on all of my
other computers.

I haven't figured out how to export org to ics, so that google can read
it... I would like to export only items that have a start and an end
timestamp and don't have a google tag (which they get when they are
imported from google). I think I need to add this to
org-icalendar-verify-function, but don't know enough lisp to write
something like this... any ideas?

Ian: how do you export to ics? Complete via python?

regards

Arun

___
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] Re: bug? no newline at beginning of file

2008-11-24 Thread Arun Persaud
Hi

 Mikael Fornius [EMAIL PROTECTED] writes:
 
  ... this was just some thoughts.
 
 Replying my own post now.
 
 My thought was not of any great value because I now fully understand
 your problem:
 
 In org-mode it works as one expect but not in orgtbl-mode and when 
 pointis at beginning of line in the table and you hit RET the table 
 splits up
 but not at first line in orgtbl.

exactly... not a big thing either... plenty of work arounds (e.g. go to 
text-mode, add newline, go to org-mode)., but I thought I report it, since it 
looked like a bug to me ;)

cheers
   ARUN


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


[Orgmode] bug? no newline at beginning of file

2008-11-22 Thread Arun Persaud
Hi

found a possible bug and a quick search in google didn't return any
results, so I thought I send an email to the list (although I'm not
subscribed), but I couldn't find any other place to report it. So here
we go:

My version of the emacs and org:

GNU Emacs 22.2.1 (x86_64-suse-linux-gnu, GTK+ Version 2.12.9) of
2008-09-11 on hammer22

Org-mode version 6.12b (updated from git every weekend)

what to do:

* open a new file
* switch to orgtbl-mode
* create a new table at the beginning of the file (e.g. starting in the
first line)
* got to beginning of the file
* hit enter to add a newline
* nothing happens! I can add newlines everywhere else in the file though

expected behavior: a newline would be added before the table (works if I
turn table mode off)

HTH, great work btw, org-mode is one of my most used emacs modes ;)

Arun


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