From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Dietsche Subject: Re: org-mode and remind integration Date: Fri, 09 Jan 2009 15:39:29 +0100 Message-ID: <87d4ew5yse.fsf@rat.lan> References: <6ac505ad0812310353yedc8ac6x4e59dc377a6d009b@mail.gmail.com> <368A47AA-30D5-40B0-9ECD-57B0361B89AA@uva.nl> <6ac505ad0901090057x40d163edr1366a45fb08ed405@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LLIWu-0005W5-Bu for emacs-orgmode@gnu.org; Fri, 09 Jan 2009 09:40:08 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LLIWs-0005VX-Le for Emacs-orgmode@gnu.org; Fri, 09 Jan 2009 09:40:08 -0500 Received: from [199.232.76.173] (port=46591 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LLIWs-0005VQ-HB for Emacs-orgmode@gnu.org; Fri, 09 Jan 2009 09:40:06 -0500 Received: from www85.your-server.de ([213.133.104.85]:56568) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LLIWr-0003Lb-Mc for Emacs-orgmode@gnu.org; Fri, 09 Jan 2009 09:40:06 -0500 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Daniel Martins Cc: bastien.guerry@ens.fr, Emacs-orgmode@gnu.org --=-=-= "Daniel Martins" writes: > Yes, I am. [...] > I am sending the last version of org2rem which integrates timed reminds from > DEADLINE: and SCHEDULE: lines [...] > > 2009/1/9 Carsten Dominik > >> Is any action happening on this? Is someone trying to fix org2rem? >> - Carsten I have no idea of remind. This is an untested patch, but you get the idea. Avoid global variables, if you can. If you use global variables, you have prerequisites and side effects, which complicate following the code. This is not lisp specific. Regards, Olaf --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=org2rem.el.diff Content-Description: Eliminate unnecessary globals --- org2rem.el.orig 2009-01-09 12:47:39.000000000 +0100 +++ org2rem.el 2009-01-09 15:28:55.000000000 +0100 @@ -34,9 +34,6 @@ (eval-when-compile (require 'cl)) -(defvar org2rem-scheduled-reminders nil) -(defvar org2rem-deadline-reminders nil) -(defvar pure-time nil) (defvar org2rem-scheduled-remind-file "~/.reminders.org.scheduled") (defvar org2rem-deadline-remind-file @@ -45,6 +42,7 @@ (defun org2rem-list-reminders (regexp) "Make a list of appointments. REGEXP is either SCHEDULED: or DEADLINE:." + (let (reminders) (save-excursion (goto-char (point-min)) (while (re-search-forward @@ -66,17 +64,17 @@ (if (string-match "[0-9]+:[0-9]+" task) (save-excursion - (setq pure-time + (let ((pure-time (replace-regexp-in-string ;; "[^0-9]*\\([0-9]+:[0-9]+\\).*" "\\1" ".*\\([0-9][0-9]:[0-9][0-9]\\).*" "\\1" ;; ".*\\(\D\D:\D\D\\)+.*" "\\1" task) - ) + )) (setq rem-time (concat rem-time " AT " pure-time " ") - ) + )) ) ) @@ -95,9 +93,9 @@ (setq rem-task (concat "REM" rem-time "MSG " task "%") ) - (if (equal regexp org-scheduled-string) - (push rem-task org2rem-scheduled-reminders) - (push rem-task org2rem-deadline-reminders))))))) + (push rem-task reminders))))) + reminders)) + (defun org2rem-write-file (file reminders) "Write reminders list to files." @@ -114,15 +112,13 @@ Store scheduled appointments in `org2rem-scheduled-remind-file' and `org2rem-deadline-remind-file'." (interactive) - (setq org2rem-scheduled-reminders nil) - (setq org2rem-deadline-reminders nil) + (let ((org2rem-scheduled-reminders (org2rem-list-reminders org-scheduled-string)) + (org2rem-deadline-reminders (org2rem-list-reminders org-deadline-string))) (save-window-excursion - (org2rem-list-reminders org-scheduled-string) - (org2rem-list-reminders org-deadline-string) - (org2rem-write-file "~/.reminders.org.scheduled" + (org2rem-write-file org2rem-scheduled-remind-file org2rem-scheduled-reminders) - (org2rem-write-file "~/.reminders.org.deadline" - org2rem-deadline-reminders))) + (org2rem-write-file org2rem-deadline-remind-file + org2rem-deadline-reminders)))) --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=--