Function: diary-icalendar-mailcap-viewer

diary-icalendar-mailcap-viewer is a byte-compiled function defined in diary-icalendar.el.gz.

Signature

(diary-icalendar-mailcap-viewer)

Documentation

View iCalendar data in the current message part as diary entries.

This function is a suitable viewer for text/calendar parts in MIME messages, such as email attachments. To use this function as a viewer, customize the variable mailcap-user-mime-data and add an entry containing this function for the MIME type "text/calendar".

To extend the behavior of this function, see diary-icalendar-after-mailcap-viewer-hook.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/diary-icalendar.el.gz
;; Some simple support for viewing iCalendar data in MIME message
;; parts.  Mail readers may want to build their own viewer using the
;; import functions above, but this is a good starting point:
(defun di:mailcap-viewer ()
  "View iCalendar data in the current message part as diary entries.

This function is a suitable viewer for text/calendar parts in MIME
messages, such as email attachments.  To use this function as a viewer,
customize the variable `mailcap-user-mime-data' and add an entry
containing this function for the MIME type \"text/calendar\".

To extend the behavior of this function, see
`diary-icalendar-after-mailcap-viewer-hook'."
  (let ((entries-buf (diary-icalendar-import-buffer-to-buffer)))
    (unwind-protect
        (progn
          ;; Since this is already a temporary viewer buffer, we replace
          ;; its contents with the imported entries, so we can (a) keep
          ;; the window configuration setup by the calling mailcap code
          ;; and (b) already kill the import buffer here.
          (erase-buffer)
          (insert-buffer-substring entries-buf)
          (diary-mode)
          (run-hooks di:after-mailcap-viewer-hook))
      (kill-buffer entries-buf))))