unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* AGAIN: Can't isearch 'ö'
@ 2005-12-08  2:25 Kenichi Handa
  2005-12-08 16:39 ` Stefan Monnier
  2005-12-08 19:29 ` Richard M. Stallman
  0 siblings, 2 replies; 9+ messages in thread
From: Kenichi Handa @ 2005-12-08  2:25 UTC (permalink / raw)
  Cc: romain

About a half year ago, we discussed this.

> The original problem was that when a user have `ö' of
> iso-8859-15 in a buffer of iso-8859-15 coding system, he
> can't isearch that character by typing `ö' on his keyboard
> because that key is recognized as `ö' of iso-8859-1.
> 
> Stefan's proposal is to translate a character by
> translation-table-for-input in read_char ().  This is a
> generic solution, but it makes read_char () return different
> character depending on the buffer-file-coding-system of the
> current buffer, which may or may not cause anther problem.
> 
> My proposal is to translate a character by
> translate-table-for-input in isearch-process-search-char.
> This is a limitted solution only for the current problem.

And, RMS wrote:

> Suppose we use the latter solution.  We probably would want to use it
> in other places as well, but which ones?  Can you suggest a rule for
> programmers to decide whether to translate the result from read-char
> thru translate-table-for-input, and when not to?

> Could you look thru the calls to read-char in Emacs, and see which
> ones clearly should do this translation, which ones clearly should
> not, and which ones would work right either with or without the
> translation?

As I didn't have a time for such a heavy study, I didn't
respond anything, and the discussion has been inconclusive.

At least, the rule is to trasnalte the result from read-char
if it is compared with the characters in the current buffer.

And, Luc correctly pointed out:

> There is something that has not been pointed out in the summary Handa
> gave, but which I believe may be relevant.  If I understood correctly,
> the problem in question will automatically completely disappear with
> Unicode and hence with Emacs 23.  (Unless I misunderstood.)

I still don't have a time for the above study, but the
problem should be fixed somehow.  So, unless someone else
can take over this matter, I propose again to install this
change.

Index: isearch.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/isearch.el,v
retrieving revision 1.277
diff -c -r1.277 isearch.el
*** isearch.el	30 Nov 2005 22:53:00 -0000	1.277
--- isearch.el	8 Dec 2005 02:21:52 -0000
***************
*** 1809,1814 ****
--- 1809,1816 ----
     ((eq   char ?|)       (isearch-fallback t nil t)))
  
    ;; Append the char to the search string, update the message and re-search.
+   (if (char-table-p translation-table-for-input)
+       (setq char (or (aref translation-table-for-input char) char)))
    (isearch-process-search-string
     (char-to-string char)
     (if (>= char ?\200)

---
Kenichi Handa
handa@m17n.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: AGAIN: Can't isearch 'ö'
  2005-12-08  2:25 AGAIN: Can't isearch 'ö' Kenichi Handa
@ 2005-12-08 16:39 ` Stefan Monnier
  2005-12-09  1:42   ` Richard M. Stallman
  2005-12-08 19:29 ` Richard M. Stallman
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2005-12-08 16:39 UTC (permalink / raw)
  Cc: romain, emacs-devel

> I still don't have a time for the above study, but the
> problem should be fixed somehow.  So, unless someone else
> can take over this matter, I propose again to install this
> change.

My original suggestion is still an alternative, of course:

--- orig/src/keyboard.c
+++ mod/src/keyboard.c
@@ -3203,6 +3183,11 @@
     }
 
  exit:
+  if (NATNUMP (c) && !EQ (prev_event, Qt)
+      && CHAR_VALID_P (XFASTINT (c), Qnil))
+    XSETINT (c, translate_char (Vtranslation_table_for_input,
+                               XFASTINT (c), 0, 0, 0));
+
   RESUME_POLLING;
   RETURN_UNGCPRO (c);
 }

This alternative has the advantage of resolving the problem once and for all
(so we can remove the other pieces of code that do similar translations at
various places in the code, see patch below).
and bringing the behavior a bit closer to what it'll be in Emacs-23.


        Stefan


Index: src/keyboard.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/keyboard.c,v
retrieving revision 1.843
diff -u -r1.843 keyboard.c
--- src/keyboard.c	29 Oct 2005 19:34:58 -0000	1.843
+++ src/keyboard.c	8 Dec 2005 16:36:46 -0000
@@ -569,7 +569,7 @@
 Lisp_Object Qextended_command_history;
 EMACS_TIME timer_check ();
 
-extern Lisp_Object Vhistory_length, Vtranslation_table_for_input;
+extern Lisp_Object Vhistory_length;
 
 extern char *x_get_keysym_name ();
 
