emacs-devel
[Top][All Lists]
Advanced

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

Re: GNU Emacs 22.0.50 fails to find ä in different ISO Latin encodings


From: Miles Bader
Subject: Re: GNU Emacs 22.0.50 fails to find ä in different ISO Latin encodings
Date: Fri, 22 Sep 2006 20:27:40 +0900

Peter Dyballa <address@hidden> writes:
> There is also the option to change the 'base' of the character code
> notation from 8 to 16

This feature is supported; see the variable `read-quoted-char-radix'.

> This might be the correct way in a GNU Emacs way, but not in the way  an
> Emacs user would use it. Or can I type C-q 4245 RET to input ¥ in  some
> file? (Well, it actually works ...) Having to use other numbers  than
> the well-known three digits wide ones is not the usual user
> experience.

I suppose that a patch such as the following could be used to support
at least unicode input in `read-quoted-char' (the function underlying C-q).

(set `read-quoted-char-charset' to `ucs' to input unicode-codes)

Whether this is a serious enough problem to consider adding a patch this
latein the release cycle to consider, I don't know.  [I think the
default value of read-quoted-char-charset would probably have to remain
nil though...]

-Miles


2006-09-22  Miles Bader  <address@hidden>

        * subr.el (read-quoted-char-charset): New variable.
        (read-quoted-char): Use it.

--- orig/lisp/subr.el
+++ mod/lisp/subr.el
@@ -1539,6 +1548,17 @@
   :type '(choice (const 8) (const 10) (const 16))
   :group 'editing-basics)
 
+(defvar read-quoted-char-charset nil
+  "*The character-set used for numeric codepoints entered with 
`read-quoted-char'.
+If nil, Emacs' internal codepoints are used.")
+
+(custom-declare-variable-early
+ 'read-quoted-char-charset nil
+ "*The character-set used for numeric codepoints entered with 
`read-quoted-char'.
+If nil, Emacs' internal codepoints are used."
+  :type '(choice (const nil) (const ucs))
+  :group 'editing-basics)
+
 (defun read-quoted-char (&optional prompt)
   "Like `read-char', but do not allow quitting.
 Also, if the first character read is an octal digit,
@@ -1595,7 +1615,13 @@
            (t (setq code translated
                     done t)))
       (setq first nil))
-    code))
+    (if (null read-quoted-char-charset)
+       code
+      (let ((decoded (decode-char read-quoted-char-charset code)))
+       (when (null decoded)
+         (error "Invalid %s character: %d, #o%o, #x%x"
+                read-quoted-char-charset code code code))
+       decoded))))
 
 (defun read-passwd (prompt &optional confirm default)
   "Read a password, prompting with PROMPT, and return it.


-- 
The secret to creativity is knowing how to hide your sources.
  --Albert Einstein




reply via email to

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