Fix typo.
[elisp/flim.git] / ew-quote.el
index ad7c034..e95bfb0 100644 (file)
 ;; B : token.
 ;; C : encoded-text.
 
-(defconst ew-quoting-char ?+)
-(defconst ew-quoting-chars-regexp
-  (concat (regexp-quote (char-to-string ew-quoting-char)) "*"))
-
-(defconst ew-type2-regexp
-  (concat (regexp-quote "=?")
-          "\\(" ew-token-regexp "\\)"
-          (regexp-quote "?")
-          "\\(" ew-token-regexp "\\)"
-          (regexp-quote "?")
-          "\\(" ew-encoded-text-regexp "\\)"
-          (regexp-quote "?")
-         "\\'"))
-
 ;;;
 
 (defun ew-quoting-char-seq (num)
    "?="))
 
 (defun ew-encode-crlf (str)
-  (let ((sstart 0)
-       (mstart 0)
-       (end (length str)) result ms me)
-    (while (string-match "\\(\r\n\\)+" str mstart)
-      (setq ms (match-beginning 0)
-           me (match-end 0))
-      (setq mstart me)
-      (when (and (< me end)
-                (member (aref str me) '(?\t ?\ )))
-       (setq me (- me 2)))
-      (when (< ms me)
+  (if ew-remove-bare-crlf
+      (ew-crlf-line-convert str nil nil (lambda (nl) ""))
+    (let ((sstart 0)
+         (mstart 0)
+         (end (length str)) result ms me)
+      (while (string-match "\\(\r\n\\)+" str mstart)
+       (setq ms (match-beginning 0)
+             me (match-end 0))
+       (setq mstart me)
+       (when (and (< me end)
+                  (member (aref str me) '(?\t ?\ )))
+         (setq me (- me 2)))
+       (when (< ms me)
+         (setq result (ew-rcons* result
+                                 (substring str sstart ms)
+                                 "=?+US-ASCII?Q?")
+               sstart me)
+         (while (< ms me)
+           (setq result (ew-rcons* result "=0D=0A")
+                 ms (+ ms 2)))
+         (setq result (ew-rcons* result "?="))))
+      (when (< sstart end)
        (setq result (ew-rcons* result
-                               (substring str sstart ms)
-                               "=?+US-ASCII?Q?")
-             sstart me)
-       (while (< ms me)
-         (setq result (ew-rcons* result "=0D=0A")
-               ms (+ ms 2)))
-       (setq result (ew-rcons* result "?="))))
-    (when (< sstart end)
-      (setq result (ew-rcons* result
-                             (substring str sstart))))
-    (apply 'concat (nreverse result))))
-    
+                               (substring str sstart))))
+      (apply 'concat (nreverse result)))))
 
 '(
 (ew-quote-concat "aaa=?A?B?C?=ccc") ;"aaa=?A?B?C?=ccc"