Re: [PATCH] patches for org-notify.el

2020-09-13 Thread Peter Münster
On Sun, Sep 13 2020, Bastien wrote:

> you may want to think about a place where you want to host
> org-notify.el for the future.

code.orgmode.org or github.com, as you prefer.

Kind regards,
-- 
   Peter




[PATCH] patches for org-notify.el

2020-09-13 Thread Peter Münster
Hi,

Please find attached 2 patches for org-notify.el.

Kind regards,
-- 
   Peter
>From 9ffa89dc99bfe967d9c591948d84dddb2eccdc38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Peter=20M=C3=BCnster?= 
Date: Sun, 13 Sep 2020 15:44:00 +0200
Subject: [PATCH 1/2] org-notify.el: Use cl- prefixed functions, and require cl-lib

---
 contrib/lisp/org-notify.el | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/contrib/lisp/org-notify.el b/contrib/lisp/org-notify.el
index 9f8677871..56d565c74 100644
--- a/contrib/lisp/org-notify.el
+++ b/contrib/lisp/org-notify.el
@@ -57,7 +57,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'org-element)
 
 (declare-function appt-delete-window"appt"  ())
@@ -155,7 +155,7 @@ PERIOD."
   (message "Warning: notification for \"%s\" behind schedule!" heading))
   t)
 
