emacs-devel
[Top][All Lists]
Advanced

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

Re: weird bug with `Russian-computer'?


From: Juri Linkov
Subject: Re: weird bug with `Russian-computer'?
Date: Tue, 12 Jul 2005 09:56:05 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

> Any progress on this?  (Just bugging you around so that we don't leave
> this out of the release accidentally; it might happen any other year, you
> know.)

Since nobody objected to removing key bindings for `?', `*', `}', `|',
below is a patch that changes isearch.el to process special regexp
characters after the input is completed and before putting characters
into the search string.

Index: lisp/isearch.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/isearch.el,v
retrieving revision 1.264
diff -c -r1.264 isearch.el
*** lisp/isearch.el     4 Jul 2005 23:08:56 -0000       1.264
--- lisp/isearch.el     12 Jul 2005 06:52:59 -0000
***************
*** 356,368 ****
      (define-key map "\M-\C-y" 'isearch-yank-char)
      (define-key map    "\C-y" 'isearch-yank-line)
  
-     ;; Define keys for regexp chars * ? } |.
-     ;; Nothing special for + because it matches at least once.
-     (define-key map "*" 'isearch-*-char)
-     (define-key map "?" 'isearch-*-char)
-     (define-key map "}" 'isearch-}-char)
-     (define-key map "|" 'isearch-|-char)
- 
      ;; Turned off because I find I expect to get the global definition--rms.
      ;; ;; Instead bind C-h to special help command for isearch-mode.
      ;; (define-key map "\C-h" 'isearch-mode-help)
--- 361,366 ----
***************
*** 1457,1482 ****
            (goto-char (if isearch-forward
                           (max last-other-end isearch-barrier)
                         (min last-other-end isearch-barrier)))
!           (setq isearch-adjusted t))))))
!   (isearch-process-search-char last-command-char))
! 
! ;; * and ? are special when not preceded by \.
! (defun isearch-*-char ()
!   "Maybe back up to handle * and ? specially in regexps."
!   (interactive)
!   (isearch-fallback nil))
! 
! ;; } is special when it is preceded by \.
! (defun isearch-}-char ()
!   "Handle \\} specially in regexps."
!   (interactive)
!   (isearch-fallback t t))
! 
! ;; | is special when it is preceded by \.
! (defun isearch-|-char ()
!   "If in regexp search, jump to the barrier unless in a group."
!   (interactive)
!   (isearch-fallback t nil t))
  
  (defun isearch-unread-key-sequence (keylist)
    "Unread the given key-sequence KEYLIST.
--- 1460,1466 ----
            (goto-char (if isearch-forward
                           (max last-other-end isearch-barrier)
                         (min last-other-end isearch-barrier)))
!           (setq isearch-adjusted t)))))))
  
  (defun isearch-unread-key-sequence (keylist)
    "Unread the given key-sequence KEYLIST.
***************
*** 1796,1801 ****
--- 1780,1793 ----
        (isearch-process-search-char char)))))
  
  (defun isearch-process-search-char (char)
+   ;; * and ? are special in regexps when not preceded by \.
+   ;; } and | are special in regexps when preceded by \.
+   ;; Nothing special for + because it matches at least once.
+   (cond
+    ((memq char '(?* ??)) (isearch-fallback nil))
+    ((eq   char ?\})      (isearch-fallback t t))
+    ((eq   char ?|)       (isearch-fallback t nil t)))
+ 
    ;; Append the char to the search string, update the message and re-search.
    (isearch-process-search-string
     (char-to-string char)

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





reply via email to

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