[Orgmode] Repeated entry same time every day?

2009-05-05 Thread Piotr Zielinski
Hi,

Is it possible to have a repeater (say SCHEDULED: 2009-05-05 Tue
16:00 +24h or something) that would ensure that the given entry is
automatically scheduled at the same time every day?

Thanks,
Piotr


___
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] Re: Repeated entry same time every day?

2009-05-05 Thread Piotr Zielinski
On Tue, May 5, 2009 at 11:34 PM, Bernt Hansen be...@norang.ca wrote:
 Piotr Zielinski piotr.zielin...@gmail.com writes:

 Is it possible to have a repeater (say SCHEDULED: 2009-05-05 Tue
 16:00 +24h or something) that would ensure that the given entry is
 automatically scheduled at the same time every day?

 Sure.  Just try it :)  Try +1d instead of +24h like this:

 * TODO One
  SCHEDULED: 2009-05-08 Fri 13:00-15:00 +1d

Thanks a lot!  It turns out that I had some code that was explicitly
removing the time.

Piotr


 -Bernt



___
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] [PATCH] Added support for tomorrow as a time specification in tag maching engine, and fixed today.

2008-11-16 Thread Piotr Zielinski

From a5aa4cceb272185eb05c858a042a2b2a2991c095 Mon Sep 17 00:00:00 2001
From: Piotr Zielinski [EMAIL PROTECTED]
Date: Sun, 16 Nov 2008 20:27:30 +
Subject: [PATCH] Added support for tomorrow as a time specification in tag maching
engine, and fixed today.
---
 lisp/org.el |   11 ---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index a598673..c2f4dc9 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9256,11 +9256,16 @@ it as a time string and apply `float-time' to it.  f S is nil, just return 0.
   (error 0.)))
(t 0.)))
 
+(defun org-time-today ()
+  Returns the float number of seconds since the beginning of the
+epoch to the beginning of today (00:00)
+  (float-time (apply 'encode-time (append '(0 0 0) (nthcdr 3 (decode-time))
+
 (defun org-matcher-time (s)
   (cond
-   ((equal s now) (float-time))
-   ((equal s today)
-(float-time (append '(0 0 0) (nthcdr 3 (decode-time)
+   ((string= s now) (float-time))
+   ((string= s today) (org-time-today))
+   ((string= s tomorrow) (+ 86400.0 (org-time-today)))
(t (org-2ft s
 
 (defun org-match-any-p (re list)
-- 
1.5.2.5

___
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] [PATCH] Added org-test.el that contains some unit tests.

2008-11-16 Thread Piotr Zielinski
This is file is really provisional to get us started with unit tests.
It tests some changes made recently by me, and exposes a bug
org-make-tags-matcher.  Please feel free to rewrite/reorganize it, and
port it to a unit test framework when we decide which one to use.


Piotr
From 244885b51f6c85e4a3f72af83587ec2d6490df8a Mon Sep 17 00:00:00 2001
From: Piotr Zielinski [EMAIL PROTECTED]
Date: Sun, 16 Nov 2008 22:01:47 +
Subject: [PATCH] Added org-test.el that contains some unit tests.

This is file is really provisional to get us started with unit tests.
It tests some changes made recently by me, and exposes a bug
org-make-tags-matcher.  Please feel free to rewrite/reorganize it, and
port it to a unit test framework when we decide which one to use.
---
 lisp/org-test.el |   60 ++
 1 files changed, 60 insertions(+), 0 deletions(-)
 create mode 100644 lisp/org-test.el

diff --git a/lisp/org-test.el b/lisp/org-test.el
new file mode 100644
index 000..7178c19
--- /dev/null
+++ b/lisp/org-test.el
@@ -0,0 +1,60 @@
+;; org-test.el --- Unit tests for org.el
+;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+
+;; This file contains some unorganized unit tests.  
+;; TODO: replace with proper test when we decide on a framework
+
+(require 'org)
+
+(defmacro with-current-time-as (decoded-time rest body)
+  Executes the body with current time set to decoded-time.
+
+   This macro is not comprehensive and does only enough to make
+   the tests pass.  TODO: replace this with something proper, eg
+   a mock once we decide what framework we should use.
+  (let ((float-time (float-time (apply 'encode-time (eval decoded-time
+(float-time-function (symbol-function 'float-time)))
+`(flet ((decode-time () ,decoded-time)
+(float-time (optional specified-time)
+  (if specified-time
+(funcall ,float-time-function specified-time)
+  ,float-time)))
+   ,@body)))
+
+(with-current-time-as '(0 7 21 16 11 2008 0 nil 0)
+  (assert (= 1226793600.0 (org-time-today)))
+  (assert (= 1226793600.0 (org-matcher-time today)))
+  (assert (= 122688.0 (org-matcher-time tomorrow)))
+  (assert (= 1226869620.0 (org-matcher-time now)))
+
+  (assert (equal
+   '(+tag1+tag2-tag3 and
+ (progn
+   (setq org-cached-props nil)
+   (and (not (member tag3 tags-list))
+(member tag2 tags-list)
+(member tag1 tags-list)))
+ t)
+   (org-make-tags-matcher +tag1+tag2-tag3)))
+
+  (assert (equal
+   '(+SCHEDULED=\now\ and
+ (progn
+   (setq org-cached-props nil)
+   (org-time= (or (org-cached-entry-get nil SCHEDULED) )
+  1226869620.0))
+ t)
+   (org-make-tags-matcher +SCHEDULED=\now\)))
+
+  ;; FIXME: this test fails because of a bug in org-make-tags-matcher
+  (assert (equal
+   '(+SCHEDULED=\2008-11-16 Wed 21:07\ and
+ (progn
+   (setq org-cached-props nil)
+   (org-time= (or (org-cached-entry-get nil SCHEDULED) )
+  1226869620.0)))
+   t)
+   (org-make-tags-matcher +SCHEDULED=\2008-11-16 Wed 21:07\)))
+
+
+
-- 
1.5.2.5

