emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Olaf Dietsche <olaf+list.orgmode@olafdietsche.de>
To: Daniel Martins <danielemc@gmail.com>
Cc: bastien.guerry@ens.fr, Emacs-orgmode@gnu.org
Subject: Re: org-mode and remind integration
Date: Fri, 09 Jan 2009 15:39:29 +0100	[thread overview]
Message-ID: <87d4ew5yse.fsf@rat.lan> (raw)
In-Reply-To: 6ac505ad0901090057x40d163edr1366a45fb08ed405@mail.gmail.com

[-- Attachment #1: Type: text/plain, Size: 587 bytes --]

"Daniel Martins" <danielemc@gmail.com> 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 <dominik@science.uva.nl>
>
>> 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Eliminate unnecessary globals --]
[-- Type: text/x-diff, Size: 2316 bytes --]

--- 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))))
 
 
 \f

[-- Attachment #3: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

  reply	other threads:[~2009-01-09 14:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-31 11:53 org-mode and remind integration Daniel Martins
2009-01-09  8:17 ` Carsten Dominik
2009-01-09  8:57   ` Daniel Martins
2009-01-09 14:39     ` Olaf Dietsche [this message]
2009-01-10 13:21       ` Daniel Martins
2009-01-10 21:18         ` Olaf Dietsche
2009-01-11 20:19           ` Daniel Martins
2009-01-13 21:06             ` Olaf Dietsche
  -- strict thread matches above, loose matches on Subject: below --
2009-02-11 14:23 Sharad Pratap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d4ew5yse.fsf@rat.lan \
    --to=olaf+list.orgmode@olafdietsche.de \
    --cc=Emacs-orgmode@gnu.org \
    --cc=bastien.guerry@ens.fr \
    --cc=danielemc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).