- (defun quoted-printable-ccl-encode-string (string)
- "Encode STRING with quoted-printable encoding."
- (decode-coding-string
- string
- 'mel-ccl-quoted-printable-lf-lf-rev))
-
- (defun quoted-printable-ccl-encode-region (start end)
- "Encode the region from START to END with quoted-printable encoding."
- (interactive "*r")
- (decode-coding-region start end 'mel-ccl-quoted-printable-lf-lf-rev))
-
- (defun quoted-printable-ccl-insert-encoded-file (filename)
- "Encode contents of the file named as FILENAME, and insert it."
- (interactive "*fInsert encoded file: ")
- (insert
- (decode-coding-string
- (with-temp-buffer
- (set-buffer-multibyte nil)
- (insert-file-contents-as-binary filename)
- (buffer-string))
- 'mel-ccl-quoted-printable-lf-lf-rev)))
+ (cond
+ ((eval-when-compile
+ (and (eq emacs-major-version 23)
+ (eq emacs-minor-version 1)))
+ (defun quoted-printable-ccl-encode-string (string)
+ "Encode STRING with quoted-printable encoding."
+ (ccl-execute-on-string 'mel-ccl-encode-quoted-printable-lf-lf
+ [0 0 0 0 0 0 0 0 0] string nil t))
+ (defun quoted-printable-ccl-encode-region (start end)
+ "Encode the region from START to END with quoted-printable encoding."
+ (interactive "*r")
+ (save-excursion
+ (goto-char start)
+ (insert (prog1 (quoted-printable-ccl-encode-string
+ (buffer-substring start end))
+ (delete-region start end)))))
+
+ (defun quoted-printable-ccl-insert-encoded-file (filename)
+ "Encode contents of the file named as FILENAME, and insert it."
+ (interactive "*fInsert encoded file: ")
+ (insert
+ (ccl-execute-on-string 'mel-ccl-encode-quoted-printable-lf-lf
+ [0 0 0 0 0 0 0 0 0]
+ (with-temp-buffer
+ (set-buffer-multibyte nil)
+ (insert-file-contents-as-binary filename)
+ (buffer-string))
+ nil t))))
+ (t
+ (defun quoted-printable-ccl-encode-string (string)
+ "Encode STRING with quoted-printable encoding."
+ (decode-coding-string
+ string
+ 'mel-ccl-quoted-printable-lf-lf-rev))
+
+ (defun quoted-printable-ccl-encode-region (start end)
+ "Encode the region from START to END with quoted-printable encoding."
+ (interactive "*r")
+ (decode-coding-region start end 'mel-ccl-quoted-printable-lf-lf-rev))
+
+ (defun quoted-printable-ccl-insert-encoded-file (filename)
+ "Encode contents of the file named as FILENAME, and insert it."
+ (interactive "*fInsert encoded file: ")
+ (insert
+ (decode-coding-string
+ (with-temp-buffer
+ (set-buffer-multibyte nil)
+ (insert-file-contents-as-binary filename)
+ (buffer-string))
+ 'mel-ccl-quoted-printable-lf-lf-rev)))))