diff lisp/calendar/diary-lib.el @ 90044:cb7f41387eb3

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-70 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-669 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-678 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-679 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-680 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-688 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-689 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-690 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-691 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-69 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-70 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-71 Update from CVS
author Miles Bader <miles@gnu.org>
date Fri, 12 Nov 2004 02:53:04 +0000
parents e23928ac5a97 e47a5c4e43ff
children eac554634bfa
line wrap: on
line diff
--- a/lisp/calendar/diary-lib.el	Thu Nov 04 08:55:40 2004 +0000
+++ b/lisp/calendar/diary-lib.el	Fri Nov 12 02:53:04 2004 +0000
@@ -1974,19 +1974,20 @@
 	  (throw 'finished t))))
     nil))
 
-(defun diary-from-outlook ()
+(defun diary-from-outlook (&optional noconfirm)
   "Maybe snarf diary entry from current Outlook-generated message.
-Currently knows about Gnus and Rmail modes."
-  (interactive)
+Currently knows about Gnus and Rmail modes.  Unless the optional
+argument NOCONFIRM is non-nil (which is the case when this
+function is called interactively), then if an entry is found the
+user is asked to confirm its addition."
+  (interactive "p")
   (let ((func (cond
 	       ((eq major-mode 'rmail-mode)
 		#'diary-from-outlook-rmail)
 	       ((memq major-mode '(gnus-summary-mode gnus-article-mode))
 		#'diary-from-outlook-gnus)
 	       (t (error "Don't know how to snarf in `%s'" major-mode)))))
-    (if (interactive-p)
-	(call-interactively func)
-      (funcall func))))
+    (funcall func noconfirm)))
 
 
 (defvar gnus-article-mime-handles)
@@ -1996,11 +1997,14 @@
 (autoload 'gnus-narrow-to-body "gnus")
 (autoload 'mm-get-part "mm-decode")
 
-(defun diary-from-outlook-gnus ()
+(defun diary-from-outlook-gnus (&optional noconfirm)
   "Maybe snarf diary entry from Outlook-generated message in Gnus.
-Add this to `gnus-article-prepare-hook' to notice appointments
+Unless the optional argument NOCONFIRM is non-nil (which is the case when
+this function is called interactively), then if an entry is found the
+user is asked to confirm its addition.
+Add this function to `gnus-article-prepare-hook' to notice appointments
 automatically."
-  (interactive)
+  (interactive "p")
   (with-current-buffer gnus-article-buffer
     (let ((subject (gnus-fetch-field "subject"))
 	  (body (if gnus-article-mime-handles
@@ -2011,8 +2015,7 @@
 		    (gnus-narrow-to-body)
 		    (buffer-string)))))
       (when (diary-from-outlook-internal t)
-	(when (or (interactive-p)
-                  (y-or-n-p "Snarf diary entry? "))
+	(when (or noconfirm (y-or-n-p "Snarf diary entry? "))
 	  (diary-from-outlook-internal)
 	  (message "Diary entry added"))))))
 
@@ -2021,9 +2024,12 @@
 
 (defvar rmail-buffer)
 
-(defun diary-from-outlook-rmail ()
-  "Maybe snarf diary entry from Outlook-generated message in Rmail."
-  (interactive)
+(defun diary-from-outlook-rmail (&optional noconfirm)
+  "Maybe snarf diary entry from Outlook-generated message in Rmail.
+Unless the optional argument NOCONFIRM is non-nil (which is the case when
+this function is called interactively), then if an entry is found the
+user is asked to confirm its addition."
+  (interactive "p")
   (with-current-buffer rmail-buffer
     (let ((subject (mail-fetch-field "subject"))
 	  (body (buffer-substring (save-excursion
@@ -2031,8 +2037,7 @@
 				    (point))
 				  (point-max))))
       (when (diary-from-outlook-internal t)
-	(when (or (interactive-p)
-                  (y-or-n-p "Snarf diary entry? "))
+	(when (or noconfirm (y-or-n-p "Snarf diary entry? "))
 	  (diary-from-outlook-internal)
 	  (message "Diary entry added"))))))