comparison lisp/isearch-mode.el @ 272:c5d627a313b1 r21-0b34

Import from CVS: tag r21-0b34
author cvs
date Mon, 13 Aug 2007 10:28:48 +0200
parents 157b30c96d03
children afd57c14dfc8
comparison
equal deleted inserted replaced
271:c7b7086b0a39 272:c5d627a313b1
281 (defvar isearch-success t) ; Searching is currently successful. 281 (defvar isearch-success t) ; Searching is currently successful.
282 (defvar isearch-invalid-regexp nil) ; Regexp not well formed. 282 (defvar isearch-invalid-regexp nil) ; Regexp not well formed.
283 (defvar isearch-other-end nil) ; Start (end) of match if forward (backward). 283 (defvar isearch-other-end nil) ; Start (end) of match if forward (backward).
284 (defvar isearch-wrapped nil) ; Searching restarted from the top (bottom). 284 (defvar isearch-wrapped nil) ; Searching restarted from the top (bottom).
285 (defvar isearch-barrier 0) 285 (defvar isearch-barrier 0)
286 (defvar isearch-just-started nil)
286 (defvar isearch-buffer nil) ; the buffer we've frobbed the keymap of 287 (defvar isearch-buffer nil) ; the buffer we've frobbed the keymap of
287 288
288 (defvar isearch-case-fold-search nil) 289 (defvar isearch-case-fold-search nil)
289 290
290 (defvar isearch-adjusted nil) 291 (defvar isearch-adjusted nil)
451 search-slow-speed) 452 search-slow-speed)
452 (> (window-height) 453 (> (window-height)
453 (* 4 search-slow-window-lines))) 454 (* 4 search-slow-window-lines)))
454 isearch-other-end nil 455 isearch-other-end nil
455 isearch-small-window nil 456 isearch-small-window nil
457 isearch-just-started t
456 458
457 isearch-opoint (point) 459 isearch-opoint (point)
458 isearch-window-configuration (current-window-configuration) 460 isearch-window-configuration (current-window-configuration)
459 461
460 ;; #### - don't do this statically: isearch-mode must be FIRST in 462 ;; #### - don't do this statically: isearch-mode must be FIRST in
800 (setq isearch-wrapped t)))) 802 (setq isearch-wrapped t))))
801 ;; C-s in reverse or C-r in forward, change direction. 803 ;; C-s in reverse or C-r in forward, change direction.
802 (setq isearch-forward (not isearch-forward))) 804 (setq isearch-forward (not isearch-forward)))
803 805
804 (setq isearch-barrier (point)) ; For subsequent \| if regexp. 806 (setq isearch-barrier (point)) ; For subsequent \| if regexp.
805 (setq isearch-success t) 807 (if (equal isearch-string "")
806 (or (equal isearch-string "") 808 (setq isearch-success t)
809 (if (and (equal (match-end 0) (match-beginning 0))
810 isearch-success
811 (not isearch-just-started))
807 ;; If repeating a search that found 812 ;; If repeating a search that found
808 ;; an empty string, ensure we advance. 813 ;; an empty string, ensure we advance.
809 (if (equal (match-end 0) (match-beginning 0)) 814 (if (if isearch-forward (eobp) (bobp))
810 (if (if isearch-forward (eobp) (bobp)) 815 ;; nowhere to advance to, so fail (and wrap next time)
811 ;; nowhere to advance to, so fail (and wrap next time) 816 (progn
812 (progn 817 (setq isearch-success nil)
813 (setq isearch-success nil) 818 (and executing-kbd-macro
814 (and executing-kbd-macro 819 (not defining-kbd-macro)
815 (not defining-kbd-macro) 820 (isearch-done))
816 (isearch-done)) 821 (ding nil 'isearch-failed))
817 (ding nil 'isearch-failed)) 822 (forward-char (if isearch-forward 1 -1))
818 (forward-char (if isearch-forward 1 -1)) 823 (isearch-search))
819 (isearch-search)) 824 (isearch-search)))
820 (isearch-search)))
821 (isearch-push-state) 825 (isearch-push-state)
822 (isearch-update)) 826 (isearch-update))
823 827
824 (defun isearch-repeat-forward () 828 (defun isearch-repeat-forward ()
825 "Repeat incremental search forwards." 829 "Repeat incremental search forwards."
1507 (if isearch-forward 1511 (if isearch-forward
1508 're-search-forward 're-search-backward)) 1512 're-search-forward 're-search-backward))
1509 (t 1513 (t
1510 (if isearch-forward 'search-forward 'search-backward))) 1514 (if isearch-forward 'search-forward 'search-backward)))
1511 isearch-string nil t)) 1515 isearch-string nil t))
1516 (setq isearch-just-started nil)
1512 (if isearch-success 1517 (if isearch-success
1513 (setq isearch-other-end 1518 (setq isearch-other-end
1514 (if isearch-forward (match-beginning 0) (match-end 0))))) 1519 (if isearch-forward (match-beginning 0) (match-end 0)))))
1515 1520
1516 (quit (setq unread-command-event (character-to-event (quit-char))) 1521 (quit (setq unread-command-event (character-to-event (quit-char)))