___
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] [PATCH] Added backward isearch support for headings

2008-08-03 Thread Piotr Zielinski
Changed org-goto-local-search-forward-headings to support backward
search, and renamed it to org-goto-local-search-headings.
---
 lisp/org.el |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 57c6dae..62ad9ea 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4350,7 +4350,7 @@ or nil.
   (let ((isearch-mode-map org-goto-local-auto-isearch-map)
(isearch-hide-immediately nil)
(isearch-search-fun-function
-(lambda () 'org-goto-local-search-forward-headings))
+(lambda () 'org-goto-local-search-headings))
(org-goto-selected-point org-goto-exit-command))
 (save-excursion
   (save-window-excursion
@@ -4391,10 +4391,12 @@ or nil.
 (define-key org-goto-local-auto-isearch-map \C-i 'isearch-other-control-char)
 (define-key org-goto-local-auto-isearch-map \C-m 'isearch-other-control-char)

-(defun org-goto-local-search-forward-headings (string bound noerror)
+(defun org-goto-local-search-headings (string bound noerror)
   Search and make sure that anu matches are in headlines.
   (catch 'return
-(while (search-forward string bound noerror)
+(while (if isearch-forward
+   (search-forward string bound noerror)
+ (search-backward string bound noerror))
   (when (let ((context (mapcar 'car (save-match-data (org-context)
  (and (member :headline context)
   (not (member :tags context
-- 
1.5.2.5


___
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


Re: [Orgmode] FR: Repeated time stamp, jumping from current time

2008-03-02 Thread Piotr Zielinski
On Sun, Mar 2, 2008 at 4:52 AM, Wanrong Lin [EMAIL PROTECTED] wrote:
 Hi,

  Right now we can have a repeated time stamp like this:

  * TODO Do this every month
   SCHEDULED: 2008-03-01 Sat +1m

  If I am late and mark the above done on 2008-03-05, the time stamp will
  automatically jump to 2008-04-01. This is very useful for things like
  paying monthly bills.

  However, for some tasks, it would make more sense to jump from the date
  when it is marked done, not from when it is scheduled to be done.

Here are my thoughts on the issue:

I think of SCHEDULED as my personal plan to start doing something at a
specified time.  In this interpretation, having something scheduled
for the past does not make sense, or more precisely, it should be
functionally equivalent to scheduling it for now (except that it
reminds you that you're behind schedule).  Therefore, I'd vote for
jumping from the current date, not from the time in the SCHEDULED
timestamp.

Your example of paying a bill is, in my view, a DEADLINE, an
externally imposed requirement.  Since whomever imposed the deadline
on you does not care about your personal scheduling, the jumping in
deadlines should be from the time indicated in the timestamp.

Thanks,
Piotr

 An
  example is changing my furnace filter. I am supposed to change it once a
  month, but if I am late for 10 days, the next date to change should be
  30 days away, not 20 days away.

  Maybe we can use a syntax like this to indicate that:

  2008-03-01 Sat +=1m

  Any comments? Thank you.

  Wanrong



  ___
  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



___
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


Re: [Orgmode] commas in URLs?

2008-02-01 Thread Piotr Zielinski
Just to to add one vote for including commas in the urls by default
(at least in some cases); I often copy long links directly from the
browser and have this problem quite often.

  So URLs should just exclude commas that are followed by a whitespace
  or a line break, not all commas - right?

  Yes, but this is harder to do with a regexp.  I wish Emacs had look-
  ahead assertions like perl.

What about saying that a url cannot end with a comma, but can contain
commas?  Something like [a-z,]*[a-z] (this is a big big simplication!).

Piotr


___
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


Re: automatic reminders in Emacs as pop ups [was: Re: [Orgmode] Survey results ]

2008-01-27 Thread Piotr Zielinski
Also, debian/ubuntu package libnotify-bin contains a command-line
utility notify-send that you can use to display non-modal user
notifications, in the same way as popup.py.

Piotr

On Jan 27, 2008 10:11 PM, Nick Dokos [EMAIL PROTECTED] wrote:
 One answer to question 5 on the survey was another question: automatic
 reminders in Emacs as pop ups?

 Here is how I do it, using very little machinery. As part of org-mode
 initialization, I add appointments from the diary to the agenda at
 startup and I also make org-agenda-redo rescan the appt list:

 ---
 (require 'appt)
 (setq org-agenda-include-diary t)
 (setq appt-time-msg-list nil)
 (org-agenda-to-appt)

 (defadvice  org-agenda-redo (after org-agenda-redo-add-appts)
   Pressing `r' on the agenda will also add appointments.
   (progn
 (setq appt-time-msg-list nil)
 (org-agenda-to-appt)))

 (ad-activate 'org-agenda-redo)
 ---

 I enable appt reminders, set the format to 'window and provide
 a display function that calls a python program to do the popup:

 ---
 (progn
   (appt-activate 1)
   (setq appt-display-format 'window)
   (setq appt-disp-window-function (function my-appt-disp-window))
   (defun my-appt-disp-window (min-to-app new-time msg)
 (call-process /home/nick/bin/popup.py nil 0 nil min-to-app msg 
 new-time)))
 ---

 Finally, the popup.py program is trivial:

 ---
 #!/usr/bin/env python

  Simple dialog popup example similar to the GTK+ Tutorials one 

 import gtk
 import sys

 mins = sys.argv[1]
 text = ' '.join(sys.argv[2:])
 dialog = gtk.MessageDialog(None,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
gtk.MESSAGE_INFO, gtk.BUTTONS_OK,
Appt in %s mins: %s % (mins, text))
 dialog.run()
 dialog.destroy()
 ---

 HTH,
 Nick


 ___
 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



___
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] Safer kill-line for org-mode

2008-01-27 Thread Piotr Zielinski
Hi,

Read this to avoid losing your work.

Standard kill-line deletes all text from the point to the end of the
_visible_ line.  It happened to me a few times that I pressed C-k to
delete a few final words of a headline, but instead the whole
(invisible) subtree was deleted.  This kind of mistake is costly
because it may go unnoticed for weeks, when you start wondering what
happened to a sizeable part of your org file and have to go through
rather old backups.  Below is what I believe to be a safer version of
kill-line: it deletes text only to the end of the real line, unless
used at the beginning of the line, in which case it behaves as the
standard kill-line.  I haven't tested much yet, but it seems to be
working ok.

(defun kill-line-safe ()
  (interactive)
  (if (bolp)
  (kill-line)
(kill-region (point) (point-at-eol

(define-key global-map \C-k 'kill-line-safe)

Piotr


___
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


Re: [Orgmode] Re: Remember and then refile

2008-01-20 Thread Piotr Zielinski
On Jan 18, 2008 10:19 PM, Steven Lumos [EMAIL PROTECTED] wrote:

 Have you considered somehow merging the tree selection and
 minibuffer with completion methods so that both are available
 simultaneously?

I haven't made up my mind about org-refile yet, but I'd like to speak
in defense of org-goto.  In my setup, when you start typing in
org-goto, it automatically enters the isearch mode that searches only
headlines, which is very useful for refiling and kind of achieves what
you are asking for.  This requires some additional elisp code; I can
repost it if somebody is interested.

As for completion, both org-refile and org-goto should work with
icicles but I haven't tried it extensively yet (icicles provides
general-purpose extensive completion support for emacs).  My main
point is that I'd rather vote for making org-mode work well with
otherspecialized modes (eg icicles) than for reimplementing the
features.

Thanks,
Piotr


___
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


Re: [Orgmode] Re: FR: Display images in org-mode?

2008-01-09 Thread Piotr Zielinski
I think iimage-mode (minor mode shipped with emacs) does what you want

http://www.netlaputa.ne.jp/~kose/Emacs/iimage.html

Piotr


___
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


Re: [Orgmode] Can you automatically open a branch on load?

2007-12-28 Thread Piotr Zielinski
On Dec 28, 2007 9:12 PM, Hugo Schmitt [EMAIL PROTECTED] wrote:
 You can easily write a couple more lines so that the branch that will
 be opened is configured on the top of the file itself.

Or you can put a call like '(my-open-some-branch Finances)' directly
in the org file using the same emacs mechanism as for defining local
variables (don't remember the details).  This has the advantage of
easy per-file customization but on the other hand might be a security
risk.

Piotr


___
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] Electric insert of headline stars

2007-10-25 Thread Piotr Zielinski
Hi,

Here's a small piece of elisp code that might be useful to some of you.
Pressing '*' now inserts '*' as before, but if there are only spaces
between the beginning of the current line and the point, then all of
them are converted to stars.  Useful for inserting new headlines.

Longer explanaition: assume you have the following structure:

* first level headline
_* second level headline
__* third level headline

(_ denotes an invisible star) Since stars are invisible, I often find
myself trying to create a new subheadline by just inserting a single
star

* first level headline
_* second level headline
__* third level headline
   *

which of course doesn't normally work, hence this elisp code.

(defun local-org-insert-stars ()
  (interactive)
  (when (looking-back ^ * (point-at-bol))
(replace-string   * nil (point-at-bol) (point)))
  (insert *))

(define-key org-mode-map * 'local-org-insert-stars)

Haven't thoroughly tested it, but it seems to work ok.

Piotr


___
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


Re: [Orgmode] Re: depending TODOs, scheduling following TODOs automatically

2007-10-11 Thread Piotr Zielinski
Hi,

I am generally against introducing very specialized features to
org-mode, for the same reasons as described by others in this thread.
The power of org-mode lies in simplicify of the model it offers:
information is a collection of lists that can be queried in various
ways.

This model is simple yet powerful.  For example, org-mode can be used
not only to store ordinary tasks (pay rent, every month), but also
meta-tasks concerning the org-file itself (make sure there are no
stuck projects, every week).  I find this simple idea of storing
meta-tasks very useful.  It gives your org-file life, making it the
single point of trust.  As long as you remember to check your org-mode
every day, you will never forget anything.  Instead of following the
books that tell you to develop a habit of ... just put this habit as
an repetitive task in org-mode.

Back to task dependencies.  I use three tags: NEXT for enabled
actions, TODO for actions that wait for the previous one on the list,
and WAITING for actions that wait for something else.  Whenever an
action is completed, you can easily check whether the next TODO should
be enabled (changed to NEXT) or not.

WAITING actions (with dependencies across different lists) are more
tricky, but in my experience, are quite rare.  Here, if you know that
completing task A will enable task Q in another part of the file,
insert a meta-task TODO enable [[Q]] just after A.  No special
functionality needed, just standard linking.

Of course there are some cases in which this scheme doesn't work, but
these are not many, and I don't believe making them work automatically
is worth the effort.  This is because, in my case, most of the WAITING
actions rely on external triggers (email, phone call), which are
simply not automatable.

Piotr


___
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


Re: [Orgmode] Re: Interpretation of priorities in org-mode

2007-08-01 Thread Piotr Zielinski
On 01/08/07, Renzo Been [EMAIL PROTECTED] wrote:
 But what is actually the difference between using:
 *priorities

 and:
 *Using tags

That's a very good point.  The reason why I decided to use priorities
was because it was easier to make them work with org-agenda.  In
particular, I don't know how to make the agenda display, for example,
all headlines without the :today: tag in the order of increasing
deadlines.  If this is possible, I'll happily switch to tags.

Any ideas?

Thanks,
Piotr


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Interpretation of priorities in org-mode

2007-08-01 Thread Piotr Zielinski
On 01/08/07, Jason F. McBrayer [EMAIL PROTECTED] wrote:
 I don't really use priorities at all, since I'm using org-mode to do
 GTD.

I agree with you on that, I was only suggesting using priorities as a
technical means to label certain tasks as to do today in a way which
is easy in org-mode.

 If something has to be done today, then that's a deadline, not a
 priority.

As I said, my reason for scheduling certain tasks as for today, is
that I like to have a plan of what to do each day.  Without an
explicit plan, I catch myself scanning my todo list many times during
a day, effectively wasting time on recreating the same plan many times.
But I've tried it only for a week now, so I can't say whether it works.

Thanks,
Piotr


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] community writing?

2007-06-09 Thread Piotr Zielinski

Yes.  If you could start an org-mode wiki page, please do.  Over time,
I've written some org-related scripts and elisp code, which I'd like
to share.

Thanks,
Piotr

On 08/06/07, David O'Toole [EMAIL PROTECTED] wrote:


I notice the planner world has some pages where they discuss the
various ways people use planner. I think it would be cool for us to
collectively post some org-mode usage strategies, perhaps on an
emacswiki page.

Or, people could prepare a small .org file and send it to me, and I
could paste it into a page of my site. it could be a collaboratively
written Org-Mode Strategy and Tactics

If anyone enjoys this, I'll get started by writing my own entry.

--
David O'Toole
[EMAIL PROTECTED]
http://dto.freeshell.org/notebook/


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode




--
Piotr Zielinski, Research Associate
Cavendish Laboratory, University of Cambridge, UK
http://www.cl.cam.ac.uk/~pz215/


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] POLL: Removing obsolete variables and features

2007-02-21 Thread Piotr Zielinski

On 21/02/07, Egli Christian (KIRO 43) [EMAIL PROTECTED] wrote:

 ;; FIXME: This variable could be removed, default nil
 (defcustom org-agenda-include-all-todo nil

I am using this to see all the todos that I have not scheduled in my
agenda.


I'd also vote for keeping this variable.

Piotr


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Org-Mode to handle appointments ?

2007-01-08 Thread Piotr Zielinski

Hi Bastien,

Personally, I use org-mode for personal planning (todos, deadlines,
etc), but for appointments I use calendar programs (Google Calendar in
my case).  If your calendar program understands the iCalendar format,
then you can convert it to the diary format, which can then be
incorporated into org-agenda view.  I think I have posted scripts to
do this automatically to this mailing list some time ago; if not, I
can post them again.

You can also store your appointments in your org file as you
suggested, although I haven't tried this approach.  I think it all
boils down to how do you identify your appointments.  If you think of
all/most of your appointments as tightly bound to particular projects,
then storing them in an org-file under a particular project might be a
good idea.  If your appointments are usually not bound to particular
projects, or you need advanced calendar scheduling functions (eg. appt
every second tuesday), then diary or a calendar program is a better
idea I think. It allows you to think of appointments in terms of time
rather than projects they belong to.

Piotr

On 08/01/07, Bastien [EMAIL PROTECTED] wrote:

Hi Carsten and list,

many thanks for Org-Mode 4.61, 'works smoothly here.

I was wondering if org-mode could handle appointments.  This seems to
be a natural extension, no?  I guess insinuating appts into the diary
would be processed by the %%(org-diary) function.

What do you people think of this ?

All the best, and a happy new year to everyone!

--
Bastien


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode




--
Piotr Zielinski, Research Associate
Cavendish Laboratory, University of Cambridge, UK
http://www.cl.cam.ac.uk/~pz215/


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] org-autoclock.el

2006-12-11 Thread Piotr Zielinski

A piece of elisp code that some of you might find useful.

Piotr

==

 org-autoclock.el --- Automatically clock projects
;;
;; Author: Piotr Zielinski
;; Homepage: http://www.cl.cam.ac.uk/~pz215/
;; Version: 0.01
;;
;; Tested with emacs 22.0.50 and org-mode 4.58
;;
;; This package scans your org files looking for links to local files
;; and directories (file:/local/file/example/).  If you are editing a
;; file whose name starts with /local/file/example/, then this package
;; will assume that you are working on the project described by the
;; headline in your org file containing the link
;; file:/local/file/example and start org-clocking it.
;;
;; Current version at http://www.cl.cam.ac.uk/~pz215/files/org-autoclock.el
;;

(require 'org)
(require 'cl)

(defvar org-autoclock-cached-files nil
 The cached list of links to local files collected by
 `org-autoclock-refresh'.)

(defvar org-autoclock-current-project nil
 The name of the current project returned by
 `org-autoclock-get-project'.)

(defmacro org-autoclock-with-collect (variable rest body)
 `(let (,variable)
(labels ((,variable (item) (push item ,variable)))
  ,@body
  (nreverse ,variable

(defun org-autoclock-refresh ()
 Update `org-autoclock-cached-files' by scanning files from
 `org-agenda-files' that are currently visited.
 (setf org-autoclock-cached-files
(org-autoclock-with-collect result
 (dolist (file org-agenda-files)
   (let* ((fullname (expand-file-name file))
  (buffer (find-buffer-visiting fullname)))
 (when buffer
   (with-current-buffer buffer
 (save-excursion
   (goto-char (point-min))
   (while (re-search-forward file:\\([^\n]+\\) nil t)
 (result (list fullname
   (expand-file-name
(match-string-no-properties 1))
   (match-string-no-properties 0

(defun org-autoclock-get-project (filename)
 Returns the name of the current project or nil.
 (loop for (file project name) in org-autoclock-cached-files
when (starts-with filename project)
return (list file name)))

(defun org-autoclock-update-project ()
 Updates `org-autoclock-current-project'.
 (destructuring-bind (optional file project)
 (when ( (or (second (current-idle-time)) 0) 180)
(org-autoclock-get-project (buffer-file-name)))
   (when (not (equal project org-autoclock-current-project))
 (if project
  (with-current-buffer (find-file-noselect file)
(save-excursion
  (widen)
  (goto-char (point-min))
  (search-forward project)
  (org-back-to-heading t)
  (org-clock-in)))
(org-clock-out t))
 (setf org-autoclock-current-project project

(run-with-idle-timer 180 t 'org-autoclock-update-project)
(run-with-timer 300 300 'org-autoclock-update-project)
(add-hook 'org-mode-hook 'org-autoclock-refresh)

(provide 'org-autoclock)

==

--
Piotr Zielinski, Research Associate
Cavendish Laboratory, University of Cambridge, UK
http://www.cl.cam.ac.uk/~pz215/


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Bug fix and org-agenda-todo-ignore-deadlines option

2006-10-05 Thread Piotr Zielinski

Carsten,

Here's a patch that adds a new option
org-agenda-todo-ignore-deadlines.  If set to t (default nil), the
global todo list does not display deadlines which are closer than
org-deadline-warning-days, because such deadlines will be displayed by
the agenda anyway.  Besides, it fixes a bug with
org-agenda-todo-ignore-scheduled.

Piotr

--- org.el  2006-10-04 11:14:17.0 +0200
+++ /home/pz215/myfiles/emacs/org.el2006-10-06 03:09:24.0 +0200
@@ -1635,6 +1635,14 @@
  :group 'org-todo
  :type 'boolean)

+(defcustom org-agenda-todo-ignore-deadlines nil
+  Non-nil means, don't show entries in the global todo list that
+have a deadline within the next org-deadline-warning-days
+days. The idea behind this is that by such items will appear in the
deadline list anyway.
+  :group 'org-agenda
+  :group 'org-todo
+  :type 'boolean)
+
(defcustom org-timeline-show-empty-dates 3
  Non-nil means, `org-timeline' also shows dates without an entry.
When nil, only the days which actually have entries are shown.
@@ -5998,6 +6006,15 @@
  (setq ans1 (format-time-string %Y-%m-%d time)))
(if (active-minibuffer-window) (exit-minibuffer

+(defun org-days-to-time (timestamp-string)
+  (- (time-to-days (org-time-string-to-time timestamp-string))
+ (time-to-days (current-time
+
+(defun org-deadline-close (timestamp-string optional ndays)
+  (and ( (org-days-to-time timestamp-string)
+ (or ndays org-deadline-warning-days))
+   (not (org-entry-is-done-p
+
(defun org-check-deadlines (ndays)
  Check if there are any deadlines due or past due.
A deadline is considered due if it happens within `org-deadline-warning-days'
@@ -6013,12 +6030,7 @@
(case-fold-search nil)
(regexp (concat \\ org-deadline-string  *\\([^]+\\)))
(callback
- (lambda ()
-   (and (let ((d1 (time-to-days (current-time)))
-  (d2 (time-to-days
-   (org-time-string-to-time (match-string 1)
-  ( (- d2 d1) org-warn-days))
-(not (org-entry-is-done-p))
+ (lambda () (org-deadline-close (match-string 1) org-warn-days
(message %d deadlines past-due or due within %d days
(org-occur regexp nil callback)
org-warn-days)))
@@ -8057,17 +8069,24 @@
\\)\\)
  org-not-done-regexp)
[^\n\r]*\\)))
-(sched-re (concat .*\n?.*? org-scheduled-time-regexp))
+(deadline-re (concat .*\\(\n[^*].*\\)? org-deadline-time-regexp))
+(sched-re (concat .*\\(\n[^*].*\\)? org-scheduled-time-regexp))
marker priority category tags
ee txt)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
  (catch :skip
-   (when (and org-agenda-todo-ignore-scheduled
-  (looking-at sched-re))
- ;; FIXME: the following test also happens below, but we need it here
- (or org-agenda-todo-list-sublevels (org-end-of-subtree 'invisible))
- (throw :skip nil))
+   (save-match-data
+ (beginning-of-line)
+ (when (or (and org-agenda-todo-ignore-scheduled
+(looking-at sched-re))
+   (and org-agenda-todo-ignore-deadlines
+(looking-at deadline-re)
+(org-deadline-close (match-string 2
+
+   ;; FIXME: the following test also happens below, but we need it here
+   (or org-agenda-todo-list-sublevels (org-end-of-subtree 'invisible))
+   (throw :skip nil)))
   (org-agenda-skip)
   (goto-char (match-beginning 1))
   (setq marker (org-agenda-new-marker (1+ (match-beginning 0)))


--
Piotr Zielinski, Research Associate
Cavendish Laboratory, University of Cambridge, UK
http://www.cl.cam.ac.uk/~pz215/


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Dragging URLs to an org buffer

2006-10-04 Thread Piotr Zielinski

On 04/10/06, Carsten Dominik [EMAIL PROTECTED] wrote:

On Oct 3, 2006, at 19:27, Piotr Zielinski wrote:
 Here's a piece of elisp that allows you to drag URLs from a webbrowser
 (or other apps) to an org buffer.

I like the functionality, but I do find it too specialized to make this
behavior the default.  So I would weaken it, or enclose turning it on
into a customization variable.


Yes, I completely agree with you, this was a hack that worked for me
rather than something everybody could use.  But I thought sharing it
with others might be a good idea, even if only for useful feedback
like yours.

The only thing which I have a different opinion about is what to do
when you drop a URL in the middle of the line.  I believe this
function should be assigned to normal paste (middle button).  My
goal was to make drag-and-drop useful for managing org-mode lists
_without_ using a keyboard.  For me this means: (i) an easy
(keyboard-less) way of insterting a new list element before or after
the current element, and (ii) inserting the URL into the current line,
without the need of manual adjustment (adding spaces around, adding
the colon, etc.).  So while I agree that the behaviour must be
customizable, I'd like a solution that satisfies these two criteria.
Anyway, I'll do some modifications, and send the next version.


The reasons why I find it too intrusive
the way it is now are:

- You enforce a colon for adding to the end of the line
- you enforce a particular type of bullet.
- when inserting in a empty line, the color switches to fixed-width
quotation
- people might want to use drag-and-drop to insert something into the
text that happens to be a bullet item.

Proposals:

- Don't enforce the colon when inserting at the end of the line.
- In the middle of a line, just insert there.
- If the current line is a bullet or a headline, *and* if you drop *on*
either the bullet or the headline stars, then make a new
headline/bullet for the dragged text.  Always make the bullet after the
current line.  (well, when inserting in front of a bullet, you could
insert before the current...)
- Respect the type of bullet:  numbered, -, +, *.


Piotr


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Another GTD question.

2006-10-04 Thread Piotr Zielinski

Hi,

In relation to Carsten's email, I'd like to ask about possible
integration of headings and plain lists.  I remember that such
integration was difficult because of the implementation of
outline-mode, but I don't know the details.  In case this is possible,
here are a few reasons why I'd like it:

1. As opposed to headings, plain list items can consists of more than
  one line.  On the other hand, they cannot be assigned tags or
  marked TODO.  So, sometimes, one has to use one or the other.  This
  is especially problematic, if you would like a TODO item below a
  multi-line plain list item.  It would be great if the features of
  headings and plain lists could be, at least to some extent,
  combined.

2. Code duplication.  At the moment, AFAIK, you need to write separate
  code for headings and plain lists.  Also, some features exist for
  both but in different forms, for example, TODO/DONE for headings is
  essentially the same as [ ]/[X] for plain lists.  I don't mind
  having different representation for the same concept as long as
  their share the same handling code.

However, I feel that any attempt at integrating integrating headings
and plain lists would require a significant rewrite.  Carsten, could
you please comment on the main difficulties of such integration?

Thanks,
Piotr


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Another GTD question.

2006-10-01 Thread Piotr Zielinski

Hi,

Org-mode is a major part of my GTD scheme, however, there are some
tasks for which I think it's not ideal.  One example are lists of
lightweight items; items that are not critical and nothing seriously
bad would happen if they are forgotten.  Interesting webpages to read
or papers to read/print are good examples.


FORGETTABLE LISTS

The following requirements describe the problem:

1. Adding new items must be as easy as possible, preferably just a
  single click of the browser button Mark this page for future
  reading.  This is the most important requirement, which is not
  currently met by org-mode.

2. The list works like a stack: adding is possible only on the top.
  This keeps the items on the list in the approximate order of
  decreasing relevance to my current interests.

3. Only the say 10 most recent items are of any relevance.  If any
  earlier items haven't been acted upon, they are not relevant
  enough: I have at least 10 more interesting things to do.  I don't
  want to see such items; if they become relevant in the future I can
  always add them again.


MY LISTS

1. To Read for webpages/papers I want to read
2. To Print for pdfs to print when I'm in the office
3. To Use interesting internet services to try
4. To Buy for gadgets I might be interested in buying
5. To Supermemo for concepts to memorize with supermemo [1]
6. Books to Read
7. Movies to Watch


IMPLEMENTATION

Currently, I use del.icio.us to maintain them.  I have a menu in the
Toolbar menu that contains bookmarklets like Add To Read with the
following URL (one line)

javascript: function loadScript(scriptURL) { var scriptElem =
document.createElement('iframe'); scriptElem.setAttribute('src',
scriptURL); document.body.appendChild(scriptElem);}
loadScript('https://api.del.icio.us/v1/posts/add?tags=to-readurl='+encodeURIComponent(location.href)+'description='+encodeURIComponent(document.title))

and also Live Bookmarks that point to the RSS of the relevant lists,
and display the first 10 or so items on each list.


METALISTS

Here are some places I use for maintaining lists: org-mode files,
browser bookmarks, amazon basket, amazon wishlist, amazon recommended
books, watchthatpage, google alerts, delicious, movielens, citeulike.
Each of them is different, has its strengths and weaknesses, and it
would be very difficult to integrate them into a single system.  My
solution at the moment, is just to have a metalist: a list in my
org file containing URLs of all my lists.

Piotr

[1] http://www.supermemo.net.pl/index.net


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Emacs-orgmode] Emacs-Calendar export to iCal/vcal

2006-08-23 Thread Piotr Zielinski

Hi Phil,

Not directly relevant, but here's what I use to synchronize the
calendar information in the other direction: from iCalendar calendars
to emacs org-mode.  The whole setup is rather hacky and complicated (I
didn't really have time to make it more presentable) but it might be
still useful to some.

I have all my org-files in ~/myfiles/org/.  File calendars.txt,
contains URLs of remote calendars I'd like to include in my
org-agenda.  The first word in each line is the name of the local file
to which the remote calendar will periodically be downloaded:

-- calendars.txt STARTS --
camtalks http://talks.cam.ac.uk/show/ics/5245
msresearchtalks http://www.srcf.ucam.org/users/pz215/msr.ics
-- calendars.txt ENDS --

Once a day I execute the following script (from cron):

-- update-calendars STARTS --
#!/bin/bash

orgdir=~/myfiles/org
diary=$orgdir/calendars.diary
emacs=$orgdir/local-calendars.el


$diary

echo (setq local-calendars '(  $emacs

cat $orgdir/calendars.txt | \
{
   while read name url ; do
wget -N -O $orgdir/$name.ics $url
echo #include \$orgdir/$name.diary\  $diary
echo \$name\   $emacs
   done
}

echo ))  $emacs
-- update-calendars ENDS --

It downloads all the remote calendars described in calendars.txt and
creates two new files.  First, calendars.diary, which is an emacs
diary meta-file that just includes the proper calendar files.

-- calendars.diary STARTS --
#include /home/pz215/myfiles/org/camtalks.diary
#include /home/pz215/myfiles/org/msresearchtalks.diary
-- calendars.diary ENDS --

The second file created by update-calendars is local-calendars.el,
an elisp file that contains a list of calendars:

-- local-calendars.el STARTS --
(setq local-calendars '(
camtalks
msresearchtalks
))
-- local-calendars.el ENDS --

What remains is to convert the downloaded icalendar files into the
diary files included by calendars.diary.  To this end, I have the
following lines in my .emacs:

-- .emacs SNIPPET STARTS --
(require 'calendar)
(european-calendar)
(load ~/myfiles/org/local-calendars.el)
(dolist (name local-calendars)
 (let ((ical (concat /home/pz215/myfiles/org/ name .ics))
(diary (concat /home/pz215/myfiles/org/ name .diary)))
   (when (file-newer-than-file-p ical diary)
 (with-current-buffer (find-file-noselect diary)
(kill-region (point-min) (point-max))
(icalendar-import-file ical diary)
-- .emacs SNIPPET ENDS --

That's it.  If you want emacs to notify you about your appointments,
take a look at the function appt-activate in the appt library.  If
you use a desktop environment that uses the standard notification
deamon (e.g., GNOME), you can set up the appt library to use it.  Take
a look at the send-notify command from the libnotify-bin package
(Debian/Ubuntu).

Thanks,
Piotr


On 23/08/06, Carsten Dominik [EMAIL PROTECTED] wrote:


Hi Phillip,

have you read this?

http://staff.science.uva.nl/~dominik/Tools/org/org.html#iCalendar-export

If yes, can you be more specific about what you are missing?

- Carsten

On Aug 23, 2006, at 22:46, Philipp Raschdorff wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Hi,

 I'm using emacs +org-mode mainly for organizing todos and for
 brainstorming in project planing and organizing tasks etc. So it's
 mainly a (very powerfull) outliner.

 I playes arround with the DUE  DEADLINE features and realized that
 there is one thing missing for me:

 synchronizing emacs-todos / appointments to iCal (Mac OS X 10.4)

 To make it easier: I really would like to have it one way: Adding data
 from emacs to an iCal-file.

 I'm using my mobile phone to synchronize with my calendar (iCal) and
 it would be nice to have EMacs copying data to iCal and then have this
 data on my mobile phone after the next sync.

 What do you think? Are you using the emacs-calendar-functions and how
 to you synchronize to other applications?

 Any suggestions would be great.

 Best regards from Berlin / Germany

 Phil
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.3 (Darwin)

 iD8DBQFE7L7HmbjPeL8dZWgRAt29AJ9JyQJK5Ps3UJyAuFDGGhlZq+WdQgCeIMvj
 Sl/n5RM1yFFlpSX8umWWH8A=
 =+rV9
 -END PGP SIGNATURE-


 ___
 Emacs-orgmode mailing list
 Emacs-orgmode@gnu.org
 http://lists.gnu.org/mailman/listinfo/emacs-orgmode



--
Carsten Dominik
Sterrenkundig Instituut Anton Pannekoek
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477



___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode




--
Piotr Zielinski, Research Associate
Cavendish Laboratory, University of Cambridge, UK
http://www.cl.cam.ac.uk/~pz215/


___
Emacs-orgmode mailing list
Emacs-orgmode

Re: [Emacs-orgmode] todo and deadline highlighting

2006-06-19 Thread Piotr Zielinski

On 12/06/06, Carsten Dominik [EMAIL PROTECTED] wrote:


On Jun 8, 2006, at 1:34, Piotr Zielinski wrote:

 The following two functions redefine org-show-todo-tree, so that TODO
 items SCHEDULED for the future are not highlighted.  Only
 non-scheduled TODO items or TODO items scheduled for the past or
 present are highlighted.  The SCHEDULED directive must be on the same
 line as the TODO keyword.

This is another interesting idea, but the search must allow more than
the current line.  Everything up to the next headline  (or any level)
should be searched.


Another try:

(defun org-todo-is-current ()
 Checks whether a TODO item is current.
 (if (re-search-forward org-scheduled-time-regexp
 (save-excursion (outline-next-heading) (point)) t)
 (let ((today (calendar-absolute-from-gregorian
(calendar-current-date)))
(timestamp (time-to-days
(org-time-string-to-time (match-string 1)
(= timestamp today))
   t))


Piotr


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Emacs-orgmode] todo and deadline highlighting

2006-06-07 Thread Piotr Zielinski

Hi,

Here are three functions related to todo and deadline highlighting is
the todo buffer.  The first lets you highlight upoming deadlines and
todo items at the same time.

(defun org-check-deadlines-and-todos (ndays)
 (org-check-deadlines ndays)
 (flet ((org-remove-occur-highlights (optional beg end noremove))
 (org-overview ()))
   (org-show-todo-tree nil)))

It would be nice to be able to tell the org-occur function not to
remove existing highlights in a less hacky way.  Another suggestion:
explicit specification of the face used for highlighting so that
deadlines and todos could use a different face.  Yet another
suggestion: the org-occur callback could return the face to use, so
that different faces could be used for deadline highlighting,
depending on the urgency of the deadline (ie. in 3 days vs. in 30
days).

The following two functions redefine org-show-todo-tree, so that TODO
items SCHEDULED for the future are not highlighted.  Only
non-scheduled TODO items or TODO items scheduled for the past or
present are highlighted.  The SCHEDULED directive must be on the same
line as the TODO keyword.

(defun org-todo-is-current ()
 Checks whether a TODO items is current.
 (if (re-search-forward org-scheduled-time-regexp (point-at-eol) t)
 (let ((today (calendar-absolute-from-gregorian
(calendar-current-date)))
(timestamp (time-to-days
(org-time-string-to-time (match-string 1)
(= timestamp today))
   t))

(defun org-show-todo-tree (arg)
 Make a compact tree which shows all headlines marked with TODO.
The tree will show the lines where the regexp matches, and all higher
headlines above the match.
With \\[universal-argument] prefix, also show the DONE entries.
With a numeric prefix N, construct a sparse tree for the Nth element
of `org-todo-keywords'.
 (interactive P)
 (let ((case-fold-search nil)
(kwd-re
 (cond ((null arg) org-not-done-regexp)
   ((equal arg '(4)) org-todo-regexp)
   ((= (prefix-numeric-value arg) (length org-todo-keywords))
(regexp-quote (nth (1- (prefix-numeric-value arg))
   org-todo-keywords)))
   (t (error Invalid prefix argument: %s arg)
   (message %d TODO entries found
 (org-occur (concat ^ outline-regexp  + kwd-re )
'org-todo-is-current


Piotr


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Emacs-orgmode] Org-mouse 0.15: Agenda buffer support

2006-05-26 Thread Piotr Zielinski

Org-mouse.el 0.15 includes support for the Agenda buffer: it has the
same context-sensitive menus (tags, timestamps, etc) as normal
org-mode buffers, so that you can now modify the entries directly from
the Agenda buffer.

http://www.cl.cam.ac.uk/~pz215/files/org-mouse.el

Piotr


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Emacs-orgmode] org-mouse.el 1.12 released: compatible with Emacs 21

2006-04-25 Thread Piotr Zielinski
Version 1.12 of org-mouse.el, better mouse support for org-mode, is available:

http://www.cl.cam.ac.uk/~pz215/files/org-mouse.el

Bug reports and feature requests welcome.

Thanks,
Piotr

Changelog:

;; Version 0.12
;; + compatible with Emacs 21
;; + custom agenda commands added to the main menu
;; + moving trees should now work between buffers


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Emacs-orgmode] org-mouse.el

2006-04-13 Thread Piotr Zielinski
On 13/04/06, Carsten Dominik [EMAIL PROTECTED] wrote:

 In the latest version, the context menu on links does not seem to work

Yes, the org-mouse-at-link function has never been particularly
elegant: I had simply copied a fragment of org.el, this is why it was
so sensitive to changes in org-mode.
Your suggestion is much better in this respect.  I've put it into
org-mouse.el, thanks.

 One more thing.  [...]  Could org-mouse.el honor this
 variable or even better no longer put those bindings to
 [follow-link] at all because org.el does this already?

Done.

Thanks,

Piotr


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode