From 80ad57469a3128ca056b69f2f65b6fdcd712205e Mon Sep 17 00:00:00 2001 From: yamaoka Date: Thu, 26 Oct 2000 00:26:19 +0000 Subject: [PATCH] Synch with Gnus. --- lisp/ChangeLog | 10 ++++++++++ lisp/mm-decode.el | 13 ++++++++++++- lisp/rfc2047.el | 26 ++++++++++++++++---------- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ed26af4..fea6a23 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2000-10-25 20:13:02 ShengHuo ZHU + + * mm-decode.el (mm-viewer-completion-map): New. + (mm-interactively-view-part): Use it. + +2000-10-25 18:51:12 ShengHuo ZHU + + * rfc2047.el (rfc2047-q-encode-region): Don't break if a QP-word + could be fitted in one line. + 2000-10-25 Dirk Meyer * gnus-demon.el (gnus-demon-time-to-step): theHour was set to diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el index 19a79cd..c3b6113 100644 --- a/lisp/mm-decode.el +++ b/lisp/mm-decode.el @@ -218,6 +218,15 @@ to: ;; "message/rfc822". (defvar mm-dissect-default-type "text/plain") +(defvar mm-viewer-completion-map + (let ((map (make-sparse-keymap 'mm-viewer-completion-map))) + (set-keymap-parent map minibuffer-local-completion-map) + map) + "Keymap for input viewer with completion.") + +;; Should we bind other key to minibuffer-complete-word? +(define-key mm-viewer-completion-map " " 'self-insert-command) + ;;; The functions. (defun mm-dissect-buffer (&optional no-strict-mime) @@ -709,7 +718,9 @@ external if displayed external." (methods (mapcar (lambda (i) (list (cdr (assoc 'viewer i)))) (mailcap-mime-info type 'all))) - (method (completing-read "Viewer: " methods))) + (method (let ((minibuffer-local-completion-map + mm-viewer-completion-map)) + (completing-read "Viewer: " methods)))) (when (string= method "") (error "No method given")) (if (string-match "^[^% \t]+$" method) diff --git a/lisp/rfc2047.el b/lisp/rfc2047.el index d699a4b..fec54b4 100644 --- a/lisp/rfc2047.el +++ b/lisp/rfc2047.el @@ -372,22 +372,28 @@ Should be called narrowed to the head of the message." (save-excursion (save-restriction (narrow-to-region (goto-char b) e) - (let ((alist rfc2047-q-encoding-alist)) + (let ((alist rfc2047-q-encoding-alist) + (bol (save-restriction + (widen) + (gnus-point-at-bol)))) (while alist (when (looking-at (caar alist)) (quoted-printable-encode-region b e nil (cdar alist)) (subst-char-in-region (point-min) (point-max) ? ?_) (setq alist nil)) (pop alist)) - (goto-char (1+ (point-min))) - (while (and (not (bobp)) (not (eobp))) - (goto-char (min (point-max) (save-restriction - (widen) - ;; THe QP encapsulation is about 20. - (+ 56 (gnus-point-at-bol))))) - (search-backward "=" (- (point) 2) t) - (unless (or (bobp) (eobp)) - (insert "\n"))))))) + ;; The size of QP encapsulation is about 20, so set limit to + ;; 56=76-20. + (unless (< (- (point-max) (point-min)) 56) + ;; Don't break if it could fit in one line. + ;; Let rfc2047-encode-region break it later. + (goto-char (1+ (point-min))) + (while (and (not (bobp)) (not (eobp))) + (goto-char (min (point-max) (+ 56 bol))) + (search-backward "=" (- (point) 2) t) + (unless (or (bobp) (eobp)) + (insert "\n") + (setq bol (point))))))))) ;;; ;;; Functions for decoding RFC2047 messages -- 1.7.10.4