[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: upcase-region changes 'i' to 'P'
From: |
Kenichi Handa |
Subject: |
Re: upcase-region changes 'i' to 'P' |
Date: |
Thu, 06 Oct 2005 20:17:16 +0900 |
In article <address@hidden>, "Richard M. Stallman" <address@hidden> writes:
>> This looks like it's in a mode designed for Turkish, turning i into
>> capital I-with-dot. Meanwhile, capital I corresponds to lower-case
>> dotless i.
>>
>> You must have done something that enabled this mode. What was it?
>> (I am not sure how one is supposed to enable it.)
> The problem can be reproduced also if you do:
> env LANG=C EMACS_UNIBYTE=1 emacs
> I did some debugging and found that the problem
> is called by this code
> if (NILP (up))
> {
> up = Fmake_char_table (Qcase_table, Qnil);
> map_char_table (set_identity, Qnil, table, table, up, 0, indices);
> map_char_table (shuffle, Qnil, table, table, up, 0, indices);
> XCHAR_TABLE (table)->extras[0] = up;
> specifically the line that calls shuffle. This occurs because the
> downcase table has an entry for capital-I-with-dot, whose value is i.
> This patch seems to fix it, but I am not sure it is entirely correct.
[...]
> --- 1867,1873 ----
> (load syntax nil t))
> ;; No information for syntax and case. Reset to the defaults.
> (let ((syntax-table (standard-syntax-table))
> ! (case-table (make-char-table 'case-table))
> (ch (if (eq window-system 'pc) 128 160)))
> (while (< ch 256)
> (modify-syntax-entry ch " " syntax-table)
No, it doesn't do the right thing. The reason why it seems
that it fixes the current problem is that it doesn't modify
standard-syntax-table, thus upcase/canon/equiv tables are
not re-generated. But, because standard-syntax-table is not
modified, for instance, \300 is incorrectly changed to \340
by downcasing.
I've just installed the attached fix. It should fix the
current problem, but it still has a problem. That is, when
you start Emacs with --unibyte, and later set
enable-multibyte-buffer to t, case tables are not correctly
setup. But, I think it's not worth fixing such a situation
in HEAD. Emacs-unicode-2 doesn't have such a problem.
---
Kenichi Handa
address@hidden
Index: mule-cmds.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/international/mule-cmds.el,v
retrieving revision 1.283
retrieving revision 1.284
diff -c -r1.283 -r1.284
*** mule-cmds.el 24 Sep 2005 13:43:59 -0000 1.283
--- mule-cmds.el 6 Oct 2005 08:11:14 -0000 1.284
***************
*** 1867,1882 ****
(load syntax nil t))
;; No information for syntax and case. Reset to the defaults.
(let ((syntax-table (standard-syntax-table))
! (case-table (standard-case-table))
(ch (if (eq window-system 'pc) 128 160)))
(while (< ch 256)
(modify-syntax-entry ch " " syntax-table)
- (aset case-table ch ch)
(setq ch (1+ ch)))
(set-char-table-extra-slot case-table 0 nil)
(set-char-table-extra-slot case-table 1 nil)
! (set-char-table-extra-slot case-table 2 nil))
! (set-standard-case-table (standard-case-table))
(let ((list (buffer-list)))
(while list
(with-current-buffer (car list)
--- 1867,1884 ----
(load syntax nil t))
;; No information for syntax and case. Reset to the defaults.
(let ((syntax-table (standard-syntax-table))
! (standard-table (standard-case-table))
! (case-table (make-char-table 'case-table))
(ch (if (eq window-system 'pc) 128 160)))
(while (< ch 256)
(modify-syntax-entry ch " " syntax-table)
(setq ch (1+ ch)))
+ (dotimes (i 128)
+ (aset case-table i (aref standard-table i)))
(set-char-table-extra-slot case-table 0 nil)
(set-char-table-extra-slot case-table 1 nil)
! (set-char-table-extra-slot case-table 2 nil)
! (set-standard-case-table case-table))
(let ((list (buffer-list)))
(while list
(with-current-buffer (car list)
- Re: upcase-region changes 'i' to 'P',
Kenichi Handa <=