@@ -1710,9 +1710,7 @@
 		       && NATNUMP (last_command_char)
 		       && CHAR_VALID_P (XFASTINT (last_command_char), 0))
 		{
-		  unsigned int c
-		    = translate_char (Vtranslation_table_for_input,
-				      XFASTINT (last_command_char), 0, 0, 0);
+		  unsigned int c = XFASTINT (last_command_char);
 		  int value;
 		  if (NILP (Vexecuting_kbd_macro)
 		      && !EQ (minibuf_window, selected_window))
Index: src/cmds.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/cmds.c,v
retrieving revision 1.93
diff -u -r1.93 cmds.c
--- src/cmds.c	7 Aug 2005 12:33:16 -0000	1.93
+++ src/cmds.c	8 Dec 2005 16:36:46 -0000
@@ -43,7 +43,6 @@
 Lisp_Object Vself_insert_face_command;
 
 extern Lisp_Object Qface;
-extern Lisp_Object Vtranslation_table_for_input;
 \f
 DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0,
        doc: /* Return buffer position N characters after (before if N negative) point.  */)
@@ -329,8 +329,7 @@
   if (!INTEGERP (last_command_char))
     bitch_at_user ();
   {
-    int character = translate_char (Vtranslation_table_for_input,
-				    XINT (last_command_char), 0, 0, 0);
+    int character = XINT (last_command_char);
     if (XINT (n) >= 2 && NILP (current_buffer->overwrite_mode))
       {
 	int modified_char = character;
Index: lisp/international/quail.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/international/quail.el,v
retrieving revision 1.145
diff -u -r1.145 quail.el
--- lisp/international/quail.el	28 Oct 2005 05:47:31 -0000	1.145
+++ lisp/international/quail.el	8 Dec 2005 16:36:46 -0000
@@ -1,6 +1,7 @@
 ;;; quail.el --- provides simple input method for multilingual text
 
-;; Copyright (C) 1997, 1998, 2000, 2001, 2002  Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1998, 2000, 2001, 2002, 2005
+;;   Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2003, 2004
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
@@ -1277,14 +1278,7 @@
 Do so while interleaving with the following special events:
 \(compose-last-chars LEN COMPONENTS)
 \(quail-advice INPUT-STRING)"
-  (let* ((events (mapcar
-		  (lambda (c)
-		    ;; This gives us the chance to unify on input
-		    ;; (e.g. using ucs-tables.el).
-		    (or (and translation-table-for-input
-			     (aref translation-table-for-input c))
-			c))
-		  str))
+  (let* ((events (mapcar 'identity str))
 	 (len (length str))
 	 (idx len)
 	 composition from to)
@@ -3009,5 +3003,5 @@
 ;;
 (provide 'quail)
 
-;;; arch-tag: 46d7db54-5467-42c4-a2a9-53ca90a1e886
+;; arch-tag: 46d7db54-5467-42c4-a2a9-53ca90a1e886
 ;;; quail.el ends here

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: AGAIN: Can't isearch 'ö'
  2005-12-08  2:25 AGAIN: Can't isearch 'ö' Kenichi Handa
  2005-12-08 16:39 ` Stefan Monnier
@ 2005-12-08 19:29 ` Richard M. Stallman
  2005-12-08 22:18   ` Stefan Monnier
  2005-12-10  1:15   ` Kenichi Handa
  1 sibling, 2 replies; 9+ messages in thread
From: Richard M. Stallman @ 2005-12-08 19:29 UTC (permalink / raw)
  Cc: romain, emacs-devel

    At least, the rule is to trasnalte the result from read-char
    if it is compared with the characters in the current buffer.

That seems like a good proposal.  If we follow that proposal, we would
want to change M-z too.  Could you please change isearch and M-z?

Can anyone thing of any other command that calls for such a change?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: AGAIN: Can't isearch 'ö'
  2005-12-08 19:29 ` Richard M. Stallman
@ 2005-12-08 22:18   ` Stefan Monnier
  2005-12-09  1:12     ` Kenichi Handa
  2005-12-10  1:15   ` Kenichi Handa
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2005-12-08 22:18 UTC (permalink / raw)
  Cc: romain, emacs-devel, Kenichi Handa

>     At least, the rule is to trasnalte the result from read-char
>     if it is compared with the characters in the current buffer.

> That seems like a good proposal.  If we follow that proposal, we would
> want to change M-z too.  Could you please change isearch and M-z?

> Can anyone think of any other command that calls for such a change?

My suggested patch takes care of all of them, without even having to think
of any.


        Stefan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: AGAIN: Can't isearch 'ö'
  2005-12-08 22:18   ` Stefan Monnier
@ 2005-12-09  1:12     ` Kenichi Handa
  2005-12-09 15:04       ` Richard M. Stallman
  0 siblings, 1 reply; 9+ messages in thread
From: Kenichi Handa @ 2005-12-09  1:12 UTC (permalink / raw)
  Cc: romain, rms, emacs-devel

In article <87hd9jcjwr.fsf-monnier+emacs@gnu.org>, Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>      At least, the rule is to trasnalte the result from read-char
>>      if it is compared with the characters in the current buffer.

>>  That seems like a good proposal.  If we follow that proposal, we would
>>  want to change M-z too.  Could you please change isearch and M-z?

>>  Can anyone think of any other command that calls for such a change?

> My suggested patch takes care of all of them, without even having to think
> of any.

But, it takes care even a case that it shouldn't take care.
I can't confirm that there's no such case.

---
Kenichi Handa
handa@m17n.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: AGAIN: Can't isearch 'ö'
  2005-12-08 16:39 ` Stefan Monnier
@ 2005-12-09  1:42   ` Richard M. Stallman
  0 siblings, 0 replies; 9+ messages in thread
From: Richard M. Stallman @ 2005-12-09  1:42 UTC (permalink / raw)
  Cc: romain, emacs-devel, handa

    My original suggestion is still an alternative, of course:

I think that is too radical to be done without a careful study of what
is really right.  We should not make such a radical change now.
I've chosen to go with Handa's more cautious change.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: AGAIN: Can't isearch 'ö'
  2005-12-09  1:12     ` Kenichi Handa
@ 2005-12-09 15:04       ` Richard M. Stallman
  0 siblings, 0 replies; 9+ messages in thread
From: Richard M. Stallman @ 2005-12-09 15:04 UTC (permalink / raw)
  Cc: romain, monnier, emacs-devel

    > My suggested patch takes care of all of them, without even having to think
    > of any.

    But, it takes care even a case that it shouldn't take care.
    I can't confirm that there's no such case.

I have stated my decision about this.
Handa-san, please install your patch.
Every one else, please stop arguing for bigger changes.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: AGAIN: Can't isearch 'ö'
  2005-12-08 19:29 ` Richard M. Stallman
  2005-12-08 22:18   ` Stefan Monnier
@ 2005-12-10  1:15   ` Kenichi Handa
  2005-12-11  0:59     ` Juri Linkov
  1 sibling, 1 reply; 9+ messages in thread
From: Kenichi Handa @ 2005-12-10  1:15 UTC (permalink / raw)
  Cc: romain, emacs-devel

In article <E1EkRSL-0001c9-7o@fencepost.gnu.org>, "Richard M. Stallman" <rms@gnu.org> writes:

>     At least, the rule is to trasnalte the result from read-char
>     if it is compared with the characters in the current buffer.

> That seems like a good proposal.  If we follow that proposal, we would
> want to change M-z too.  Could you please change isearch and M-z?

done.

---
Kenichi Handa
handa@m17n.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: AGAIN: Can't isearch 'ö'
  2005-12-10  1:15   ` Kenichi Handa
@ 2005-12-11  0:59     ` Juri Linkov
  0 siblings, 0 replies; 9+ messages in thread
From: Juri Linkov @ 2005-12-11  0:59 UTC (permalink / raw)
  Cc: rms, emacs-devel

>>     At least, the rule is to trasnalte the result from read-char
>>     if it is compared with the characters in the current buffer.
>
>> That seems like a good proposal.  If we follow that proposal, we would
>> want to change M-z too.  Could you please change isearch and M-z?
>
> done.

I don't know if this is the same problem or not, but there is a problem
with similar behavior, and this fix doesn't affect it.  The problem is
the following: after isearching in a buffer in cp1251 and typing letters
using a cyrillic input method, then after switching to another buffer
in koi8, isearch doesn't work.  It can't find anything not only for
a search string repeated by `C-s C-s', but also a search string newly
typed using a cyrillic input method.

There is one method of fixing it in the running Emacs session:
after killing the buffer ` *Minibuf-1*' with `C-x b *Minibuf-1* RET
C-x k RET' isearch works again in the koi8 buffer.

I guess this difference is because koi8 buffers use `cyrillic-iso8859-5'
charset, but cp1251 buffers use `mule-unicode-0100-24ff'.  Is there a
simple way to fix this before the next release?

BTW, `C-u C-x =' doesn't say how to type characters with an input
method in cp1251 buffers, i.e. the line "to input: type ..." is
missing after typing `C-u C-x =' on characters in cp1251 buffers, but
this line is displyed correctly for characters in koi8 buffers.

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-12-11  0:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-08  2:25 AGAIN: Can't isearch 'ö' Kenichi Handa
2005-12-08 16:39 ` Stefan Monnier
2005-12-09  1:42   ` Richard M. Stallman
2005-12-08 19:29 ` Richard M. Stallman
2005-12-08 22:18   ` Stefan Monnier
2005-12-09  1:12     ` Kenichi Handa
2005-12-09 15:04       ` Richard M. Stallman
2005-12-10  1:15   ` Kenichi Handa
2005-12-11  0:59     ` Juri Linkov

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).