GNU bug report logs - #4894
23.1; emacs ignores number characters in incremental search in keyboard macros

Previous Next

Package: emacs;

Reported by: Petr Machata <pmachata <at> gmail.com>

Date: Mon, 9 Nov 2009 18:00:07 UTC

Severity: normal

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Kenichi Handa <handa <at> m17n.org>
Cc: 4894 <at> debbugs.gnu.org, Petr Machata <pmachata <at> gmail.com>
Subject: bug#4894: 23.1; emacs ignores number characters in incremental search in keyboard macros
Date: Wed, 11 Nov 2009 13:32:05 -0500
>> Do the following to record a macro involving an incremental search
>> looking for a string "x00x":
>> 
>> M-x kmacro-start-macro C-s x 0 0 x M-x kmacro-end-macro
>> 
>> Observe that the macro doesn't include the 0 characters at all:

> Do you type these zeroes with a numpad?  I can reproduce this bug when
> zeroes are typed with <kp-0>, so the last macro doesn't contain zeroes.

> The reason is an intentional call to `cancel-kbd-macro-events' in the
> first branch of `cond' in `isearch-other-meta-char'.  I don't know why
> this is needed.  CVS logs show that this line was added at 1995-08-10.

Actually, the need for cancel-kbd-macro-events is explained in
the comment.  The problem is that after cancelling the <kp-0> we should
add the ?0 replacement.  That should normally be done by isearch-unread,
but for printing char, we don't call that function any more.

I.e. the problem was introduced by the change below.  Handa, can you
explain why we need this?  Maybe it was needed at the time but not
any more?


        Stefan


committer: handa
branch nick: HEAD
timestamp: Thu 2000-06-01 12:22:31 +0000
message:
  (isearch-update): Set disable-point-adjustment to t
  to prevent the point moving to the end of a composition when a
  part of a composition is searched.
  (isearch-other-meta-char): If the key invoking this command can be
  mapped by function-key-map to a printing char, call
  isearch-process-search-char directly.
------------------------------------------------------------


=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2000-05-31 09:49:22 +0000
+++ lisp/isearch.el	2000-06-01 12:22:31 +0000
@@ -619,7 +619,10 @@
   (setq ;; quit-flag nil  not for isearch-mode
    isearch-adjusted nil
    isearch-yank-flag nil)
-  (isearch-lazy-highlight-new-loop))
+  (isearch-lazy-highlight-new-loop)
+  ;; We must prevent the point moving to the end of composition when a
+  ;; part of the composition has just been searched.
+  (setq disable-point-adjustment t))
 
 (defun isearch-done (&optional nopush edit)
   (remove-hook 'mouse-leave-buffer-hook 'isearch-done)
@@ -1150,8 +1153,22 @@
 	       (progn 
 		 (isearch-done)
 		 (apply 'isearch-unread keylist))
-	     (apply 'isearch-unread
-		    (listify-key-sequence (lookup-key function-key-map key)))))
+	     (setq keylist
+		   (listify-key-sequence (lookup-key function-key-map key)))
+	     (while keylist
+	       (setq key (car keylist))
+	       ;; If KEY is a printing char, we handle it here
+	       ;; directly to avoid the input method and keyboard
+	       ;; coding system translating it.
+	       (if (and (integerp key)
+			(>= key ?\ ) (< key 256))
+		   (progn
+		     (isearch-process-search-char key)
+		     (setq keylist (cdr keylist)))
+		 ;; As the remaining keys in KEYLIST can't be handled
+		 ;; here, we must reread them.
+		 (apply 'isearch-unread keylist)
+		 (setq keylist nil)))))
 	  (
 	   ;; Handle an undefined shifted control character
 	   ;; by downshifting it if that makes it defined.




This bug report was last modified 12 years and 290 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.