GNU bug report logs - #7786
23.2; Encoding of PostScript files

Previous Next

Package: emacs;

Reported by: Peter Dyballa <Peter_Dyballa <at> Freenet.DE>

Date: Wed, 5 Jan 2011 00:12:02 UTC

Severity: minor

Found in version 23.2

Full log


Message #11 received at 7786 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Peter Dyballa <Peter_Dyballa <at> Freenet.DE>
Cc: 7786 <at> debbugs.gnu.org
Subject: Re: bug#7786: 23.2; Encoding of PostScript files
Date: Wed, 02 Jun 2021 10:39:19 +0200
Peter Dyballa <Peter_Dyballa <at> 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




This bug report was last modified 3 years and 236 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.