summaryrefslogtreecommitdiff
path: root/lisp/mh-e/mh-print.el
diff options
context:
space:
mode:
authorBill Wohler <wohler@newt.com>2005-12-02 05:54:33 +0000
committerBill Wohler <wohler@newt.com>2005-12-02 05:54:33 +0000
commit553fb7353b8ff4a44d28521f0f39f66d1e89a65b (patch)
treed3dc3cfa5068d723b011f0d3698aa91868e1c055 /lisp/mh-e/mh-print.el
parent1a18223ec4b5a7f8fc8cbaa88bf2aa9457bf6d9f (diff)
* mh-comp.el (mh-letter-mode): Use mh-highlight-citation-style instead
of mh-highlight-citation-p. (mh-letter-toggle-header-field-display): "Ellipsed" isn't a word, I think, so use "truncated". * mh-customize.el (mh-folder, mh-folder-faces): Group's manual section is Folders, not Organizing. Parent of mh-folder-faces is mh-folder, not mh-show. (mh-speed): Rename to mh-speedbar for consistency with mh-toolbar. (mh-thread): New group that corresponds with manual's Threading chapter. (mh-letter-faces): Group's manual section is Editing Drafts, not Sending Mail. (mh-sortm-args): New customization variable that used to be a defvar. (mh-index-new-messages-folders, mh-index-ticked-messages-folders): Move from mh-index group to mh-folders group. (mh-alias-local-users-prefix, mh-large-folder) (mh-recursive-folders-flag, mh-before-quit-hook) (mh-folder-mode-hook, mh-kill-folder-suppress-prompt-hook) (mh-quit-hook, mh-refile-msg-hook): Move from mh-show group to mh-folder group. (mh-highlight-citation-style): Rename from mh-highlight-citation-p. Sync docstrings with manual. (mh-mhl-format-file): Rename from mhl-formfile. Sync docstrings with manual. (mh-show-threads-flag): Move from mh-show group to mh-thread group. (mh-find-path-hook): Move from mh-show group to mh-e group. (mh-folder-updated-hook): Add to mh-folder group. (mh-forward-hook): Move from mh-folder to mh-sending-mail group. (mh-unseen-updated-hook): Move from mh-show to mh-sequences group. (mh-bury-show-buffer-flag, mh-clean-message-header-flag) (mh-decode-mime-flag, mh-display-buttons-for-alternatives-flag) (mh-display-buttons-for-inline-parts-flag) (mh-do-not-confirm-flag, mh-fetch-x-image-url) (mh-graphical-smileys-flag, mh-graphical-emphasis-flag) (mh-invisible-header-fields-default, mh-invisible-header-fields) (mh-lpr-command-format, mh-max-inline-image-height) (mh-max-inline-image-width) (mh-mime-save-parts-default-directory, mh-print-background-flag) (mh-show-maximum-size, mh-show-use-goto-addr-flag) (mh-show-use-xface-flag, mh-store-default-directory) (mh-summary-height, mh-delete-msg-hook (mh-show-hook, mh-show-mode-hook): Sync docstrings with manual. * mh-e.el (mh-scan-format-mh, mh-scan-good-msg-regexp) (mh-scan-deleted-msg-regexp, mh-scan-refiled-msg-regexp) (mh-scan-cur-msg-number-regexp, mh-scan-subject-regexp): Use non-fontification instead of non-fontifying. (mh-header-display): Use mh-mhl-format-file instead of mhl-formfile. Sync docstrings with manual. (mh-next-undeleted-msg, mh-previous-undeleted-msg): Rename arg to count. Sync docstrings with manual. (mh-refile-or-write-again): Use output from mh-write-msg-to-file so that message doesn't change when using this command. Sync docstrings with manual. (mh-page-msg, mh-previous-page): Rename arg to lines. Sync docstrings with manual. (mh-write-msg-to-file): Rename msg to message. Rename no-headers to no-header. Sync docstrings with manual. (mh-ps-print-map): Delete keybindings for deleted commands mh-ps-print-toggle-mime and mh-ps-print-msg-show. (mh-help-messages): Updated printing help. (mh-delete-msg, mh-delete-msg-no-motion, mh-first-msg) (mh-last-msg, mh-previous-unread-msg, mh-next-button) (mh-prev-button, mh-folder-toggle-mime-part) (mh-folder-inline-mime-part, mh-folder-save-mime-part) (mh-next-unread-msg, mh-toggle-mime-buttons): Sync docstrings with manual. * mh-funcs.el (mh-sortm-args): Now a customization option and in mh-customize.el. (mh-pipe-msg): Rename include-headers to include-header. Sync docstrings with manual. (mh-burst-digest, mh-page-digest, mh-page-digest-backwards) (mh-store-msg): Sync docstrings with manual. * mh-mime.el (mh-mime-save-parts): Rename arg to prompt. Sync docstrings with manual. (mh-toggle-mh-decode-mime-flag): Use English in message, not Lisp. Sync docstrings with manual. (mh-mm-display-part, mh-mm-inline-message): Use mh-highlight-citation-style instead of mh-highlight-citation-p. (mh-press-button): Sync docstrings with manual. (mh-display-with-external-viewer): Fix default output in minibuffer. Sync docstrings with manual. * mh-print.el: (mh-ps-print-mime, mh-ps-print-toggle-mime): Deleted. (mh-ps-print-color-option): Incorporate docstring from ps-print-color-p. (mh-ps-spool-buffer): Remove unused code. Fix indent. Slimline docstring. (mh-ps-spool-msg): Slimline docstring. Rename from mh-ps-spool-a-msg. Rewrote to use existing show buffer when available. (mh-ps-print-range): Extract method from common code in mh-ps-print-msg and mh-ps-print-msg-file. (mh-ps-print-preprint): Clean docstring. Use filename "mh-%s". (mh-ps-print-msg-show): Delete. Can use either mh-ps-print-msg-show or mh-ps-print-msg-show to same effect with new code in mh-ps-spool-msg. (mh-print-msg): Use mh-mhl-format-file instead of mhl-formfile. Sync docstrings with manual. (mh-ps-print-msg, mh-ps-print-msg-file) (mh-ps-print-toggle-faces, mh-ps-print-toggle-color): Sync docstrings with manual. * mh-utils.el (mh-show-ps-print-msg-show) (mh-show-ps-print-toggle-mime): Delete. (mh-show-ps-print-map): Updated accordingly. (mh-show-mode): Use mh-highlight-citation-style instead of mh-highlight-citation-p. (mh-show-xface, mh-display-msg): Use mh-mhl-format-file instead of mhl-formfile. (mh-show): Use mh-mhl-format-file instead of mhl-formfile. Sync docstrings with manual. (mh-show-font-lock-fontify-region, mh-modify, mh-goto-msg): Sync docstrings with manual.
Diffstat (limited to 'lisp/mh-e/mh-print.el')
-rw-r--r--lisp/mh-e/mh-print.el230
1 files changed, 104 insertions, 126 deletions
diff --git a/lisp/mh-e/mh-print.el b/lisp/mh-e/mh-print.el
index 7190b87c853..8cf91f08d74 100644
--- a/lisp/mh-e/mh-print.el
+++ b/lisp/mh-e/mh-print.el
@@ -25,13 +25,6 @@
;; Boston, MA 02110-1301, USA.
;;; Commentary:
-;; Pp Print to lpr | Default inline settings
-;; Pf Print to file | Generate a postscript file
-;; Ps Print show buffer | Fails if no show buffer
-;;
-;; PA Toggle inline/attachments
-;; PC Toggle color
-;; PF Toggle faces
;;; Change Log:
@@ -44,125 +37,120 @@
(require 'mh-funcs)
(eval-when-compile (require 'mh-seq))
-(defvar mh-ps-print-mime nil
- "Control printing of MIME parts.
-The three possible states are:
- 1. nil to not print inline parts
- 2. t to print inline parts
- 3. non-zero to print inline parts and attachments")
-
(defvar mh-ps-print-color-option ps-print-color-p
- "MH-E's version of `\\[ps-print-color-p]'.")
+ "Specify how buffer's text color is printed.
+
+Valid values are:
+
+ nil - Do not print colors.
+ t - Print colors.
+ black-white - Print colors on black/white printer.
+ See also `ps-black-white-faces'.
+
+Any other value is treated as t. This variable is initialized from
+`ps-print-color-p'.")
(defvar mh-ps-print-func 'ps-spool-buffer-with-faces
"Function to use to spool a buffer.
+
Sensible choices are the functions `ps-spool-buffer' and
`ps-spool-buffer-with-faces'.")
-;; XXX - If buffer is already being displayed, use that buffer
-;; XXX - What about showing MIME content?
-;; XXX - Default print buffer is bogus
(defun mh-ps-spool-buffer (buffer)
- "Send BUFFER to printer queue."
+ "Spool BUFFER."
(save-excursion
(set-buffer buffer)
(let ((ps-print-color-p mh-ps-print-color-option)
- (ps-left-header
- (list
- (concat "("
- (mh-get-header-field "Subject:") ")")
- (concat "("
- (mh-get-header-field "From:") ")")))
- (ps-right-header
- (list
- "/pagenumberstring load"
- (concat "("
- (mh-get-header-field "Date:") ")"))))
- (funcall mh-ps-print-func))))
-
-(defun mh-ps-spool-a-msg (msg buffer)
- "Print MSG.
-First the message is decoded in BUFFER before the results are sent to the
-printer."
- (let ((mh-show-buffer mh-show-buffer)
- (folder mh-current-folder)
- ;; The following is commented out because
- ;; `clean-message-header-flag' isn't used anywhere. I
- ;; commented rather than deleted in case somebody had some
- ;; future plans for it. --SY.
- ;(clean-message-header-flag mh-clean-message-header-flag)
- )
+ (ps-left-header
+ (list
+ (concat "(" (mh-get-header-field "Subject:") ")")
+ (concat "(" (mh-get-header-field "From:") ")")))
+ (ps-right-header
+ (list
+ "/pagenumberstring load"
+ (concat "(" (mh-get-header-field "Date:") ")"))))
+ (funcall mh-ps-print-func))))
+
+(defun mh-ps-spool-msg (msg)
+ "Spool MSG."
+ (let* ((folder mh-current-folder)
+ (buffer (mh-in-show-buffer (mh-show-buffer)
+ (if (not (equal (mh-msg-filename msg folder)
+ buffer-file-name))
+ (get-buffer-create mh-temp-buffer)))))
+ (unwind-protect
+ (save-excursion
+ (if buffer
+ (let ((mh-show-buffer buffer))
+ (mh-display-msg msg folder)))
+ (mh-ps-spool-buffer (if buffer buffer mh-show-buffer)))
+ (if buffer
+ (kill-buffer buffer)))))
+
+(defun mh-ps-print-range (range file)
+ "Print the messages in RANGE to FILE.
+This is the function that actually does the work.
+If FILE is nil, then the messages are spooled to the printer."
+ (mh-iterate-on-range msg range
(unwind-protect
- (progn
- (setq mh-show-buffer buffer)
- (save-excursion
- ;;
- ;; XXX - Use setting of mh-ps-print-mime
- ;;
- (mh-display-msg msg folder)
- (mh-ps-spool-buffer mh-show-buffer)
- (kill-buffer mh-show-buffer))))))
+ (mh-ps-spool-msg msg))
+ (mh-notate msg mh-note-printed mh-cmd-note))
+ (ps-despool file))
+
+(defun mh-ps-print-preprint (prefix-arg)
+ "Provide a better default file name for `ps-print-preprint'.
+Pass along the PREFIX-ARG to it."
+ (let ((buffer-file-name (format "mh-%s" (substring (buffer-name) 1))))
+ (ps-print-preprint prefix-arg)))
;;;###mh-autoload
(defun mh-ps-print-msg (range)
- "Print the messages in RANGE.
+ "Print the messages in RANGE\\<mh-folder-mode-map>.
Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use."
- (interactive (list (mh-interactive-range "Print")))
- (mh-iterate-on-range msg range
- (let ((buffer (get-buffer-create mh-temp-buffer)))
- (unwind-protect
- (mh-ps-spool-a-msg msg buffer)
- (kill-buffer buffer)))
- (mh-notate nil mh-note-printed mh-cmd-note))
- (ps-despool nil))
+interactive use.
-(defun mh-ps-print-preprint (prefix-arg)
- "Replacement for `ps-print-preprint'.
-The original function does not handle the fact that MH folders are directories
-nicely, when generating the default file name. This function works around
-that. The function is passed the interactive PREFIX-ARG."
- (let ((buffer-file-name (format "/tmp/%s" (substring (buffer-name) 1))))
- (ps-print-preprint prefix-arg)))
+This command will print inline text attachments but will not decrypt messages.
+However, when a message is displayed in an MH-Show buffer, then that buffer is
+used verbatim for printing with the caveat that only text attachments, if
+opened inline, are printed. Therefore, encrypted messages can be printed by
+showing and decrypting them first.
+
+MH-E uses the \"ps-print\" package to do the printing, so you can customize
+the printing further by going to the `ps-print' customization group. This
+command does not use the options `mh-lpr-command-format' or
+`mh-print-background-flag'. See also the commands \\[mh-ps-print-toggle-color]
+and \\[mh-ps-print-toggle-faces]."
+ (interactive (list (mh-interactive-range "Print")))
+ (mh-ps-print-range range nil))
;;;###mh-autoload
-(defun mh-ps-print-msg-file (file range)
- "Print to FILE the messages in RANGE.
+(defun mh-ps-print-msg-file (range file)
+ "Print the messages in RANGE to FILE\\<mh-folder-mode-map>.
Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use."
- (interactive (list
- (mh-ps-print-preprint 1)
- (mh-interactive-range "Print")))
- (mh-iterate-on-range msg range
- (let ((buffer (get-buffer-create mh-temp-buffer)))
- (unwind-protect
- (mh-ps-spool-a-msg msg buffer)
- (kill-buffer buffer)))
- (mh-notate nil mh-note-printed mh-cmd-note))
- (ps-despool file))
+interactive use.
-;;;###mh-autoload
-(defun mh-ps-print-msg-show (file)
- "Print current show buffer to FILE."
- (interactive (list (mh-ps-print-preprint current-prefix-arg)))
- (let ((msg (mh-get-msg-num t))
- (folder mh-current-folder)
- (show-buffer mh-show-buffer)
- (show-window (get-buffer-window mh-show-buffer)))
- (if (and show-buffer show-window)
- (mh-in-show-buffer (show-buffer)
- (if (equal (mh-msg-filename msg folder) buffer-file-name)
- (progn
- (mh-ps-spool-buffer show-buffer)
- (ps-despool file))
- (message "Current message is not being shown(1)")))
- (message "Current message is not being shown(2)"))))
+This command will print inline text attachments but will not decrypt messages.
+However, when a message is displayed in an MH-Show buffer, then that buffer is
+used verbatim for printing with the caveat that only text attachments, if
+opened inline, are printed. Therefore, encrypted messages can be printed by
+showing and decrypting them first.
+
+MH-E uses the \"ps-print\" package to do the printing, so you can customize
+the printing further by going to the `ps-print' customization group. This
+command does not use the options `mh-lpr-command-format' or
+`mh-print-background-flag'. See also the commands \\[mh-ps-print-toggle-color]
+and \\[mh-ps-print-toggle-faces]."
+ (interactive (list (mh-interactive-range "Print") (mh-ps-print-preprint 1)))
+ (mh-ps-print-range range file))
;;;###mh-autoload
(defun mh-ps-print-toggle-faces ()
- "Toggle whether printing is done with faces or not."
+ "Toggle whether printing is done with faces or not.
+
+When faces are enabled, the printed message will look very similar to the
+message in the MH-Show buffer."
(interactive)
(if (eq mh-ps-print-func 'ps-spool-buffer-with-faces)
(progn
@@ -173,7 +161,15 @@ interactive use."
;;;###mh-autoload
(defun mh-ps-print-toggle-color ()
- "Toggle whether color is used in printing messages."
+ "Toggle whether color is used in printing messages.
+
+Colors are emulated on black-and-white printers with shades of gray. This
+might produce illegible output, even if your screen colors only use shades of
+gray. If this is the case, try using this command to toggle between color, no
+color, and a black and white representation of the colors and see which works
+best. You change this setting permanently by customizing the option
+`ps-print-color-p'."
+
(interactive)
(if (eq mh-ps-print-color-option nil)
(progn
@@ -186,36 +182,18 @@ interactive use."
(setq mh-ps-print-color-option nil)
(message "Colors will not be printed"))))
-;;; XXX: Check option 3. Documentation doesn't sound right.
-;;;###mh-autoload
-(defun mh-ps-print-toggle-mime ()
- "Cycle through available choices on how MIME parts should be printed.
-The available settings are:
- 1. Print only inline MIME parts.
- 2. Print all MIME parts.
- 3. Print no MIME parts."
- (interactive)
- (if (eq mh-ps-print-mime nil)
- (progn
- (setq mh-ps-print-mime t)
- (message "Inline parts will be printed, attachments will not be printed"))
- (if (eq mh-ps-print-mime t)
- (progn
- (setq mh-ps-print-mime 1)
- (message "Both Inline parts and attachments will be printed"))
- (setq mh-ps-print-mime nil)
- (message "Neither inline parts nor attachments will be printed"))))
-
;;; Old non-PS based printing
;;;###mh-autoload
(defun mh-print-msg (range)
- "Print RANGE on printer.
+ "Print the messages in RANGE the old fashioned way\\<mh-folder-mode-map>.
+
+The message is formatted with \"mhl\" (see option `mh-mhl-format-file') and
+printed with the \"lpr\" command (see option `mh-lpr-command-format').
Check the documentation of `mh-interactive-range' to see how RANGE is read in
interactive use.
-The variable `mh-lpr-command-format' is used to generate the print command.
-The messages are formatted by mhl. See the variable `mhl-formfile'."
+Consider using \\[mh-ps-print-msg] instead."
(interactive (list (mh-interactive-range "Print")))
(message "Printing...")
(let (msgs)
@@ -247,8 +225,8 @@ The messages are formatted by mhl. See the variable `mhl-formfile'."
(dolist (msg msgs)
(let* ((mhl-command (format "%s %s %s"
(expand-file-name "mhl" mh-lib-progs)
- (if mhl-formfile
- (format " -form %s" mhl-formfile)
+ (if mh-mhl-format-file
+ (format " -form %s" mh-mhl-format-file)
"")
(mh-msg-filename msg)))
(lpr-command