From: Ivan Kanis <expire-by-2010-06-04@kanis.fr>
To: emacs devel <emacs-devel@gnu.org>
Subject: [PATCH] improvement to appt
Date: Sun, 30 May 2010 13:15:50 +0200 [thread overview]
Message-ID: <87d3wdod21.fsf@kanis.fr> (raw)
Hello,
In appt I find that a global time delay for each appointments is
inconvenient. For example I need to be warned an hour before an
appointment downtown and only 5 minutes for a meeting at work. The
following patch keeps track of a delay for each appointment. It is
backward compatible.
The feature is filed in http://debbugs.gnu.org/5176
I have e-mailed Glenn a few days back but got no response. Could someone
apply the patch?
--- a/lisp/misc/appt.el Thu Dec 10 17:56:17 2009 +0100
+++ b/lisp/misc/appt.el Thu Dec 17 10:17:32 2009 +0100
@@ -355,6 +355,8 @@
;; calculate the number of minutes until the appointment.
(when (and appt-issue-message appt-time-msg-list)
(setq appt-comp-time (caar (car appt-time-msg-list))
+ appt-warn-time (or (nth 3 (car appt-time-msg-list))
+ appt-message-warning-time)
min-to-app (- appt-comp-time cur-comp-time))
(while (and appt-time-msg-list
(< appt-comp-time cur-comp-time))
@@ -362,21 +364,21 @@
(if appt-time-msg-list
(setq appt-comp-time (caar (car appt-time-msg-list)))))
;; If we have an appointment between midnight and
- ;; `appt-message-warning-time' minutes after midnight, we
+ ;; `appt-warn-time' minutes after midnight, we
;; must begin to issue a message before midnight. Midnight
;; is considered 0 minutes and 11:59pm is 1439
;; minutes. Therefore we must recalculate the minutes to
;; appointment variable. It is equal to the number of
;; minutes before midnight plus the number of minutes after
;; midnight our appointment is.
- (if (and (< appt-comp-time appt-message-warning-time)
- (> (+ cur-comp-time appt-message-warning-time)
+ (if (and (< appt-comp-time appt-warn-time)
+ (> (+ cur-comp-time appt-warn-time)
appt-max-time))
(setq min-to-app (+ (- (1+ appt-max-time) cur-comp-time)
appt-comp-time)))
;; Issue warning if the appointment time is within
;; appt-message-warning time.
- (when (and (<= min-to-app appt-message-warning-time)
+ (when (and (<= min-to-app appt-warn-time)
(>= min-to-app 0))
(setq appt-now-displayed t
appt-display-count (1+ prev-appt-display-count))
@@ -472,14 +474,20 @@
"[0-9]?[0-9]\\(h\\([0-9][0-9]\\)?\\|[:.][0-9][0-9]\\)\\(am\\|pm\\)?")
;;;###autoload
-(defun appt-add (new-appt-time new-appt-msg)
+(defun appt-add (new-appt-time new-appt-msg &optional warn)
"Add an appointment for today at NEW-APPT-TIME with message NEW-APPT-MSG.
The time should be in either 24 hour format or am/pm format."
- (interactive "sTime (hh:mm[am/pm]): \nsMessage: ")
+ (interactive "sTime (hh:mm[am/pm]): \nsMessage:
+sDelay in minutes (press return for default): ")
(unless (string-match appt-time-regexp new-appt-time)
(error "Unacceptable time-string"))
+ (setq warn
+ (if (or (not warn) (string= warn ""))
+ appt-message-warning-time
+ (string-to-number warn)))
(let ((time-msg (list (list (appt-convert-time new-appt-time))
- (concat new-appt-time " " new-appt-msg) t)))
+ (concat new-appt-time " " new-appt-msg) t
+ warn)))
(unless (member time-msg appt-time-msg-list)
(setq appt-time-msg-list
(appt-sort-list (nconc appt-time-msg-list (list time-msg)))))))
--
Ivan Kanis
http://kanis.fr
Courage is resistance to fear, mastery of fear. Not absence of fear.
-- Mark Twain
next reply other threads:[~2010-05-30 11:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-30 11:15 Ivan Kanis [this message]
2010-05-31 3:15 ` [PATCH] improvement to appt Glenn Morris
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d3wdod21.fsf@kanis.fr \
--to=expire-by-2010-06-04@kanis.fr \
--cc=emacs-devel@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.