[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#7786: 23.2; Encoding of PostScript files
From: |
Lars Ingebrigtsen |
Subject: |
bug#7786: 23.2; Encoding of PostScript files |
Date: |
Wed, 02 Jun 2021 10:39:19 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Peter Dyballa <Peter_Dyballa@Freenet.DE> writes:
> IMO GNU Emacs should open a PostScript file in
> adobe-standard-encoding, except it sees in the file that the font(s)
> used is (are) re-encoded in ISOLatin1Encoding (which is *not* the same
> as ISO 8819-1), CE Encoding, or whatever.
I took a first stab at this, but this is obviously not correct. I'm not
sure how to detect whether it's a ISOLatin1Encoding file? And... I'm
this will probably make the file opened like this be saved in utf-8,
which isn't what we want...
diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el
index 2d36dab632..dc936ba2c2 100644
--- a/lisp/international/mule-conf.el
+++ b/lisp/international/mule-conf.el
@@ -1637,6 +1637,7 @@ 'utf-7-imap
("\\.el\\'" . prefer-utf-8)
("\\.utf\\(-8\\)?\\'" . utf-8)
("\\.xml\\'" . xml-find-file-coding-system)
+ ("\\.ps\\'" . ps-find-file-coding-system)
;; We use raw-text for reading loaddefs.el so that if it
;; happens to have DOS or Mac EOLs, they are converted to
;; newlines. This is required to make the special treatment
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 9cd38afd8b..6efdaba6e8 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -2511,6 +2511,17 @@ sgml-html-meta-auto-coding-function
(message "Warning: unknown coding system \"%s\"" match)
nil)))))
+(defun ps-find-file-coding-system (args)
+ (if (not (eq (car args) 'insert-file-contents))
+ 'undecided
+ (let ((coding-system
+ (coding-system-base
+ (detect-coding-region (point-min) (point-max) t))))
+ ;; If it's an ASCII file, then interpret ` specially.
+ (if (eq coding-system 'undecided)
+ 'adobe-standard-encoding
+ coding-system))))
+
(defun xml-find-file-coding-system (args)
"Determine the coding system of an XML file without a declaration.
Strictly speaking, the file should be utf-8, but mistakes are
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- bug#7786: 23.2; Encoding of PostScript files,
Lars Ingebrigtsen <=