Function: diary-print-entries

diary-print-entries is an interactive and byte-compiled function defined in diary-lib.el.gz.

Signature

(diary-print-entries)

Documentation

Print a hard copy of the diary display.

If the simple diary display is being used, prepare a temp buffer with the visible lines of the diary buffer, add a heading line composed from the mode line, print the temp buffer, and destroy it.

If the fancy diary display is being used, just print the buffer.

The hooks given by the variable diary-print-entries-hook are called to do the actual printing.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/diary-lib.el.gz
;; FIXME modernize?
(defun diary-print-entries ()
  "Print a hard copy of the diary display.

If the simple diary display is being used, prepare a temp buffer with the
visible lines of the diary buffer, add a heading line composed from the mode
line, print the temp buffer, and destroy it.

If the fancy diary display is being used, just print the buffer.

The hooks given by the variable `diary-print-entries-hook' are called to do
the actual printing."
  (interactive)
  (let ((diary-buffer (get-buffer diary-fancy-buffer))
        temp-buffer heading start end)
    (if diary-buffer
        (with-current-buffer diary-buffer
          (run-hooks 'diary-print-entries-hook))
      (or (setq diary-buffer (find-buffer-visiting diary-file))
          (error "You don't have a diary buffer!"))
      ;; Name affects printing?
      (setq temp-buffer (get-buffer-create " *Printable Diary Entries*"))
      (with-current-buffer diary-buffer
        (setq heading
              (if (not (stringp mode-line-format))
                  "All Diary Entries"
                (string-match "^-*\\([^-].*[^-]\\)-*$" mode-line-format)
                (match-string 1 mode-line-format))
              start (point-min))
        (while
            (progn
              (setq end (next-single-char-property-change start 'invisible))
              (unless (get-char-property start 'invisible)
                (with-current-buffer temp-buffer
                  (insert-buffer-substring diary-buffer start end)))
              (setq start end)
              (and end (< end (point-max))))))
      (set-buffer temp-buffer)
      (goto-char (point-min))
      (insert heading "\n"
              (make-string (length heading) ?=) "\n")
      (run-hooks 'diary-print-entries-hook)
      (kill-buffer temp-buffer))))