changeset 35985:b9c371244b90

(rfc2047-fold-region): Don't forward-char at EOB. (message-posting-charset): Defvar when compiling again. (rfc2047-encodable-p): Require message.
author Dave Love <fx@gnu.org>
date Thu, 08 Feb 2001 19:26:36 +0000
parents 0080b799e901
children dcca06439032
files lisp/gnus/rfc2047.el
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/rfc2047.el	Thu Feb 08 15:07:23 2001 +0000
+++ b/lisp/gnus/rfc2047.el	Thu Feb 08 19:26:36 2001 +0000
@@ -89,7 +89,7 @@
 (defvar rfc2047-q-encoding-alist
   '(("\\(From\\|Cc\\|To\\|Bcc\||Reply-To\\):" . "-A-Za-z0-9!*+/")
     ;; = (\075), _ (\137), ? (\077) are used in the encoded word.
-    ;; Avoid using 8bit characters. Some versions of Emacs has bug!
+    ;; Avoid using 8bit characters.
     ;; Equivalent to "^\000-\007\011\013\015-\037\200-\377=_?"
     ("." . "\010\012\014\040-\074\076\100-\136\140-\177"))
   "Alist of header regexps and valid Q characters.")
@@ -160,9 +160,14 @@
 	     (t)))
 	  (goto-char (point-max)))))))
 
+;; Fixme: This, and the require below may not be the Right Thing, but
+;; should be safe just before release.  -- fx 2001-02-08
+(eval-when-compile (defvar message-posting-charset))
+
 (defun rfc2047-encodable-p ()
   "Return non-nil if any characters in current buffer need encoding in headers.
 The buffer may be narrowed."
+  (require 'message)			; for message-posting-charset
   (let ((charsets
 	 (mapcar
 	  'mm-mime-charset
@@ -229,7 +234,7 @@
     result))
 
 (defun rfc2047-encode-region (b e)
-  "Encode all encodable words in region."
+  "Encode all encodable words in region B to E."
   (let ((words (rfc2047-dissect-region b e)) word)
     (save-restriction
       (narrow-to-region b e)
@@ -293,7 +298,7 @@
 	(forward-line 1)))))
 
 (defun rfc2047-fold-region (b e)
-  "Fold long lines in the region."
+  "Fold long lines in region B to E."
   (save-restriction
     (narrow-to-region b e)
     (goto-char (point-min))
@@ -313,7 +318,7 @@
 	  (setq bol (1- (point)))
 	  ;; Don't break before the first non-LWSP characters.
 	  (skip-chars-forward " \t")
-	  (forward-char 1))
+	  (unless (eobp) (forward-char 1)))
 	(cond
 	 ((eq (char-after) ?\n)
 	  (forward-char 1)
@@ -347,10 +352,10 @@
 	(setq bol (1- (point)))
 	;; Don't break before the first non-LWSP characters.
 	(skip-chars-forward " \t")
-	(forward-char 1)))))
+	(unless (eobp) (forward-char 1))))))
 
 (defun rfc2047-unfold-region (b e)
-  "Unfold lines in the region."
+  "Unfold lines in region B to E."
   (save-restriction
     (narrow-to-region b e)
     (goto-char (point-min))