-(defun org-notify-process ()
+(cl-defun org-notify-process ()
   "Process the todo-list, and possibly notify user about upcoming or
 forgotten tasks."
   (cl-macrolet ((prm (k) `(plist-get prms ,k))  (td (k) `(plist-get todo ,k)))
@@ -163,7 +163,7 @@ forgotten tasks."
   (let* ((deadline (td :deadline))  (heading (td :heading))
  (uid (td :uid))(last-run-sym
  (intern (concat ":last-run-" uid
-(dolist (prms (plist-get org-notify-map (td :notify)))
+(cl-dolist (prms (plist-get org-notify-map (td :notify)))
   (when (< deadline (org-notify-string->seconds (prm :time)))
 (let ((period (org-notify-string->seconds (prm :period)))
   (last-run (prm last-run-sym))  (now (float-time))
@@ -184,7 +184,7 @@ forgotten tasks."
  (intern (concat "org-notify-action"
  (symbol-name action
plist
-(return)))
+(cl-return)))
 
 (defun org-notify-add (name  params)
   "Add a new notification type.
-- 
2.26.2

>From 54134c8d07bafee3d8fc7492658c3a1c067aea5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Peter=20M=C3=BCnster?= 
Date: Sun, 13 Sep 2020 16:18:56 +0200
Subject: [PATCH 2/2] org-notify.el: Limit the number of notifications

(org-notify-max-notifications-per-run): New option for limiting the
notifications.
(org-notify-process): Use it.

---
 contrib/lisp/org-notify.el | 63 ++
 1 file changed, 36 insertions(+), 27 deletions(-)

diff --git a/contrib/lisp/org-notify.el b/contrib/lisp/org-notify.el





diff --git a/contrib/lisp/org-notify.el b/contrib/lisp/org-notify.el
index 56d565c74..7f610a0df 100644
--- a/contrib/lisp/org-notify.el
+++ b/contrib/lisp/org-notify.el
@@ -74,6 +74,11 @@
   :type 'boolean
   :group 'org-notify)
 
+(defcustom org-notify-max-notifications-per-run 3
+  "Maximum number of notifications per run of `org-notify-process'."
+  :type 'integer
+  :group 'org-notify)
+
 (defconst org-notify-actions
   '("show" "show" "done" "done" "hour" "one hour later" "day" "one day later"
 "week" "one week later")
@@ -158,33 +163,37 @@ PERIOD."
 (cl-defun org-notify-process ()
   "Process the todo-list, and possibly notify user about upcoming or
 forgotten tasks."
-  (cl-macrolet ((prm (k) `(plist-get prms ,k))  (td (k) `(plist-get todo ,k)))
-(dolist (todo (org-notify-todo-list))
-  (let* ((deadline (td :deadline))  (heading (td :heading))
- (uid (td :uid))(last-run-sym
- (intern (concat ":last-run-" uid
-(cl-dolist (prms (plist-get org-notify-map (td :notify)))
-  (when (< deadline (org-notify-string->seconds (prm :time)))
-(let ((period (org-notify-string->seconds (prm :period)))
-  (last-run (prm last-run-sym))  (now (float-time))
-  (actions (prm :actions))   diff  plist)
-  (when (or (not last-run)
-(and period (< period (setq diff (- now last-run)))
- (org-notify-maybe-too-late diff period heading)))
-(setq prms (plist-put prms last-run-sym now)
-  plist (append todo prms))
-(if (if (plist-member prms :audible)
-(prm :audible)
-  org-notify-audible)
-(ding))
-(unless (listp actions)
-  (setq actions (list actions)))
-(dolist (action actions)
-  (funcall (if (fboundp action) action
- (intern (concat "org-notify-action"
- (symbol-name action
-   plist
-(cl-return)))
+  (let ((notification-cnt 0))
+(cl-macrolet ((prm (k) `(plist-get prms ,k))  (td (k) `(plist-get todo ,k)))
+  (dolist (todo (org-notify-todo-list))
+	(let* ((deadline 

[O] [PATCH]: Replace calls to obsolete macros in org-notify.el

2018-01-15 Thread Peter Münster
Hi,

Please find attached a patch that removes calls to obsolete macros.

Kind regards,
-- 
   Peter
>From 8d2f68f7c01687565dcd248930ab949ab3b77516 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Peter=20M=C3=BCnster?= 
Date: Mon, 15 Jan 2018 19:23:51 +0100
Subject: [PATCH] Replace calls to obsolete macros

* contrib/lisp/org-notify.el: Replace flet with cl-letf and macrolet
with cl-macrolet.
---
 contrib/lisp/org-notify.el | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/contrib/lisp/org-notify.el b/contrib/lisp/org-notify.el
index 96e7d4ee2..8e800eec7 100644
--- a/contrib/lisp/org-notify.el
+++ b/contrib/lisp/org-notify.el
@@ -118,7 +118,7 @@ simple timestamp string."
 
 (defun org-notify-make-todo (heading  ignored)
   "Create one todo item."
-  (macrolet ((get (k) `(plist-get list ,k))
+  (cl-macrolet ((get (k) `(plist-get list ,k))
  (pr (k v) `(setq result (plist-put result ,k ,v
 (let* ((list (nth 1 heading))  (notify (or (get :NOTIFY) "default"))
(deadline (org-notify-convert-deadline (get :deadline)))
@@ -157,7 +157,7 @@ PERIOD."
 (defun org-notify-process ()
   "Process the todo-list, and possibly notify user about upcoming or
 forgotten tasks."
-  (macrolet ((prm (k) `(plist-get prms ,k))  (td (k) `(plist-get todo ,k)))
+  (cl-macrolet ((prm (k) `(plist-get prms ,k))  (td (k) `(plist-get todo ,k)))
 (dolist (todo (org-notify-todo-list))
   (let* ((deadline (td :deadline))  (heading (td :heading))
  (uid (td :uid))(last-run-sym
@@ -245,9 +245,10 @@ seconds.  The default value for SECS is 20."
   (switch-to-buffer (find-file-noselect file))
   (org-with-wide-buffer
(goto-char begin)
-   (show-entry))
+   (outline-show-entry))
   (goto-char begin)
   (search-forward "DEADLINE: <")
+  (search-forward ":")
   (if (display-graphic-p)
   (x-focus-frame nil)))
   (save-excursion
@@ -268,7 +269,7 @@ seconds.  The default value for SECS is 20."
 
 (defun org-notify-on-action-button (button)
   "User wants to see action after button activation."
-  (macrolet ((get (k) `(button-get button ,k)))
+  (cl-macrolet ((get (k) `(button-get button ,k)))
 (org-notify-on-action (get 'plist) (get 'key))
 (org-notify-delete-window (get 'buffer))
 (cancel-timer (get 'timer
@@ -311,7 +312,7 @@ seconds.  The default value for SECS is 20."
   (compose-mail user-mail-address (concat "TODO: " (plist-get plist :heading)))
   (insert (org-notify-body-text plist))
   (funcall send-mail-function)
-  (flet ((yes-or-no-p (prompt) t))
+  (cl-letf (((symbol-function 'yes-or-no-p) (lambda (x) t)))
 (kill-buffer)))
 
 (defun org-notify-select-highest-window ()
@@ -334,7 +335,7 @@ org-notify window.  Mostly copied from `appt-select-lowest-window'."
 (defun org-notify-action-window (plist)
   "Pop up a window, mostly copied from `appt-disp-window'."
   (save-excursion
-(macrolet ((get (k) `(plist-get plist ,k)))
+(cl-macrolet ((get (k) `(plist-get plist ,k)))
   (let ((this-window (selected-window))
 (buf (get-buffer-create
   (format org-notify-window-buffer-name (get :uid)
-- 
2.13.6



Re: [O] org-notify: can't define an org-notify-add

2015-08-24 Thread Peter Münster
On Fri, May 22 2015, alain.coch...@unistra.fr wrote:

 Am I doing something trivially wrong?  Any idea how I could debug
 this?  (I have no relevant message in the *Messages* buffer.)

 Many thanks in advance.

Hi,

It seems, that the Org Mode developers have not yet applied this patch:
http://article.gmane.org/gmane.emacs.orgmode/73647

As workaround, you can apply it on your local file.
I'll send the patch again.

-- 
   Peter




[O] [PATCH] org-notify: Fix compatibility with latest org-element (uppercase properties)

2015-08-24 Thread Peter Münster
* contrib/lisp/org-notify.el (org-notify-make-todo): Properties from
  org-element are all uppercase now.
* (org-notify-maybe-too-late): Fix typo in docstring (thanks to davemq,
  https://github.com/p-m/org-notify/issues/3).
---
 contrib/lisp/org-notify.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/lisp/org-notify.el b/contrib/lisp/org-notify.el
index da2c96f..8bcca9f 100644
--- a/contrib/lisp/org-notify.el
+++ b/contrib/lisp/org-notify.el
@@ -120,7 +120,7 @@ simple timestamp string.
   Create one todo item.
   (macrolet ((get (k) `(plist-get list ,k))
  (pr (k v) `(setq result (plist-put result ,k ,v
-(let* ((list (nth 1 heading))  (notify (or (get :notify) default))
+(let* ((list (nth 1 heading))  (notify (or (get :NOTIFY) default))
(deadline (org-notify-convert-deadline (get :deadline)))
   (heading (get :raw-value))
result)
@@ -148,7 +148,7 @@ simple timestamp string.
  'headline 'org-notify-make-todo)
 
 (defun org-notify-maybe-too-late (diff period heading)
-  Print waring message, when notified significantly later than defined by
+  Print warning message, when notified significantly later than defined by
 PERIOD.
   (if ( (/ diff period) 1.5)
   (message Warning: notification for \%s\ behind schedule! heading))
-- 
2.1.4

   Peter




Re: [O] Notifications-notify for org-mode scheduled items?

2015-08-24 Thread Peter Münster
On Mon, Mar 02 2015, Leo Ufimtsev wrote:

 I would like to receive desktop notifications (1* e.g below) for scheduled 
 items. 
 E.g if I schedule like this:

 * Make Coffee 
   SCHEDULED: 2015-03-02 Mon 01:30

 Then I would like a desktop notification to pup up at 1:30 telling me to make 
 coffee.

 I saw the org-notify package, but besides this post:
 http://permalink.gmane.org/gmane.emacs.orgmode/59339
 I didn't see any documentation on it, making it somewhat tricky to configure. 

Hi,

Please find here a minimal working example:

Configuration:
--8---cut here---start-8---
(add-to-list 'load-path .../org-mode/contrib/lisp)
(require 'org-notify)
(setq org-agenda-files '(/tmp/test-agenda.org))
(org-notify-start)
--8---cut here---end---8---

File /tmp/test-agenda.org:
--8---cut here---start-8---
* TODO Make Coffee 
  DEADLINE: 2015-08-24 Mon 17:30
--8---cut here---end---8---

-- 
   Peter




Re: [O] [PATCH] org-notify: Fix compatibility with latest org-element (uppercase properties)

2015-08-24 Thread Peter Münster
On Mon, Aug 24 2015, Nicolas Goaziou wrote:

 Out of curiosity, as org-notify.el's author, don't you have write access
 into repository?

I guess no, but I've never tried...

-- 
   Peter




Re: [O] org-clock-select-task: how does it work?

2015-01-24 Thread Peter Münster
On Sat, Jan 24 2015, Peter Münster wrote:

 My version is git HEAD and my list is empty.

No, it was not HEAD. I did not realise, that my git pull failed
because of local changes...  Finally, git HEAD is just like 8.2.10.


 - I get a list with some items, but only very few (only items, where
   I've clocked in in this same emacs session).
 - There are duplicates in the list.
 - When selecting an item, another one is clocked in.

I cannot reproduce the duplicates, but there are still the 2 other
issues. Should I send a bug report?

-- 
   Peter




Re: [O] org-clock-select-task: how does it work?

2015-01-24 Thread Peter Münster
On Sat, Jan 24 2015, Peter Münster wrote:

 - I get a list with some items, but only very few (only items, where
   I've clocked in in this same emacs session).

Solved:
  (setq org-clock-persist 'history)
  (org-clock-persistence-insinuate)


 - There are duplicates in the list.

Not reproducible.


 - When selecting an item, another one is clocked in.

Ok, with org-clock-in-last the clock of the task at the cursor position
is selected, but org-clock-in (C-u C-c C-x C-i) works nicely!
Ergo: solved too.


Sorry for the noise...
-- 
   Peter




Re: [O] org-clock-select-task: how does it work?

2015-01-24 Thread Peter Münster
On Sat, Jan 24 2015, Tory S. Anderson wrote:

 Peter, on my run Org-mode version 8.2.10, I see just what you are describing:
 a numbered list with the most recent things at the top.

Ok, 8.2.10 seems to work. My version is git HEAD and my list is empty.


 It just doesn't seem to do anything after that.

Indeed. Please try (org-clock-in (org-clock-select-task)) or
C-u M-x org-clock-in-last (or C-u C-c C-x C-x).


After switching to 8.2.10, I have 3 other problems:

- I get a list with some items, but only very few (only items, where
  I've clocked in in this same emacs session).
- There are duplicates in the list.
- When selecting an item, another one is clocked in.

TIA for any help,
-- 
   Peter




[O] org-clock-select-task: how does it work?

2015-01-24 Thread Peter Münster
Hi,

How does this function work please?

When I start this function, I get a *Clock Task Select* buffer with the
line Recent Tasks and this prompt in the minibuffer: Select task for
clocking:. There is no more cursor and whatever I type (TAB for
example), I get user-error: Invalid task choice. Attached is a
screenshot of my emacs after M-x org-clock-select-task.

I would like to get a list of the most recent clocked tasks (most recent
at first) and then chose one.

TIA for any hints,
-- 
   Peter


[O] bug in org-clock-in-last

2015-01-24 Thread Peter Münster
Hi,

With one prefix-argument, org-clock-in-last calls
(org-clock-in (org-clock-select-task))

But it seems, that org-clock-in doesn't expect such an argument.
That means, that org-clock-in ignores the selected task.

-- 
   Peter




Re: [O] [PATCH 2/2] org-notify: Fix compatibility with latest org-element (uppercase properties)

2013-06-27 Thread Peter Münster
On Thu, Jun 27 2013, Bastien wrote:

 * contrib/lisp/org-notify.el (org-notify-make-todo): Properties from
 org-element are all uppercase now.

 Mhh... not sure what it means -- do you have a pointer?

Yes, here: http://article.gmane.org/gmane.emacs.orgmode/73628

Citation:

  | (defun org-element-headline-parser (limit optional raw-secondary-p)
  |   Parse a headline.
  |
  | Return a list whose CAR is `headline' and CDR is a plist
  | containing `:raw-value', `:title', `:alt-title', `:begin',
  | `:end', `:pre-blank', `:hiddenp', `:contents-begin' and
  | `:contents-end', `:level', `:priority', `:tags',
  | `:todo-keyword',`:todo-type', `:scheduled', `:deadline',
  | `:closed', `:quotedp', `:archivedp', `:commentedp' and
  | `:footnote-section-p' keywords.
  |
  | The plist also contains any property set in the property drawer,
  | with its name in upper cases and colons added at the
  | beginning (i.e. `:CUSTOM_ID').
  |
[...]


 -(let* ((list (nth 1 heading))  (notify (or (get :notify) default))
 +(let* ((list (nth 1 heading))  (notify (or (get :NOTIFY) default))

 I feel dull: please let me know why this is needed.

No problem. Here another pointer:
http://article.gmane.org/gmane.emacs.orgmode/73637

-- 
   Peter




Re: [O] [PATCH 1/2] org-notify: Don't use obsolete flet and macrolet

2013-06-20 Thread Peter Münster
On Thu, Jun 20 2013, Carsten Dominik wrote:

 The easiest solution is to simply do nothing, until Org drops support
 for Emacs 24.2 and earlier. The 'cl' library will be shipped with Emacs
 for a long time.
 
 BTW, which Emacs versions does Org support? Is this documented anywhere?

 No, but loosely, we have tried to support the current major version (i.e. 24) 
 and
 the previous major version (i.e. 23)

All right. Please apply this patch only later, when emacs 25 is out.

-- 
   Peter




[O] org-element: property now always uppercase?

2013-06-18 Thread Peter Münster
Hi,

After updating org-mode from git, I noticed, that
org-element-parse-buffer uppercases the properties now. Is this a
feature or a bug?

Example:

* TODO test
  DEADLINE: 2013-06-18 Tue 12:00
  :PROPERTIES:
  :notify:   test
  :END:

Result of (org-element-parse-buffer 'headline):

(headline (:raw-value test  :NOTIFY test ... ))

-- 
   Peter




[O] [PATCH 1/2] org-notify: Don't use obsolete flet and macrolet

2013-06-18 Thread Peter Münster
* contrib/lisp/org-notify.el (org-notify-make-todo)
(org-notify-process, org-notify-on-action-button)
(org-notify-action-email, org-notify-action-window): Replace `flet'
and `macrolet' by `cl-flet' and `cl-macrolet'.
---
 contrib/lisp/org-notify.el | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/contrib/lisp/org-notify.el b/contrib/lisp/org-notify.el
index 4047448..3019852 100644
--- a/contrib/lisp/org-notify.el
+++ b/contrib/lisp/org-notify.el
@@ -118,7 +118,7 @@ simple timestamp string.
 
 (defun org-notify-make-todo (heading rest ignored)
   Create one todo item.
-  (macrolet ((get (k) `(plist-get list ,k))
+  (cl-macrolet ((get (k) `(plist-get list ,k))
  (pr (k v) `(setq result (plist-put result ,k ,v
 (let* ((list (nth 1 heading))  (notify (or (get :notify) default))
(deadline (org-notify-convert-deadline (get :deadline)))
@@ -157,7 +157,7 @@ PERIOD.
 (defun org-notify-process ()
   Process the todo-list, and possibly notify user about upcoming or
 forgotten tasks.
-  (macrolet ((prm (k) `(plist-get prms ,k))  (td (k) `(plist-get todo ,k)))
+  (cl-macrolet ((prm (k) `(plist-get prms ,k))  (td (k) `(plist-get todo ,k)))
 (dolist (todo (org-notify-todo-list))
   (let* ((deadline (td :deadline))  (heading (td :heading))
  (uid (td :uid))(last-run-sym
@@ -268,7 +268,7 @@ seconds.  The default value for SECS is 20.
 
 (defun org-notify-on-action-button (button)
   User wants to see action after button activation.
-  (macrolet ((get (k) `(button-get button ,k)))
+  (cl-macrolet ((get (k) `(button-get button ,k)))
 (org-notify-on-action (get 'plist) (get 'key))
 (org-notify-delete-window (get 'buffer))
 (cancel-timer (get 'timer
@@ -311,7 +311,7 @@ seconds.  The default value for SECS is 20.
   (compose-mail user-mail-address (concat TODO:  (plist-get plist :heading)))
   (insert (org-notify-body-text plist))
   (funcall send-mail-function)
-  (flet ((yes-or-no-p (prompt) t))
+  (cl-flet ((yes-or-no-p (prompt) t))
 (kill-buffer)))
 
 (defun org-notify-select-highest-window ()
@@ -334,7 +334,7 @@ org-notify window.  Mostly copied from 
`appt-select-lowest-window'.
 (defun org-notify-action-window (plist)
   Pop up a window, mostly copied from `appt-disp-window'.
   (save-excursion
-(macrolet ((get (k) `(plist-get plist ,k)))
+(cl-macrolet ((get (k) `(plist-get plist ,k)))
   (let ((this-window (selected-window))
 (buf (get-buffer-create
   (format org-notify-window-buffer-name (get :uid)
-- 
1.8.1.4




[O] [PATCH 2/2] org-notify: Fix compatibility with latest org-element (uppercase properties)

2013-06-18 Thread Peter Münster
* contrib/lisp/org-notify.el (org-notify-make-todo): Properties from
org-element are all uppercase now.
---
 contrib/lisp/org-notify.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/lisp/org-notify.el b/contrib/lisp/org-notify.el
index 3019852..dd4100d 100644
--- a/contrib/lisp/org-notify.el
+++ b/contrib/lisp/org-notify.el
@@ -120,7 +120,7 @@ simple timestamp string.
   Create one todo item.
   (cl-macrolet ((get (k) `(plist-get list ,k))
  (pr (k v) `(setq result (plist-put result ,k ,v
-(let* ((list (nth 1 heading))  (notify (or (get :notify) default))
+(let* ((list (nth 1 heading))  (notify (or (get :NOTIFY) default))
(deadline (org-notify-convert-deadline (get :deadline)))
   (heading (get :raw-value))
result)
-- 
1.8.1.4




Re: [O] [PATCH 1/2] org-notify: Don't use obsolete flet and macrolet

2013-06-18 Thread Peter Münster
On Tue, Jun 18 2013, David Engster wrote:

 Peter Münster writes:
 * contrib/lisp/org-notify.el (org-notify-make-todo)
 (org-notify-process, org-notify-on-action-button)
 (org-notify-action-email, org-notify-action-window): Replace `flet'
 and `macrolet' by `cl-flet' and `cl-macrolet'.

 cl-lib was just introduced in Emacs 24.3.

Does that mean, that the trunk should be modified later?

I've submitted the patch only because of this message:
http://article.gmane.org/gmane.emacs.orgmode/71560

-- 
   Peter




Re: [O] problem with org-element-parse-buffer

2012-11-24 Thread Peter Münster
On Mon, Nov 12 2012, Nicolas Goaziou wrote:

 * TODO test
   bla bla bla
   DEADLINE: 2012-11-08 Thu 12:17

 In Org, planning info (scheduled, deadline, and closed) must be put just
 after the headline. Your example isn't valid.

Then, org-agenda should ignore that too, shouldn't it?

-- 
   Peter




Re: [O] problem with org-element-parse-buffer

2012-11-24 Thread Peter Münster
On Sat, Nov 24 2012, Nicolas Goaziou wrote:

 Do you want to help basing Agenda on Elements?

No, sorry. I don't use the agenda, I prefer push to poll. That's why I
wrote org-notify.el.

Anyway, the syntax highlighting is a bit permissive too...

-- 
   Peter




[O] problem with org-element-parse-buffer

2012-11-12 Thread Peter Münster
Hi,

When using

 (print (org-element-parse-buffer 'headline))

on this test file:

* TODO test
  bla bla bla
  DEADLINE: 2012-11-08 Thu 12:17

the output has no information about the deadline with latest
git-version.

How could I solve this problem please?

TIA for any hints,
-- 
   Peter




[O] [PATCH] Make org-notify.el work with latest org-element.el

2012-11-06 Thread Peter Münster
* contrib/lisp/org-notify.el (org-notify-convert-deadline): New function.
(org-notify-make-todo): Use that function.
---
 contrib/lisp/org-notify.el |   11 ++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/contrib/lisp/org-notify.el b/contrib/lisp/org-notify.el
index c4ff8ae..a4002c4 100644
--- a/contrib/lisp/org-notify.el
+++ b/contrib/lisp/org-notify.el
@@ -106,12 +106,21 @@
  (cdr (assoc (match-string 3 str) conv))
  (if (= (length (match-string 1 str)) 1) -1 1)
 
+(defun org-notify-convert-deadline (orig)
+  Convert original deadline from `org-element-parse-buffer' to
+simple timestamp string.
+  (if orig
+  (replace-regexp-in-string ^\\|$ 
+   (plist-get (plist-get orig 'timestamp)
+  :raw-value
+
 (defun org-notify-make-todo (heading rest ignored)
   Create one todo item.
   (macrolet ((get (k) `(plist-get list ,k))
  (pr (k v) `(setq result (plist-put result ,k ,v
 (let* ((list (nth 1 heading))  (notify (or (get :notify) default))
-   (deadline (get :deadline))  (heading (get :raw-value))
+   (deadline (org-notify-convert-deadline (get :deadline)))
+  (heading (get :raw-value))
result)
   (when (and (eq (get :todo-type) 'todo) heading deadline)
 (pr :heading heading) (pr :notify (intern notify))
-- 
1.7.3.4


-- 
   Peter




Re: [O] Notifications of appointments in Agenda screen?

2012-08-30 Thread Peter Münster
On Thu, Aug 30 2012, Nathan Neff wrote:

 I'm looking all over, and all I can find are posts about how to set
 up org-notify to call some external messaging app.  I'm on OSX and
 don't want to purchase Growl.

Hi,

With org-notify.el you don't need an external messaging app, you can do
all in emacs.


 I found org-notify.el,
 (https://github.com/p-m/org-notify/blob/master/org-notify.el)
 but it seems to require a notify property on any headline that you
 want to be notified of.

It's also optional. When the notify property is missing, a default
value will be used.


 I would like org-mode to automatically notify me (on the status
 bar, etc) for
 any headline that has a time associated with it.

Today, org-notify.el requires a DEADLINE-timestamp, but this can
easily be changed in the code.


 I also don't want to rely on an external program because I use org-mode
 on different systems.

See above. There are predefined functions for displaying a message in
the minibuffer or in a new emacs window, and you can define other
functions, that do whatever you want (something with the modeline for
example).

-- 
   Peter




Re: [O] org-notify Tutorial

2012-08-25 Thread Peter Münster
On Tue, Aug 07 2012, SW wrote:

 Is a tutorial/guide available for org-notify? Neither of the following were 
 very
 helpful:

 http://orgmode.org/worg/org-api/org-notify-api.html

 http://thread.gmane.org/gmane.emacs.orgmode/52634/focus=52693



On Sat, Aug 25 2012, maroony wrote:

 Thanks for your answers! The new notify package sounds very interesting, but 
 it 
 would be great to see some more documentation for it.

Hi,

I'm glad, that other people like this package!
Unfortunately I don't have enough time to write more documentation.
(so much *TODO* ... ;)

Nevertheless, I send you my own setup as an example:

--8---cut here---start-8---
(require 'org-notify)
(org-notify-add 'default '(:time 100m :actions -notify/window
   :period 2m :duration 60))
(org-notify-add 'urgent-second '(:time 3m :actions (-notify/window -ding)
 :period 15s :duration 10))
(org-notify-add 'minute '(:time 5m :actions -notify/window
  :period 100s :duration 70))
(org-notify-add '12hours
'(:time 3m :actions (-notify/window -ding)
:period 15s :duration 10)
'(:time 100m :actions -notify/window
:period 2m :duration 60)
'(:time 12h :actions -notify/window :audible nil
:period 10m :duration 200))
(org-notify-add '5days
'(:time 100m :actions -notify/window
:period 2m :duration 60)
'(:time 2d :actions -notify/window
:period 15m :duration 100)
'(:time 5d :actions -notify/window
:period 2h :duration 200))
(org-notify-add 'long-20days
'(:time 2d :actions -notify/window
:period 15m :duration 60)
'(:time 5d :actions -notify/window
:period 2h :duration 60)
'(:time 20d :actions -email :period 2d :audible nil))
(org-notify-add 'long-50days
'(:time 4d :actions -notify/window
:period 30m :duration 100)
'(:time 10d :actions -notify/window
:period 4h :duration 200)
'(:time 50d :actions -email :period 3d :audible nil))
(org-notify-add 'long-100days
'(:time 2d :actions -notify/window
:period 1h :duration 200)
'(:time 10d :actions -notify/window
:period 10h :duration 300)
'(:time 50d :actions -email :period 3d :audible nil)
'(:time 100d :actions -email :period 5d :audible nil)))
(org-notify-start 10)
--8---cut here---end---8---


 At the moment I don't know how to set a notify property on an todo-item. A 
 small 
 example would be very helpful.

Example:

--8---cut here---start-8---
* TODO Terrasse bauen
  DEADLINE: 2013-04-20 Sat 10:38
  :PROPERTIES:
  :notify:   long-100days
  :END:
--8---cut here---end---8---


Contributions (code/documentation) are welcome of course!

-- 
   Peter




Re: [O] Using Org for a dissertation

2012-05-12 Thread Peter Münster
On Sat, May 12 2012, Richard Lawrence wrote:

 I am a graduate student in philosophy, and I am about to begin writing
 my dissertation.  I am wondering about whether I should write it in Org,
 or stick to plain LaTeX.

Or in ConTeXt...

Sorry, I can't answer your questions about Org-mode. I just know, that
ConTeXt is a much better tool for writing dissertations than LaTeX is.

-- 
   Peter




Re: [O] Ever used org-mode contrib packages?

2012-04-26 Thread Peter Münster
On Wed, Apr 11 2012, François Allisson wrote:

 I'm curious to know what you are using from org-contrib...

- org-notify

-- 
   Peter




[O] if featurep then require, why?

2012-04-02 Thread Peter Münster
Hi,

In `org-show-notification', there is

--8---cut here---start-8---
  (cond
[...]
((featurep 'notifications)
 (require 'notifications)
[...]
--8---cut here---end---8---

Why is the (require 'notifications) needed?

-- 
   Peter




Re: [O] [RFC] warn time for appointments

2012-03-27 Thread Peter Münster
On Fri, Mar 23 2012, Nick Dokos wrote:

 But previously, things were bad enough that I had to turn off the notify
 process. Now, I'm leaving it on and (mostly) not noticing that
 it's there, so that's definitely progress.

There is still one thing, that we can do: call org-notify-process
periodically, but only when the user is idle for at least some seconds.
This logic exists already in gnus-demon-add-handler but the gnus-demon
runs only when gnus is running. So, what we can do is:
- patch gnus-demon.el to allow running the daemon independently of gnus
- copy parts of gnus-demon.el
- perhaps something else...

Some day I'll take a look.

-- 
   Peter




Re: [O] [RFC] warn time for appointments

2012-03-23 Thread Peter Münster
On Fri, Mar 23 2012, Ivan Kanis wrote:

 I got no reply to my RFC and to my tentative patches. Does that mean
 everybody is happy with the default 12 minutes warning time?

No, I'm not happy with 12 minutes. But there is
https://github.com/p-m/org-notify where you can have arbitrary warning
times (seconds, weeks, whatever...).
Does it fit your needs?

(I'll ask Bastien for inclusion in contrib...)

-- 
   Peter




Re: [O] optimisation of org-notify

2012-03-04 Thread Peter Münster
On Sun, Feb 26 2012, Peter Münster wrote:

 On Sun, Feb 26 2012, Nick Dokos wrote:

 So orgntf-todo-list takes the lion's share of the time but
 most of it is the 15 calls to org-element-parse-buffer

 Ok, then I could process only one file at a time. This would divide the
 processing time by 15, in your case. But perhaps others would have the
 7000 lines in one file only, then it would not work...
 So, is it worth the effort?

The effort was quite small, so I've done it. :)

-- 
   Peter




[O] optimisation of org-notify (was: notifications for todo items)

2012-02-26 Thread Peter Münster
On Sun, Feb 26 2012, Nick Dokos wrote:

 So orgntf-todo-list takes the lion's share of the time but
 most of it is the 15 calls to org-element-parse-buffer

Ok, then I could process only one file at a time. This would divide the
processing time by 15, in your case. But perhaps others would have the
7000 lines in one file only, then it would not work...
So, it is worth the effort?

Thanks for the profiling!
-- 
   Peter




Re: [O] notifications for todo items

2012-02-26 Thread Peter Münster
On Sun, Feb 26 2012, Nicolas Goaziou wrote:

 I didn't look at the code but you probably mean
 (org-element-parse-buffer 'headline) if you're only interested in
 headline data.

Yes, it's headline in the code... :)

-- 
   Peter




Re: [O] notifications for todo items

2012-02-25 Thread Peter Münster
On Sat, Feb 25 2012, Nick Dokos wrote:

 A quick first impression: orgntf-process seems expensive. It seems
 to take 100% of one core (I've got a quad-core processor) for three or
 four seconds every fifty seconds. Unfortunately, the core is the same one
 that's running emacs, so emacs stops responding for those three or four
 seconds. I have disabled org-notify for now.

How many lines do you have in your org-files?
(I've about 200 and execution time is about 100ms.)

I call now (org-element-parse-buffer 'heading), I hope it's faster for
you. Is it faster, when the file is byte-compiled?

Other ideas:
- I could divide orgntf-process into several tasks, so that things run
  more smoothly.
- You could call (org-notify-start -60), so the process will be called,
  when idle for one minute.

The file has a new home: https://github.com/p-m/org-notify
There is now `orgntf-verbose' to see execution time of
`orgntf-todo-list'.

Thanks for testing!
-- 
   Peter




Re: [O] notifications for todo items

2012-02-23 Thread Peter Münster
On Thu, Feb 23 2012, Nick Dokos wrote:

 what does this do that appt.el (and its org interface) does not?

Sorry, I've totally forgotten to write about my motivation, to create
such an org-notify module.

Here a summary:
- different warning periods for different todo-types
- fine grained warning periods (smallest unit is second)
- continue notifications, when deadline is overdue
- easy modification of timestamps (just one click, to say
  let's do it tomorrow)
- switch from todo to done by clicking on the notification window
- configurable notification types (email, notifications-notify, beep,
  etc.)
- configurable notification period
- configurable notification duration
- crescendo notifications (be more aggressive, when time gets closer to
  deadline)

There was a little thread about this subject:
http://thread.gmane.org/gmane.emacs.orgmode/48832


Example usage:
  (org-notify-add 'appt
  '(:time -1s :period 20s :duration 10
:actions (org-notify-action-message
  org-notify-action-ding))
  '(:time 15m :period 2m :duration 100
:actions org-notify-action-notify)
  '(:time 2h :period 5m
:actions org-notify-action-message)
  '(:time 1d :actions org-notify-action-email))

This means for todo-items with `notify' property set to `appt': 1 day before
deadline, send a reminder-email, 2 hours before deadline, start to send
messages every 5 minutes, then, 15 minutes before deadline, start to pop up
notification windows every 2 minutes. The timeout of the window is set to
100 seconds. Finally, when deadline is overdue, send messages and make
noise.

-- 
   Peter




Re: [O] patch for warning time (first baby sted)

2012-02-22 Thread Peter Münster
On Sun, Feb 19 2012, Ivan Kanis wrote:

 This patch implements warn time for org appt. It only works on emacs bzr
 (the variable appt-warning-time-regexp appears in it). You need to add
 the warntime in the text of the entry, like so :

 * doctor warntime 10
   2012-02-19 10:00

If you change it to

* TODO doctor
  DEADLINE: 2012-02-19 10:00

you can also use the org-notify module:
http://pmrb.free.fr/work/OS/org-notify.el

-- 
   Peter




[O] notifications for todo items

2012-02-22 Thread Peter Münster
Hi,

I've written a module, that allows flexible notifications for todo items
with deadline: http://pmrb.free.fr/work/OS/org-notify.el

Feedback is welcome!

-- 
   Peter




[O] get all todo items as lisp list

2012-02-18 Thread Peter Münster
Hi,

Given a todo list in an org file, is there already a function, that
converts this list to an elisp list, that contains at least heading,
deadline and properties?

Example input:
--8---cut here---start-8---
* TODO todo-test
  DEADLINE: 2012-04-19 Thu 13:33
   :PROPERTIES:
   :notify:   notify-test
   :END:
* TODO todo-test2
  DEADLINE: 2012-05-20 Sun 16:66
   :PROPERTIES:
   :notify:   notify-test2
   :END:
--8---cut here---end---8---

Example output:
--8---cut here---start-8---
((file test.org heading TODO todo-test deadline (111 222 333)
   properties (notify notify-test))
 (file test.org heading TODO todo-test2 deadline (123 456 789)
   properties (notify notify-test2)))
--8---cut here---end---8---

Or are there functions, that could help me, to do it myself?
(I've tried with `org-agenda-get-day-entries', but without success...)

TIA for any help!
-- 
   Peter




[O] [PATCH] Avoid some warnings about `assignment to free variable'

2012-02-18 Thread Peter Münster

* lisp/org.el, lisp/org-pcomplete.el: Add some `defvars' to avoid
  warnings about `assignment to free variable'.

TINYCHANGE
---
 lisp/org-pcomplete.el |5 +
 lisp/org.el   |2 ++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/lisp/org-pcomplete.el b/lisp/org-pcomplete.el
index c475bcc..7a4dc0d 100644
--- a/lisp/org-pcomplete.el
+++ b/lisp/org-pcomplete.el
@@ -50,6 +50,9 @@
   :tag Org
   :group 'org)
 
+(defvar org-drawer-regexp)
+(defvar org-property-re)
+
 (defun org-thing-at-point ()
   Examine the thing at point and let the caller know what it is.
 The return value is a string naming the thing at point.
@@ -247,6 +250,8 @@ This needs more work, to handle headings with lots of 
spaces in them.
 lst))
(substring pcomplete-stub 1)))
 
+(defvar org-drawers)
+
 (defun pcomplete/org-mode/drawer ()
   Complete a drawer name.
   (let ((spc (save-excursion
diff --git a/lisp/org.el b/lisp/org.el
index a81f7fc..45d4b6a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12778,6 +12778,7 @@ ACTION can be `set', `up', `down', or a character.
 
  Tags
 
+(defvar tags-list)
 (defvar org-agenda-archives-mode)
 (defvar org-map-continue-from nil
   Position from where mapping should continue.
@@ -14957,6 +14958,7 @@ So these are more for recording a certain time/date.
 (defvar org-ans2) ; dynamically scoped parameter
 
 (defvar org-plain-time-of-day-regexp) ; defined below
+(defvar org-read-date-inactive)
 
 (defvar org-overriding-default-time nil) ; dynamically scoped
 (defvar org-read-date-overlay nil)
-- 
1.7.3.4




Re: [O] [PATCH] Avoid lisp error with (org-deadline nil +1d)

2012-02-18 Thread Peter Münster
On Thu, Nov 24 2011, Nick Dokos wrote:

 Are they free variable warnings? If so, you now know how to fix them:
 go wild :-)

All right, done so... ;)

-- 
   Peter




Re: [O] [PATCH] Avoid lisp error with (org-deadline nil +1d)

2011-11-23 Thread Peter Münster
On Wed, Nov 23 2011, Carsten Dominik wrote:

 Fixed, thanks, please verify.

Verified: ok, thanks.

Is `(defvar parse-time-weekdays)' still needed then? And if yes, why?

-- 
   Peter




Re: [O] [PATCH] Avoid lisp error with (org-deadline nil +1d)

2011-11-23 Thread Peter Münster
On Wed, Nov 23 2011, Nick Dokos wrote:

 Generally speaking, defvars like this tell the compiler to shut up about
 the free variable. You can see if it is needed, by commenting out the
 defvar and then trying to compile the file.

Indeed, now there are 30 warnings instead of only 29 ... ;)
Thanks for the explanation!

-- 
   Peter




Re: [O] How to say I did that yesterday?

2011-11-22 Thread Peter Münster
On Tue, Nov 22 2011, Dave Abrahams wrote:

 I often discover that I completed something a few days ago and I would
 like to mark it done with the appropriate date as though I had marked it
 done in the past.  That means, e.g., for a repeating event it might
 repeat sooner than if it had been done today.  Is there a way?

Not exactly what you want, but it might help. Some code for easy
modifying time stamps with C-left, C-right, M-left and M-right:

--8---cut here---start-8---
(defvar pm/org-ctrlleft-hook nil
  Hook for functions attaching themselves to `C-left'.)

(defvar pm/org-ctrlright-hook nil
  Hook for functions attaching themselves to `C-right'.)

(defun pm/org-meta-left ()
  Decrease the date in the time stamp by one hour.
  (when (org-at-timestamp-p) (org-timestamp-change -60 'minute) t))

(defun pm/org-meta-right ()
  Increase the date in the time stamp by one hour.
  (when (org-at-timestamp-p) (org-timestamp-change 60 'minute) t))

(defun pm/org-ctrl-left ()
  Decrease the date in the time stamp by one day.
  (when (org-at-timestamp-p) (org-timestamp-down-day) t))

(defun pm/org-ctrl-right ()
  Increase the date in the time stamp by one day.
  (when (org-at-timestamp-p) (org-timestamp-up-day) t))

(defun pm/org-ctrlleft ()
  Run the functions in `pm/org-ctrlleft-hook'.
  (interactive)
  (run-hook-with-args-until-success 'pm/org-ctrlleft-hook))

(defun pm/org-ctrlright ()
  Run the functions in `pm/org-ctrlright-hook'.
  (interactive)
  (run-hook-with-args-until-success 'pm/org-ctrlright-hook))

(add-hook 'org-metaleft-hook 'pm/org-meta-left)
(add-hook 'org-metaright-hook'pm/org-meta-right)
(add-hook 'pm/org-ctrlleft-hook  'pm/org-ctrl-left)
(add-hook 'pm/org-ctrlright-hook 'pm/org-ctrl-right)

(org-defkey org-mode-map [(control left)]  'pm/org-ctrlleft)
(org-defkey org-mode-map [(control right)] 'pm/org-ctrlright)
--8---cut here---end---8---

-- 
   Peter




Re: [O] [PATCH] Avoid lisp error with (org-deadline nil +1d)

2011-11-22 Thread Peter Münster
On Tue, Nov 22 2011, Carsten Dominik wrote:

 This is not allowed, we cannot define a variable defined in another package.

Oh, pardon.


 Can you send a backtrace of the error, please?

Of course (from emacs -Q):

--8---cut here---start-8---
Debugger entered--Lisp error: (void-variable parse-time-weekdays)
  org-read-date-get-relative(+1d (20172 36366 853978) (20170 55280))
  org-read-date-analyze(+1d (20170 55280) (0 0 0 22 11 2011 2 nil 3600))
  byte-code(\306\203J.   \203.  ;\203J.\307\310 
\\203J.\212\311\312!\210\212\313 
\210`).\314\315=\203-.\202..\f\n\312#\203I.\316\317!.\320\321\322.!\.3.\205G.\323.!.4)\203y.
  ;\203i.\307\310 \\203i.\320\321\324.3\325.3!#\\202x.  
\206x.\326\327\330\327\211.3.4..5\203\244.\331\235\203\244.\315=\203\217.6\202\221.7\332\261.\210\333
 
.8\327\211\211.9C.\210\327.\212\214\327\211\211\211\211.:.;..=\311\312!\210\334.\335P!\210\317\225b\210i.=\336\225b\210m\203\324.\337c\210\202\327.\317u\210\204\351.\334\340.?P!\204\351.\341\342\327\\210\334.!\204\f.\334\343.@\344Q!\203\f.\316\317!.A\232\204\f.\336\224\336\225}\210\202!.\345\337!\210\346u\210``}\210.B\203!.\347.=!\210.CB..\203s.\211A.@\211.;\315=\203C.\314\327\312#\204b.;\350=\203R.\314\f\327\312#\204b.;\351=\203'.\314.D\327\312#\203'.\352\353!\210\334\354!\203'.\352\353!\210\202'.\334\355!\203}.\352\353!\210.B\203\213.n\203\213.\347.=!\210\203\375.n\204\237.`Sf\356=\204\237.\332\202\240.\353\315=\203\253.6\202\276.\350=\203\266.7\202\276.\351=\205\276.E\332\261.\210\333
 
.8\206\321.\351=\205\321.F\351=\327\211.9C.n\204\367.`Sf\356=\204\367.\327f\357\204\367.m\204\367.\332\202\370.\353c\210\317\210eb\210~\210\334\360!\203.`Sf\361\232\203.`S\362
 |\210..\207 [what time end org-scheduled-time-regexp 
org-deadline-time-regexp ts (scheduled deadline) string-match ^[-+]+[0-9] 
org-back-to-heading t outline-next-heading re-search-forward scheduled 
match-string 1 apply encode-time org-parse-time-string org-get-compact-tod 
org-read-date-analyze decode-time org-read-date nil to-time (scheduled 
deadline)   org-insert-time-stamp looking-at \\( *\\)[^.\n]* 0 \n [  
   ]* throw exit [^.\n]*? [^.\n]* insert-before-markers -1 
org-indent-to-column deadline closed replace-match  --+[^]+ ^[ ]+ 
32 (32 10) [   ]*\n 10 ...] 8)
  org-add-planning-info(deadline +1d closed)
  org-deadline(nil +1d)
  eval((org-deadline nil +1d) nil)
  eval-expression((org-deadline nil +1d) nil)
  call-interactively(eval-expression nil nil)
--8---cut here---end---8---

-- 
   Peter




[O] [PATCH] Timestamps: Fix org-schedule and org-deadline with absolute time arguments

2011-11-21 Thread Peter Münster
* lisp/org.el (org-add-planning-info): Treat absolute time too.

TINYCHANGE
---
 lisp/org.el |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index fffb0c1..3342b87 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12078,9 +12078,8 @@ be removed.
  default-input (and ts (org-get-compact-tod ts))
   (when what
(setq time
- (if (and (stringp time)
-  (string-match ^[-+]+[0-9] time))
- ;; This is a relative time, set the proper date
+ (if (stringp time)
+ ;; This is a string (relative or absolute), set proper date
  (apply 'encode-time
 (org-read-date-analyze
  time default-time (decode-time default-time)))
@@ -14807,7 +14806,7 @@ The prompt will suggest to enter an ISO date, but you 
can also enter anything
 which will at least partially be understood by `parse-time-string'.
 Unrecognized parts of the date will default to the current day, month, year,
 hour and minute.  If this command is called to replace a timestamp at point,
-of to enter the second timestamp of a range, the default time is taken
+or to enter the second timestamp of a range, the default time is taken
 from the existing stamp.  Furthermore, the command prefers the future,
 so if you are giving a date where the year is not given, and the day-month
 combination is already past in the current year, it will assume you
-- 
1.7.3.4





[O] [PATCH] Avoid lisp error with (org-deadline nil +1d)

2011-11-21 Thread Peter Münster
* lisp/org.el (parse-time-weekdays): Must not be void.

TINYCHANGE
---
 lisp/org.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 253703b..41d418a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15229,7 +15229,7 @@ user.
 (setq org-read-date-analyze-futurep futurep)
 (list second minute hour day month year)))
 
-(defvar parse-time-weekdays)
+(defvar parse-time-weekdays nil)
 
 (defun org-read-date-get-relative (s today default)
   Check string S for special relative date string.
-- 
1.7.3.4





Re: [O] enhancements for org-agenda-to-appt

2011-11-12 Thread Peter Münster
On Tue, Nov 08 2011, Daniel Clemente wrote:

  1.) Warning period should be taken from timestamp
  That means, that the warntime must be passed to appt-add.
 
  2.) Warning period in hours and minutes
  -3h for 3 hours or -10M for 10 minutes should be possible.

   Do you really need to extend the org-mode timestamp format?

No, but the concept already exists, so why not using it?
Adding something for minutes and hours should be easy, I hope.


   There may be other ways to do that without extending the org-mode timestamp 
 format.

Yes, properties come to my mind.


   Like deciding acording to priority, for instance.: [#A] are to be notified 1
 hour before, [#B] 30 minutes before and [#C] 10 minutes

Quite limited. Others would need then #D, #E, ... #Z too ;)


  4.) Easy modification of timestamps
  Often I get notified, that a task has to be done now, but the most
  obvious and easiest solution for me is: just do it tomorrow!
  Thus, when point is on a deadline line, M-right should advance the
  time by 1d, C-right by 1h, or similar.
  Decrementing with M-left and C-left should be possible too, but will
  surely be used less often... ;)

   I think you can already do that with „bulk scheduling“ from the agenda. 
 Key: m m m B s

Yes, but it's not as easy as M-right.


   How often would you need to synchronize org and appt in order to be so 
 precise?

Today, I do it once per 5 minutes, but once per minute would be ok too.


 Should it be automatic?

Yes, of course.


  7.) Switch from todo to done by clicking on the notification window
  When using `notifications-notify' this should be possible with the
  `:on-action' parameter.
 
   I would prefer the window to open an emacsclient window pointing to the task
 in order to close it myself and write a conclusion, all inside Emacs.

Why emacsclient?


  8.) Configurable notification types
  For example:
  - email
  - notifications-notify
  - emacs-window (like the default in appt.el)
  - custom function
 
   Suggestion: a variable which maps some_tags_combination → action
   Then you „configure“ your tasks with tags, and then decide on how to notify 
 each type of task.

Why not, but personally I would prefer a property for this.


  9.) Configurable notification period
  How often the notification function must be called (once per day,
  once per minute, etc...)
 
Or even: each time that a task is scheduled or a timestamp is changed in
 org. Maybe this slows things down, but it would almoust guarantee real-time
 synchronization between org and appt

It's not about synchronization, it's about how often I want to be
notified. Imagine the notification is a bell, then I want to specify,
how often the bell will ring.


 10.) Configurable notification duration
  This applies only for emacs-window and notifications-notify: how
  long must the notification be visible.
 
And ask for acknowledgment!
It's also interesting to foresee what will happen when an unacknowledged
 notification waits for too long and another one comes up.

IMO, it would be sufficient, to switch from TODO to DONE or to STARTED.
No need for an extra acknowledgment.


Best of luck,

Thanks!

-- 
   Peter




[O] enhancements for org-agenda-to-appt

2011-11-03 Thread Peter Münster
Hello,

Before enhancing org-agenda-to-appt (and some other parts) to fit my
needs, I would like to get some feedback for my ideas:
- General opinions about the ideas.
- Hints about already existing usable code.
- Hints how to implement the ideas with the least effort.

The general idea is, to get notified when a task has to be done, without
any need to open the agenda. Default settings for the notifications can
be overwritten for each task (by settings in the timestamp and/or
additional properties).

Here the details, in the order of priority:

 1.) Warning period should be taken from timestamp
 That means, that the warntime must be passed to appt-add.

 2.) Warning period in hours and minutes
 -3h for 3 hours or -10M for 10 minutes should be possible.

 3.) Notification must continue when timestamp is past
 Perhaps, the notification should be even more aggressive, when a task
 is overdue.

 4.) Easy modification of timestamps
 Often I get notified, that a task has to be done now, but the most
 obvious and easiest solution for me is: just do it tomorrow!
 Thus, when point is on a deadline line, M-right should advance the
 time by 1d, C-right by 1h, or similar.
 Decrementing with M-left and C-left should be possible too, but will
 surely be used less often... ;)

 5.) org-check-deadlines must consider hours and minutes
 It should be possible, to show only overdue deadlines, even if they
 are overdue since 5 minutes.

 6.) Timestamps with hours and minutes
 When adding deadlines or schedules, there should be also the time,
 not only the date.

 7.) Switch from todo to done by clicking on the notification window
 When using `notifications-notify' this should be possible with the
 `:on-action' parameter.

 8.) Configurable notification types
 For example:
 - email
 - notifications-notify
 - emacs-window (like the default in appt.el)
 - custom function

 9.) Configurable notification period
 How often the notification function must be called (once per day,
 once per minute, etc...)

10.) Configurable notification duration
 This applies only for emacs-window and notifications-notify: how
 long must the notification be visible.

11.) Crescendo notifications
 Imagine, deadline is in 10 days. So a silent notification once or
 twice per day, saying it's time to begin to work, could be nice.
 But when time is getting shorter, only one hour left, bells will
 ring and the whole screen will blink red and green...

TIA for any feedback!

-- 
   Peter




Re: [O] notify, when something to do

2011-11-01 Thread Peter Münster
On Sun, Oct 23 2011, Bastien wrote:

 - Perhaps the main problem: appt does not know about warning periods.
   There are items with -3d, other with -5M[1]. There is only one
   universal appt-message-warning-time. Would it be possible, to have a
   individual warning-time for each todo-item, directly computed from the
   warning time in the org-timestamp?

 Check what info is available as text properties in the agenda 
 (with `C-u C-x =') and see if you can use this information in 
 a filter function.

There is `type = upcoming-deadline', so it should be doable.

Thanks for the filter-function and the scope-keywords!

-- 
   Peter




[O] [PATCH] Agenda: Allow filter list without category in org-agenda-to-appt

2011-10-24 Thread Peter Münster
Hello,

Here the output of git format-patch master. I hope it's correct, it
was my first git-commit...

--8---cut here---start-8---
From 82da273bb0884347762e883786b334302ad3f0cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Peter=20M=C3=BCnster?= p...@free.fr
Date: Mon, 24 Oct 2011 20:52:45 +0200
Subject: [PATCH] Agenda: Allow filter list without category in 
org-agenda-to-appt

* lisp/org-agenda.el (org-agenda-to-appt): Make sure filter-items are
strings before calling `string-match'.

Now it's possible to use (org-agenda-to-appt t '((headline string))).

TINYCHANGE
---
 lisp/org-agenda.el |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 24ead18..0b4c07b 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -8489,10 +8489,12 @@ details and examples.
  (and (stringp filter) (string-match filter evt))
  (and (functionp filter) (funcall filter x))
  (and (listp filter)
-  (or (string-match
-   (cadr (assoc 'category filter)) cat)
-  (string-match
-   (cadr (assoc 'headline filter)) evt))
+  (let ((cat-filter (cadr (assoc 'category filter)))
+(evt-filter (cadr (assoc 'headline filter
+(or (and (stringp cat-filter)
+ (string-match cat-filter cat))
+(and (stringp evt-filter)
+ (string-match evt-filter evt
 ;; FIXME: Shall we remove text-properties for the appt text?
 ;; (setq evt (set-text-properties 0 (length evt) nil evt))
 (when (and ok tod)
-- 
1.7.3.4
--8---cut here---end---8---

-- 
   Peter




Re: [O] org-contacts or bbdb?

2011-10-23 Thread Peter Münster
Thank you all for your points of view!
So I'll try bbdb-3. (I've already started a bit.)


On Fri, Oct 21 2011, Eric Abrahamsen wrote:

 As Rasmus mentioned, if you use BBDB you should get version 3, it's
 significantly better than the previous version. There's a slow movement
 towards better import/export functions, which I think has been one of
 the major gripes about BBDB in the past (there are probably more I'm not
 aware of).

So perhaps Julien just wrote org-contacts, because bbdb-3 did not exist then?


On Fri, Oct 21 2011, Wes Hardaker wrote:

 go mess with the database easily.  EG, with BBDB if one area gets a new
 area code you can't go quickly search/replace for all records replacing
 111 with 222.  With org-contacts it's a simple search/replace edit.

But you can open the bbdb-file and do the replacement there, can't you?

Greetings,
-- 
   Peter




[O] notify, when something to do

2011-10-23 Thread Peter Münster
Hello,

I would like to be notified[1], when a todo item enters the warning
period, scheduled time, or deadline.

I can imagine writing a function, that executes every 5 minutes, that
scans all agenda files calling `org-get-[scheduled,deadline]-time', but
I hope, that there is already something, that I can use more easily.

TIA for any help,
Peter


Footnotes: 
[1]  For notifying, I'll use an external program, for example
notify-send, because the emacs window is not always visible.




Re: [O] notify, when something to do

2011-10-23 Thread Peter Münster
On Sun, Oct 23 2011, Tassilo Horn wrote:

 pmli...@free.fr (Peter Münster) writes:

 I would like to be notified[1], when a todo item enters the warning
 period, scheduled time, or deadline.

 I export my org entries as appt alarms, so that I get system
 notifications 15 minutes before meetings (every 1 minute until I
 discard them).  Here's the code:

Hello Tassilo,

First, I took a look at the lines

--8---cut here---start-8---
(org-agenda-to-appt t)
(appt-activate 1)
--8---cut here---end---8---

This is already a good starting point, just 3 remarks:
- I think, I'll need a filter for org-agenda-to-appt, because I only
  want TODO items. Should be no problem.
- How to distinguish between SCHEDULED and DEADLINE?  I'll
  investigate...
- Perhaps the main problem: appt does not know about warning periods.
  There are items with -3d, other with -5M[1]. There is only one
  universal appt-message-warning-time. Would it be possible, to have a
  individual warning-time for each todo-item, directly computed from the
  warning time in the org-timestamp?

In the meantime, I'll take a look at your th-appt-alarm.
Thanks for your code!

   Peter

Footnotes: 
[1]  That means warn 5 minutes before. I don't know, if org-mode
supports this. -2H for hours would be useful too.




[O] patch: accept lazy filter in org-agenda-to-appt

2011-10-23 Thread Peter Münster
Hello,

I use `org-agenda-to-appt' this way:
--8---cut here---start-8---
(org-agenda-to-appt t '((headline TODO)))
--8---cut here---end---8---

But this works only with the following patch:

--8---cut here---start-8---
=== modified file 'lisp/org/org-agenda.el'
--- lisp/org/org-agenda.el  2011-09-02 16:38:40 +
+++ lisp/org/org-agenda.el  2011-10-23 19:43:51 +
@@ -8415,10 +8415,12 @@
  (ok (or (null filter)
  (and (stringp filter) (string-match filter evt))
  (and (listp filter)
-  (or (string-match
-   (cadr (assoc 'category filter)) cat)
-  (string-match
-   (cadr (assoc 'headline filter)) evt))
+   (let ((cat-filter (cadr (assoc 'category filter)))
+ (evt-filter (cadr (assoc 'headline filter
+ (or (or (eq cat-filter nil)
+ (string-match cat-filter cat))
+ (or (eq evt-filter nil)
+ (string-match evt-filter evt
 ;; FIXME: Shall we remove text-properties for the appt text?
 ;; (setq evt (set-text-properties 0 (length evt) nil evt))
 (when (and ok tod)

--8---cut here---end---8---

-- 
   Peter




Re: [O] patch: accept lazy filter in org-agenda-to-appt

2011-10-23 Thread Peter Münster
Hello,

The following patch replaces the previous one:

--8---cut here---start-8---
=== modified file 'lisp/org/org-agenda.el'
--- lisp/org/org-agenda.el  2011-09-02 16:38:40 +
+++ lisp/org/org-agenda.el  2011-10-23 20:03:11 +
@@ -8415,10 +8415,12 @@
  (ok (or (null filter)
  (and (stringp filter) (string-match filter evt))
  (and (listp filter)
-  (or (string-match
-   (cadr (assoc 'category filter)) cat)
-  (string-match
-   (cadr (assoc 'headline filter)) evt))
+   (let ((cat-filter (cadr (assoc 'category filter)))
+ (evt-filter (cadr (assoc 'headline filter
+ (or (and (stringp cat-filter)
+  (string-match cat-filter cat))
+ (and (stringp evt-filter)
+  (string-match evt-filter evt
 ;; FIXME: Shall we remove text-properties for the appt text?
 ;; (setq evt (set-text-properties 0 (length evt) nil evt))
 (when (and ok tod)
--8---cut here---end---8---


Sorry for the noise...

-- 
   Peter




[O] org-contacts or bbdb?

2011-10-20 Thread Peter Münster
Hello,

I would like to manage my contacts, so that I can
- easily search them
- add new email addresses from gnus (summary buffer)
- complete email addresses in gnus (message buffer and prompts in
  mini-buffer)
- and perhaps more in the future

Could you guide me please, what to choose, org-contacts or bbdb?
I don't see the advantages of the one or of the other...
TIA for any hints!

I'm just beginning to learn org-mode, thanks for this nice software!

-- 
   Peter