unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Deleting the next appt
@ 2004-07-30  8:07 Robert Marshall
  0 siblings, 0 replies; only message in thread
From: Robert Marshall @ 2004-07-30  8:07 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-07-30  8:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-30  8:07 Deleting the next appt Robert Marshall

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).