[COMMIT] Use Unicode for quoted-insert of codes greater than #xFF

Aidan Kehoe kehoea at parhasard.net
Sat Apr 15 10:53:52 EDT 2006


NOTE: This patch has been committed.

 Ar an naoiú lá de mí Aibréan, scríobh Aidan Kehoe:  
 
 >  Ar an triochadú lá de mí Márta, scríobh Pete Forman>:  
 >  
 >  > [...] The code number to be entered is a bit opaque to me beyond the 
 >  > range of ASCII, or is it 8859-1. Unicode codepoints would be more 
 >  > meaningful. 
 >  
 > I agree. (The range is ISO 8859-1.) 
 >  
 >  > This patch simplisitically allows Unicode to be used.  It ought to be 
 >  > enabled by a new custom variable to keep the current behavior OOTB. 
 >  
 > I don’t think we should even offer that; the int-to-char number-to-character 
 > mapping was never specified as part of the API, and varies as it is from 
 > invocation to invocation, so anyone relying on it at the moment has broken 
 > code.  
 >  
 > I’ll commit the change in the next few days unless anyone objects.  

And, done. quoted-insert’s docstring should mention read-quoted-char-radix
somewhere, but that’s another problem.

lisp/ChangeLog addition:

2006-04-15  Aidan Kehoe  <kehoea at parhasard.net>

	* cmdloop.el (read-quoted-char): Use unicode-to-char instead of
	int-to-char for converting code points to characters; document
	this usage. This is compatible with previously documented
	behaviour, since the mapping from number to character was only
	stable and well-defined for ISO-8859-1. Thank you Pete Forman!

	Document some help subsystem incompatibility with GNU that seems
	to have been ignored during the last sync.


XEmacs Trunk source patch:
Diff command:   cvs -q diff -u
Files affected: lisp/cmdloop.el

Index: lisp/cmdloop.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/cmdloop.el,v
retrieving revision 1.19
diff -u -u -r1.19 cmdloop.el
--- lisp/cmdloop.el	2006/01/08 20:00:43	1.19
+++ lisp/cmdloop.el	2006/04/15 14:36:55
@@ -542,13 +542,16 @@
   :group 'editing-basics)
 
 (defun read-quoted-char (&optional prompt)
+  ;; XEmacs change; description of the character code input
   "Like `read-char', but do not allow quitting.
-Also, if the first character read is an octal digit,
-we read any number of octal digits and return the
-specified character code.  Any nondigit terminates the sequence.
-If the terminator is RET, it is discarded;
-any other terminator is used itself as input.
 
+Also, if the first character read is a digit of base (the value of)
+`read-quoted-char-radix', we read as many of such digits as are
+typed and return a character with the corresponding Unicode code
+point.  Any input that not a digit (in the base used) terminates the
+sequence.  If the terminator is RET, it is discarded; any other
+terminator is used itself as input.
+
 The optional argument PROMPT specifies a string to use to prompt the user.
 The variable `read-quoted-char-radix' controls which radix to use
 for numeric input."
@@ -558,13 +561,20 @@
 	)
     (while (not done)
       (let ((inhibit-quit first)
-	    ;; Don't let C-h get the help message--only help function keys.
+	    ;; Don't let C-h get the help message--only help
+	    ;; function keys. 
+	    ;; XEmacs: we don't support the help function keys as of
+	    ;; 2006-04-16. GNU have a Vhelp_event_list in addition
+	    ;; to help-char in src/keyboard.c, and it's only useful
+	    ;; to set help-form while help-char is nil when that
+	    ;; functionality is available.
 	    (help-char nil)
-	    (help-form
+	    (help-form (format 
 	     "Type the special character you want to use,
-or the octal character code.
+or the character code, base %d (the value of `read-quoted-char-radix')
 RET terminates the character code and is discarded;
-any other non-digit terminates the character code and is then used as input."))
+any other non-digit terminates the character code and is then used as input."
+	     read-quoted-char-radix)))
 	(and prompt (display-message 'prompt (format "%s-" prompt)))
 	(setq event (next-command-event)
 	      char (or (event-to-character event)
@@ -605,7 +615,8 @@
 	    (t (setq code (char-to-int char)
 		     done t)))
       (setq first nil))
-    (int-to-char code)))
+    ;; XEmacs change; unicode-to-char instead of int-to-char
+    (unicode-to-char code)))
 
 ;; in passwd.el.
 ; (defun read-passwd (prompt &optional confirm default)

-- 
In the beginning God created the heavens and the earth. And God was a
bug-eyed, hexagonal smurf with a head of electrified hair; and God said:
“Si, mi chiamano Mimi...”




More information about the XEmacs-Beta mailing list