aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/calendar')
-rw-r--r--lisp/calendar/diary-lib.el37
1 files changed, 21 insertions, 16 deletions
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 945119f06df..679c4b991b6 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -1974,19 +1974,20 @@ message contains an appointment, don't make a diary entry."
1974 (throw 'finished t)))) 1974 (throw 'finished t))))
1975 nil)) 1975 nil))
1976 1976
1977(defun diary-from-outlook () 1977(defun diary-from-outlook (&optional noconfirm)
1978 "Maybe snarf diary entry from current Outlook-generated message. 1978 "Maybe snarf diary entry from current Outlook-generated message.
1979Currently knows about Gnus and Rmail modes." 1979Currently knows about Gnus and Rmail modes. Unless the optional
1980 (interactive) 1980argument NOCONFIRM is non-nil (which is the case when this
1981function is called interactively), then if an entry is found the
1982user is asked to confirm its addition."
1983 (interactive "p")
1981 (let ((func (cond 1984 (let ((func (cond
1982 ((eq major-mode 'rmail-mode) 1985 ((eq major-mode 'rmail-mode)
1983 #'diary-from-outlook-rmail) 1986 #'diary-from-outlook-rmail)
1984 ((memq major-mode '(gnus-summary-mode gnus-article-mode)) 1987 ((memq major-mode '(gnus-summary-mode gnus-article-mode))
1985 #'diary-from-outlook-gnus) 1988 #'diary-from-outlook-gnus)
1986 (t (error "Don't know how to snarf in `%s'" major-mode))))) 1989 (t (error "Don't know how to snarf in `%s'" major-mode)))))
1987 (if (interactive-p) 1990 (funcall func noconfirm)))
1988 (call-interactively func)
1989 (funcall func))))
1990 1991
1991 1992
1992(defvar gnus-article-mime-handles) 1993(defvar gnus-article-mime-handles)
@@ -1996,11 +1997,14 @@ Currently knows about Gnus and Rmail modes."
1996(autoload 'gnus-narrow-to-body "gnus") 1997(autoload 'gnus-narrow-to-body "gnus")
1997(autoload 'mm-get-part "mm-decode") 1998(autoload 'mm-get-part "mm-decode")
1998 1999
1999(defun diary-from-outlook-gnus () 2000(defun diary-from-outlook-gnus (&optional noconfirm)
2000 "Maybe snarf diary entry from Outlook-generated message in Gnus. 2001 "Maybe snarf diary entry from Outlook-generated message in Gnus.
2001Add this to `gnus-article-prepare-hook' to notice appointments 2002Unless the optional argument NOCONFIRM is non-nil (which is the case when
2003this function is called interactively), then if an entry is found the
2004user is asked to confirm its addition.
2005Add this function to `gnus-article-prepare-hook' to notice appointments
2002automatically." 2006automatically."
2003 (interactive) 2007 (interactive "p")
2004 (with-current-buffer gnus-article-buffer 2008 (with-current-buffer gnus-article-buffer
2005 (let ((subject (gnus-fetch-field "subject")) 2009 (let ((subject (gnus-fetch-field "subject"))
2006 (body (if gnus-article-mime-handles 2010 (body (if gnus-article-mime-handles
@@ -2011,8 +2015,7 @@ automatically."
2011 (gnus-narrow-to-body) 2015 (gnus-narrow-to-body)
2012 (buffer-string))))) 2016 (buffer-string)))))
2013 (when (diary-from-outlook-internal t) 2017 (when (diary-from-outlook-internal t)
2014 (when (or (interactive-p) 2018 (when (or noconfirm (y-or-n-p "Snarf diary entry? "))
2015 (y-or-n-p "Snarf diary entry? "))
2016 (diary-from-outlook-internal) 2019 (diary-from-outlook-internal)
2017 (message "Diary entry added")))))) 2020 (message "Diary entry added"))))))
2018 2021
@@ -2021,9 +2024,12 @@ automatically."
2021 2024
2022(defvar rmail-buffer) 2025(defvar rmail-buffer)
2023 2026
2024(defun diary-from-outlook-rmail () 2027(defun diary-from-outlook-rmail (&optional noconfirm)
2025 "Maybe snarf diary entry from Outlook-generated message in Rmail." 2028 "Maybe snarf diary entry from Outlook-generated message in Rmail.
2026 (interactive) 2029Unless the optional argument NOCONFIRM is non-nil (which is the case when
2030this function is called interactively), then if an entry is found the
2031user is asked to confirm its addition."
2032 (interactive "p")
2027 (with-current-buffer rmail-buffer 2033 (with-current-buffer rmail-buffer
2028 (let ((subject (mail-fetch-field "subject")) 2034 (let ((subject (mail-fetch-field "subject"))
2029 (body (buffer-substring (save-excursion 2035 (body (buffer-substring (save-excursion
@@ -2031,8 +2037,7 @@ automatically."
2031 (point)) 2037 (point))
2032 (point-max)))) 2038 (point-max))))
2033 (when (diary-from-outlook-internal t) 2039 (when (diary-from-outlook-internal t)
2034 (when (or (interactive-p) 2040 (when (or noconfirm (y-or-n-p "Snarf diary entry? "))
2035 (y-or-n-p "Snarf diary entry? "))
2036 (diary-from-outlook-internal) 2041 (diary-from-outlook-internal)
2037 (message "Diary entry added")))))) 2042 (message "Diary entry added"))))))
2038 2043