From 03da3304055e73874bf844c65ef650780afb9692 Mon Sep 17 00:00:00 2001 From: vitaly Date: Tue, 26 May 2009 15:11:38 +0000 Subject: [PATCH] New feature: display message in raw format Press `,' key in Summary to see message as is. --- wl/wl-summary.el | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 61b2965..ac04708 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -291,7 +291,8 @@ See also variable `wl-use-petname'." ["Resend bounced mail" wl-summary-resend-bounced-mail t] ["Enter the message" wl-summary-jump-to-current-message t] ["Pipe message" wl-summary-pipe-message t] - ["Print message" wl-summary-print-message t]) + ["Print message" wl-summary-print-message t] + ["View raw message" wl-summary-display-raw t]) ("Thread Operation" ["Open or Close" wl-thread-open-close (eq wl-summary-buffer-view 'thread)] ["Open all" wl-thread-open-all (eq wl-summary-buffer-view 'thread)] @@ -387,6 +388,7 @@ See also variable `wl-use-petname'." ;; basic commands (define-key wl-summary-mode-map " " 'wl-summary-read) (define-key wl-summary-mode-map "." 'wl-summary-redisplay) + (define-key wl-summary-mode-map "," 'wl-summary-display-raw) (define-key wl-summary-mode-map "<" 'wl-summary-display-top) (define-key wl-summary-mode-map ">" 'wl-summary-display-bottom) (define-key wl-summary-mode-map "\177" 'wl-summary-prev-page) @@ -4741,6 +4743,31 @@ If ARG is numeric number, decode message as following: (if message-buf (set-buffer message-buf)) (wl-draft-edit-string (buffer-substring (point-min) (point-max))))))) +(defun wl-summary-display-raw (&optional arg) + "Display current message in raw format." + (interactive) + (let ((number (wl-summary-message-number)) + (folder wl-summary-buffer-elmo-folder)) + (if number + (let ((raw (elmo-message-fetch-string + folder number + (elmo-find-fetch-strategy folder number))) + (raw-buffer (get-buffer-create "*wl:raw message*")) + (raw-mode-map (make-sparse-keymap))) + (with-current-buffer raw-buffer + (toggle-read-only -1) + (erase-buffer) + (princ raw raw-buffer) + (toggle-read-only t) + (beginning-of-buffer) + (switch-to-buffer-other-window raw-buffer) + (define-key raw-mode-map "l" 'toggle-truncate-lines) + (define-key raw-mode-map "q" 'kill-buffer-and-window) + (define-key raw-mode-map "," 'kill-buffer-and-window) + (use-local-map raw-mode-map))) + (message "No message to display.")) + number)) + (defun wl-summary-save (&optional arg wl-save-dir) "Save current message to disk." (interactive) -- 1.7.10.4