help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Deleting the next appt


From: Robert Marshall
Subject: Deleting the next appt
Date: Fri, 30 Jul 2004 09:07:24 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (windows-nt)

I have - for some days - a number of appointments in my diary that get
added to my appt-list, I get warned about them, I take the required
action and then I want to delete the appointment. 

If I use appt-delete I get asked whether I want to delete every
appointment for the day which eventually provoked me into producing
the following, which only asks about the first appointment in the list,
basically a hack of appt-delete and no doubt common code could be
extracted from the two routines to make the whole thing a bit cleaner

(defun appt-delete-first ()
  "Delete the first appointment from the list of appointments."
  (interactive)
  (let* ((tmp-msg-list appt-time-msg-list))
    (if tmp-msg-list
        (let* ((element (car tmp-msg-list))
               (prompt-string (concat "Delete "
                                      ;; We want to quote any doublequotes
                                      ;; in the string, as well as put
                                      ;; doublequotes around it.
                                      (prin1-to-string
                                       (substring-no-properties
                                        (car (cdr element)) 0))
                                      " from list? "))
           (test-input (y-or-n-p prompt-string)))
          (setq tmp-msg-list (cdr tmp-msg-list))
          (if test-input
              (setq appt-time-msg-list (delq element appt-time-msg-list))))
      (message "no appointments to delete")
      (sit-for 2))
    (appt-check)
    (message "")))

.. just in case anyone else gets similarly frustrated!

Robert
-- 
Poetry's not window cleaning.
It breaks the glass.
-- Chase Twichell


reply via email to

[Prev in Thread] Current Thread [Next in Thread]