[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/vm 2d88e30263 3/6: vm-mime|vars.el: Remove support for non
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/vm 2d88e30263 3/6: vm-mime|vars.el: Remove support for non-Mule emacsen |
Date: |
Wed, 17 Jul 2024 13:01:46 -0400 (EDT) |
branch: elpa/vm
commit 2d88e30263cb02b729550c2aafe13154adef4cd3
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
vm-mime|vars.el: Remove support for non-Mule emacsen
---
lisp/vm-mime.el | 381 ++++++++++++++++++++++++--------------------------------
lisp/vm-vars.el | 41 +-----
2 files changed, 165 insertions(+), 257 deletions(-)
diff --git a/lisp/vm-mime.el b/lisp/vm-mime.el
index e0c7736383..5ea56c5f00 100644
--- a/lisp/vm-mime.el
+++ b/lisp/vm-mime.el
@@ -563,40 +563,20 @@ same effect."
(defun vm-mime-charset-decode-region (charset start end)
(or (markerp end) (setq end (vm-marker end)))
- (cond ((or (featurep 'xemacs) (not (featurep 'xemacs)))
- (if (or (and (featurep 'xemacs) (memq (vm-device-type) '(x gtk
mswindows)))
- (not (featurep 'xemacs))
- (vm-mime-tty-can-display-mime-charset charset)
- nil)
- (let ((buffer-read-only nil)
- (coding (vm-mime-charset-to-coding charset))
- (opoint (point)))
- ;; decode 8-bit indeterminate char to correct
- ;; char in correct charset.
- (vm-decode-coding-region start end coding)
- (put-text-property start end 'vm-string t)
- (put-text-property start end 'vm-charset charset)
- (put-text-property start end 'vm-coding coding)
- ;; In XEmacs 20.0 beta93 decode-coding-region moves point.
- (goto-char opoint))))
- ((not (vm-multiple-fonts-possible-p)) nil)
- ((vm-mime-default-face-charset-p charset) nil)
- (t
- (let ((font (cdr (vm-string-assoc
- charset
- vm-mime-charset-font-alist)))
- (face (make-face (make-symbol "temp-face")))
- (e (vm-make-extent start end)))
- (put-text-property start end 'vm-string t)
- (put-text-property start end 'vm-charset charset)
- (if font
- (condition-case data
- (progn (set-face-font face font)
- (if (not (featurep 'xemacs))
- (put-text-property start end 'face face)
- (vm-set-extent-property e 'duplicable t)
- (vm-set-extent-property e 'face face)))
- (error nil)))))))
+ (if (or (and (featurep 'xemacs) (memq (vm-device-type) '(x gtk mswindows)))
+ (not (featurep 'xemacs))
+ (vm-mime-tty-can-display-mime-charset charset))
+ (let ((buffer-read-only nil)
+ (coding (vm-mime-charset-to-coding charset))
+ (opoint (point)))
+ ;; decode 8-bit indeterminate char to correct
+ ;; char in correct charset.
+ (vm-decode-coding-region start end coding)
+ (put-text-property start end 'vm-string t)
+ (put-text-property start end 'vm-charset charset)
+ (put-text-property start end 'vm-coding coding)
+ ;; In XEmacs 20.0 beta93 decode-coding-region moves point.
+ (goto-char opoint))))
(defun vm-mime-transfer-decode-region (layout start end)
"Decode the body of a mime part given by LAYOUT at positions START
@@ -1958,168 +1938,155 @@ that recipient is outside of East Asia."
(save-excursion
(save-restriction
(narrow-to-region beg end)
- (if (or (featurep 'xemacs)
- (and (not (featurep 'xemacs)) enable-multibyte-characters))
- ;; Okay, we're on a MULE build.
- (if (and (not (featurep 'xemacs))
- (fboundp 'check-coding-systems-region))
- ;; check-coding-systems-region appeared in GNU Emacs 23.
- (let* ((preapproved (vm-get-coding-system-priorities))
- (ucs-list (vm-get-mime-ucs-list))
- (cant-encode (check-coding-systems-region
- (point-min) (point-max)
- (cons 'us-ascii preapproved))))
- (if (not (assq 'us-ascii cant-encode))
- ;; If there are only ASCII chars, we're done.
- "us-ascii"
- (while (and preapproved
- (assq (car preapproved) cant-encode)
- (not (memq (car preapproved) ucs-list)))
- (setq preapproved (cdr preapproved)))
- (if preapproved
- (cadr (assq (car preapproved)
- vm-mime-mule-coding-to-charset-alist))
- ;; None of the entries in vm-coding-system-priorities
- ;; can be used. This can only happen if no universal
- ;; coding system is included. Fall back to utf-8.
- "utf-8")))
-
- (let ((charsets (delq 'ascii
- (vm-charsets-in-region (point-min)
- (point-max)))))
- (cond
- ;; No non-ASCII chars? Right, that makes it easy for us.
- ((null charsets) "us-ascii")
-
- ;; Check whether the buffer can be encoded using one of the
- ;; vm-coding-system-priorities coding systems.
- ((catch 'done
-
- ;; We can't really do this intelligently unless latin-unity
- ;; is available.
- (if (featurep 'latin-unity)
- (let ((csetzero charsets)
- ;; Check what latin character sets are in the
- ;; buffer.
- (csets (latin-unity-representations-feasible-region
- beg end))
- (psets (latin-unity-representations-present-region
- beg end))
- (systems (vm-get-coding-system-priorities)))
-
- ;; If one of the character sets is outside of latin
- ;; unity's remit, check for a universal character
- ;; set in vm-coding-system-priorities, and pass back
- ;; the first one.
+ (if (not (featurep 'xemacs))
+ (let* ((preapproved (vm-get-coding-system-priorities))
+ (ucs-list (vm-get-mime-ucs-list))
+ (cant-encode (check-coding-systems-region
+ (point-min) (point-max)
+ (cons 'us-ascii preapproved))))
+ (if (not (assq 'us-ascii cant-encode))
+ ;; If there are only ASCII chars, we're done.
+ "us-ascii"
+ (while (and preapproved
+ (assq (car preapproved) cant-encode)
+ (not (memq (car preapproved) ucs-list)))
+ (setq preapproved (cdr preapproved)))
+ (if preapproved
+ (cadr (assq (car preapproved)
+ vm-mime-mule-coding-to-charset-alist))
+ ;; None of the entries in vm-coding-system-priorities
+ ;; can be used. This can only happen if no universal
+ ;; coding system is included. Fall back to utf-8.
+ "utf-8")))
+
+ (let ((charsets (delq 'ascii
+ (vm-charsets-in-region (point-min)
+ (point-max)))))
+ (cond
+ ;; No non-ASCII chars? Right, that makes it easy for us.
+ ((null charsets) "us-ascii")
+
+ ;; Check whether the buffer can be encoded using one of the
+ ;; vm-coding-system-priorities coding systems.
+ ((catch 'done
+
+ ;; We can't really do this intelligently unless latin-unity
+ ;; is available.
+ (if (featurep 'latin-unity)
+ (let ((csetzero charsets)
+ ;; Check what latin character sets are in the
+ ;; buffer.
+ (csets (latin-unity-representations-feasible-region
+ beg end))
+ (psets (latin-unity-representations-present-region
+ beg end))
+ (systems (vm-get-coding-system-priorities)))
+
+ ;; If one of the character sets is outside of latin
+ ;; unity's remit, check for a universal character
+ ;; set in vm-coding-system-priorities, and pass back
+ ;; the first one.
+ ;;
+ ;; Otherwise, there's no remapping that latin unity
+ ;; can do for us, and we should default to something
+ ;; iso-2022 based. (Since we're not defaulting to
+ ;; Unicode, at the moment.)
+
+ (while csetzero
+ (if (not (memq
+ (car csetzero) latin-unity-character-sets))
+ (let ((ucs-list (vm-get-mime-ucs-list))
+ (preapproved
+ (vm-get-coding-system-priorities)))
+ (while preapproved
+ (if (memq (car preapproved) ucs-list)
+ (throw 'done
+ (car (cdr (assq (car preapproved)
+
vm-mime-mule-coding-to-charset-alist)))))
+ (setq preapproved (cdr preapproved)))
+ ;; Nothing universal in the preapproved list.
+ (throw 'done nil)))
+ (setq csetzero (cdr csetzero)))
+
+ ;; Okay, we're able to remap using latin-unity. Do so.
+ (while systems
+ (let ((sys (latin-unity-massage-name (car systems)
+ 'buffer-default)))
+ (when (latin-unity-maybe-remap (point-min)
+ (point-max) sys
+ csets psets t)
+ (throw 'done
+ (second (assq sys
+
vm-mime-mule-coding-to-charset-alist)))))
+ (setq systems (cdr systems)))
+ (throw 'done nil))
+
+ ;; Right, latin-unity isn't available. If there's only
+ ;; one non-ASCII character set in the region, and the
+ ;; corresponding coding system is on the preapproved
+ ;; list before the first universal character set, pass
+ ;; it back. Otherwise, if a universal character set is
+ ;; on the preapproved list, pass the first one of them
+ ;; back. Otherwise, pass back nil and use the
+ ;; "iso-2022-jp" entry below.
+
+ (let ((csetzero charsets)
+ (preapproved (vm-get-coding-system-priorities))
+ (ucs-list (vm-get-mime-ucs-list)))
+ (if (null (cdr csetzero))
+ (while preapproved
+ ;; If we encounter a universal character set on
+ ;; the preapproved list, pass it back.
+ (if (memq (car preapproved) ucs-list)
+ (throw 'done
+ (second (assq (car preapproved)
+
vm-mime-mule-coding-to-charset-alist))))
+
+ ;; The preapproved entry isn't universal. Check if
+ ;; it's related to the single non-ASCII MULE
+ ;; charset in the buffer (that is, if the
+ ;; conceptually unordered MULE list of characters
+ ;; is based on a corresponding ISO character set,
+ ;; and thus the ordered ISO character set can
+ ;; encode all the characters in the MIME charset.)
;;
- ;; Otherwise, there's no remapping that latin unity
- ;; can do for us, and we should default to something
- ;; iso-2022 based. (Since we're not defaulting to
- ;; Unicode, at the moment.)
-
- (while csetzero
- (if (not (memq
- (car csetzero) latin-unity-character-sets))
- (let ((ucs-list (vm-get-mime-ucs-list))
- (preapproved
- (vm-get-coding-system-priorities)))
- (while preapproved
- (if (memq (car preapproved) ucs-list)
- (throw 'done
- (car (cdr (assq (car preapproved)
- vm-mime-mule-coding-to-charset-alist)))))
- (setq preapproved (cdr preapproved)))
- ;; Nothing universal in the preapproved list.
- (throw 'done nil)))
- (setq csetzero (cdr csetzero)))
-
- ;; Okay, we're able to remap using latin-unity. Do so.
- (while systems
- (let ((sys (latin-unity-massage-name (car systems)
- 'buffer-default)))
- (when (latin-unity-maybe-remap (point-min)
- (point-max) sys
- csets psets t)
- (throw 'done
- (second (assq sys
- vm-mime-mule-coding-to-charset-alist)))))
- (setq systems (cdr systems)))
- (throw 'done nil))
-
- ;; Right, latin-unity isn't available. If there's only
- ;; one non-ASCII character set in the region, and the
- ;; corresponding coding system is on the preapproved
- ;; list before the first universal character set, pass
- ;; it back. Otherwise, if a universal character set is
- ;; on the preapproved list, pass the first one of them
- ;; back. Otherwise, pass back nil and use the
- ;; "iso-2022-jp" entry below.
-
- (let ((csetzero charsets)
- (preapproved (vm-get-coding-system-priorities))
- (ucs-list (vm-get-mime-ucs-list)))
- (if (null (cdr csetzero))
- (while preapproved
- ;; If we encounter a universal character set on
- ;; the preapproved list, pass it back.
- (if (memq (car preapproved) ucs-list)
- (throw 'done
- (second (assq (car preapproved)
- vm-mime-mule-coding-to-charset-alist))))
-
- ;; The preapproved entry isn't universal. Check if
- ;; it's related to the single non-ASCII MULE
- ;; charset in the buffer (that is, if the
- ;; conceptually unordered MULE list of characters
- ;; is based on a corresponding ISO character set,
- ;; and thus the ordered ISO character set can
- ;; encode all the characters in the MIME charset.)
- ;;
- ;; The string equivalence test is used because we
- ;; don't have another mapping that is useful
- ;; here. Nnngh.
-
- (if (string=
- (car (cdr (assoc (car csetzero)
- vm-mime-mule-charset-to-charset-alist)))
- (car (cdr (assoc (car preapproved)
- vm-mime-mule-coding-to-charset-alist))))
- (throw 'done
- (car (cdr (assoc (car csetzero)
- vm-mime-mule-charset-to-charset-alist)))))
- (setq preapproved (cdr preapproved)))
-
- ;; Okay, there's more than one MULE character set in
- ;; the buffer. Check for a universal entry in the
- ;; preapproved list; if it exists pass it back,
- ;; otherwise fall through to the iso-2022-jp below,
- ;; because nothing on the preapproved list is
- ;; appropriate.
-
- (while preapproved
- ;; If we encounter a universal character set on
- ;; the preapproved list, pass it back.
- (when (memq (car preapproved) ucs-list)
- (throw 'done
- (second (assq (car preapproved)
- vm-mime-mule-coding-to-charset-alist))))
- (setq preapproved (cdr preapproved)))))
- (throw 'done nil))))
- ;; Couldn't do any magic with vm-coding-system-priorities. Pass
- ;; back a Japanese iso-2022 MIME character set.
- (t "iso-2022-jp")
- ;; Undo the change made in revisin 493
- ;; (t (or vm-mime-8bit-composition-charset "iso-2022-jp"))
- ;; --
- )))
- ;; If we're non-MULE and there are eight bit characters, use a
- ;; sensible default.
- (goto-char (point-min))
- (if (re-search-forward "[^\000-\177]" nil t)
- (or vm-mime-8bit-composition-charset "iso-8859-1")
- ;; We're non-MULE and there are purely 7bit characters in the
- ;; region. Return vm-mime-7bit-c-c.
- vm-mime-7bit-composition-charset)))))
+ ;; The string equivalence test is used because we
+ ;; don't have another mapping that is useful
+ ;; here. Nnngh.
+
+ (if (string=
+ (car (cdr (assoc (car csetzero)
+
vm-mime-mule-charset-to-charset-alist)))
+ (car (cdr (assoc (car preapproved)
+
vm-mime-mule-coding-to-charset-alist))))
+ (throw 'done
+ (car (cdr (assoc (car csetzero)
+
vm-mime-mule-charset-to-charset-alist)))))
+ (setq preapproved (cdr preapproved)))
+
+ ;; Okay, there's more than one MULE character set in
+ ;; the buffer. Check for a universal entry in the
+ ;; preapproved list; if it exists pass it back,
+ ;; otherwise fall through to the iso-2022-jp below,
+ ;; because nothing on the preapproved list is
+ ;; appropriate.
+
+ (while preapproved
+ ;; If we encounter a universal character set on
+ ;; the preapproved list, pass it back.
+ (when (memq (car preapproved) ucs-list)
+ (throw 'done
+ (second (assq (car preapproved)
+
vm-mime-mule-coding-to-charset-alist))))
+ (setq preapproved (cdr preapproved)))))
+ (throw 'done nil))))
+ ;; Couldn't do any magic with vm-coding-system-priorities. Pass
+ ;; back a Japanese iso-2022 MIME character set.
+ (t "iso-2022-jp")
+ ;; Undo the change made in revisin 493
+ ;; (t (or vm-mime-8bit-composition-charset "iso-2022-jp"))
+ ;; --
+ ))))))
(defun vm-determine-proper-content-transfer-encoding (beg end)
(save-excursion
@@ -5785,9 +5752,6 @@ Returns non-NIL value M is a plain message."
;; for GNU Emacs. So keep things simple, since there's no harm
;; if replacement characters are displayed.
((not (featurep 'xemacs)))
- ((vm-multiple-fonts-possible-p)
- (or (vm-mime-default-face-charset-p name)
- (vm-string-assoc name vm-mime-charset-font-alist)))
;; If the terminal-coding-system variable is set to something that
;; can encode all the characters of the given MIME character set,
@@ -8420,26 +8384,9 @@ buffer."
(goto-char (point-max))
(delete-char -1))))
-(defun vm-mime-insert-buffer-substring (buffer type)
+(defun vm-mime-insert-buffer-substring (buffer _type)
"Safe insert the contents of BUFFER of TYPE into the current buffer."
- (if (featurep 'xemacs)
- (insert-buffer-substring buffer)
- ;; Under Emacs 20.7 inserting a unibyte buffer
- ;; contents that contain 8-bit characters into a
- ;; multibyte buffer causes the inserted data to be
- ;; corrupted with the dreaded \201 corruption. So
- ;; we write the data out to disk and let the file
- ;; be inserted, which gets aoround the problem.
- (let ((tempfile (vm-make-tempfile)))
- ;; make note to delete the tempfile after insertion
- (with-current-buffer buffer
- (let ((buffer-file-coding-system
- (vm-binary-coding-system)))
- (write-region (point-min) (point-max) tempfile nil 0)))
- (unwind-protect
- (vm-mime-insert-file-contents
- tempfile type)
- (vm-error-free-call 'delete-file tempfile)))))
+ (insert-buffer-substring buffer))
;;; vm-mime.el ends here
diff --git a/lisp/vm-vars.el b/lisp/vm-vars.el
index 4c57a719b7..de5657bb6d 100644
--- a/lisp/vm-vars.el
+++ b/lisp/vm-vars.el
@@ -1878,10 +1878,7 @@ default face. This should only be used in combination
with
the mail you receive is displayable using your default face and
its associated font, even though the messages might arrive with
unknown or unregistered character sets specified in the MIME
-Content-Type header.
-
-To tell VM how to display other character sets, see
-`vm-mime-charset-font-alist'."
+Content-Type header."
:group 'vm-mime
:type '(choice (const t) (repeat string)))
@@ -1893,42 +1890,6 @@ default face even if they are also listed in
`vm-mime-default-face-charsets'."
:group 'vm-mime
:type '(repeat string))
-(defcustom vm-mime-charset-font-alist nil
- "*Assoc list of character sets and fonts that can be used to display them.
-The format of the list is:
-
- ( (CHARSET . FONT) ...)
-
-CHARSET is a string naming a MIME registered character set such
-as \"iso-8859-5\". Character set names should be specified in
-lower case.
-
-FONT is a string naming a font that can be used to display CHARSET.
-
-An example setup might be:
-
- (setq vm-mime-charset-font-alist
- '(
- (\"iso-8859-7\" . \"-*-*-medium-r-normal-*-16-160-72-72-c-80-iso8859-7\")
- )
- )
-
-This variable is only useful for character sets whose characters
-can all be encoded in single 8-bit bytes. Also multiple fonts
-can only be displayed if you're running under a window system
-e.g. X windows. So this variable will have no effect if you're
-running Emacs on a tty.
-
-If you're using FSF Emacs 20 or later, or you're using XEmacs with
-compiled in MULE support, this value of this variable is ignored.
-
-Note that under FSF Emacs 19, any fonts you use must be the
-same height as your default font. XEmacs does not have this
-limitation."
- :group 'vm-mime
- :type '(choice (const nil)
- (repeat (cons string string))))
-
(defcustom vm-mime-use-image-strips t
"*Non-nil means chop an image into horizontal strip for display.
Emacs treats a displayed image as a single large character and cannot
- [nongnu] elpa/vm updated (9aa3a94cd3 -> b42345ac0e), ELPA Syncer, 2024/07/17
- [nongnu] elpa/vm b42345ac0e 6/6: Merge branch 'fix-version-warnings' into 'main', ELPA Syncer, 2024/07/17
- [nongnu] elpa/vm 7e60631248 4/6: Remove support for `buffer-flush-undo` (Emacs<19.23), ELPA Syncer, 2024/07/17
- [nongnu] elpa/vm 1128dbf4d1 1/6: Simplify version tests, ELPA Syncer, 2024/07/17
- [nongnu] elpa/vm 2d88e30263 3/6: vm-mime|vars.el: Remove support for non-Mule emacsen,
ELPA Syncer <=
- [nongnu] elpa/vm e2ca7cb77f 2/6: Avoid obsolete `add-timeout` and `disable-timeout`, ELPA Syncer, 2024/07/17
- [nongnu] elpa/vm 35d7b1d4ab 5/6: lisp/vm-menu.el (vm-menu--global-menubar): Consolidate (X)Emacs code paths, ELPA Syncer, 2024/07/17