[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: buff-menu.el in CVS today has utf-8 characters?

From: Stefan Monnier
Subject: Re: buff-menu.el in CVS today has utf-8 characters?
Date: Tue, 14 Jun 2005 18:08:05 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> In the minibuffer, it says "Select coding system (default mule-utf-8):"
> Point is on this in buff-menu.el: –-Stef
> Questions:
> Is it normal to have these characters in the file?

I don't see them here.  Are they present in the buff-menu.el buffer as well?
If not, how do you copy&paste from buff-menu.el to foo.el?

> Does this file need to be utf-8? Should it be?

Well, there are a few other coding systems possible, but it contains
a non-ASCII non-latin-1 char (more specifically an EM DASH, U+2014).

> What coding system should I use to save this file? I used utf-8.

Good choice.

> The first line of the buffer has this - shouldn't it force utf-8
> encoding automatically?  -*- coding:utf-8 -*-

I agree it should force utf-8 automatically.  I use the patch below for
that precise purpose.


--- orig/lisp/international/mule-cmds.el
+++ mod/lisp/international/mule-cmds.el
@@ -854,6 +855,24 @@
          (mapcar (function (lambda (x) (cons x (coding-system-base x))))
+    (unless no-other-defaults
+      ;; If the file has a coding cookie, try to use it before anything
+      ;; else (i.e. before default-coding-system which will typically come
+      ;; from file-coding-system-alist).
+      (unless (or (stringp from) find-file-literally)
+        (let* ((auto-cs (save-excursion
+                          (save-restriction
+                            (widen)
+                            (narrow-to-region from to)
+                            (goto-char (point-min))
+                            (set-auto-coding (or file buffer-file-name "")
+                                             (buffer-size)))))
+               (base (if auto-cs (coding-system-base auto-cs))))
+          (or (memq base '(nil undecided))
+              (rassq base default-coding-system)
+              (push (cons auto-cs base)
+                    default-coding-system)))))
     ;; From now on, the list of defaults is reversed.
     (setq default-coding-system (nreverse default-coding-system))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]