unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Peter Dyballa <Peter_Dyballa@Freenet.DE>
Cc: 7786@debbugs.gnu.org
Subject: bug#7786: 23.2; Encoding of PostScript files
Date: Wed, 02 Jun 2021 10:39:19 +0200	[thread overview]
Message-ID: <877djcek3s.fsf@gnus.org> (raw)
In-Reply-To: <F265AF4E-C402-4C84-9B50-9D8061FE896B@Freenet.DE> (Peter Dyballa's message of "Wed, 5 Jan 2011 01:18:19 +0100")

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





  parent reply	other threads:[~2021-06-02  8:39 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-05  0:18 bug#7786: 23.2; Encoding of PostScript files Peter Dyballa
2021-01-20 18:02 ` Lars Ingebrigtsen
2021-06-02  8:39 ` Lars Ingebrigtsen [this message]
2021-06-02 16:37   ` Peter Dyballa
2021-10-13 12:49   ` Lars Ingebrigtsen
2021-10-13 13:12     ` Lars Ingebrigtsen
2021-10-13 13:51 ` Lars Ingebrigtsen
2021-10-13 15:41   ` Eli Zaretskii
2021-10-13 16:05     ` Lars Ingebrigtsen
2021-10-13 16:18       ` Eli Zaretskii
2021-10-13 16:20         ` Lars Ingebrigtsen
2021-10-13 16:23           ` Peter Dyballa
2021-10-13 16:28             ` Lars Ingebrigtsen
2021-10-13 16:43               ` Peter Dyballa
2021-10-13 16:45             ` Eli Zaretskii
2021-10-13 17:35               ` Peter Dyballa
2021-10-13 16:43           ` Eli Zaretskii
2021-10-13 18:55             ` Lars Ingebrigtsen
2021-10-13 19:05               ` Eli Zaretskii
2021-10-13 19:07               ` Peter Dyballa
2021-10-13 21:02   ` Peter Dyballa
2021-10-14  6:42     ` Eli Zaretskii
2021-10-15 12:47       ` Lars Ingebrigtsen
2021-10-15 15:59         ` Peter Dyballa
2021-10-18  7:09           ` Lars Ingebrigtsen
2021-10-18 12:25             ` Eli Zaretskii
2021-10-18 13:17               ` Lars Ingebrigtsen
2021-10-18 15:51               ` Peter Dyballa
2021-10-18 16:00                 ` Eli Zaretskii
2021-10-19  5:49                   ` Peter Dyballa
2021-10-19 11:59                     ` Eli Zaretskii
2021-10-19 13:47                       ` Lars Ingebrigtsen
2021-10-20  5:39                         ` Peter Dyballa
2021-10-20  5:45                           ` Lars Ingebrigtsen
2021-10-20  6:18                             ` Lars Ingebrigtsen
2021-10-20 16:34                             ` Peter Dyballa
2021-10-13 21:55   ` Peter Dyballa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877djcek3s.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=7786@debbugs.gnu.org \
    --cc=Peter_Dyballa@Freenet.DE \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).