comparison lisp/isearch.el @ 1169:a40b54fcb2ff

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Sat, 19 Sep 1992 19:21:09 +0000
parents 7d6e0669b3dc
children 5f4300ccc93f
comparison
equal deleted inserted replaced
1168:2b07af77d7ec 1169:a40b54fcb2ff
136 136
137 (defconst isearch-frames-exist (fboundp 'select-frame)) ;; emacs 19 137 (defconst isearch-frames-exist (fboundp 'select-frame)) ;; emacs 19
138 (defconst isearch-pre-command-hook-exists (boundp 'pre-command-hook)) ;; lemacs 138 (defconst isearch-pre-command-hook-exists (boundp 'pre-command-hook)) ;; lemacs
139 (defconst isearch-event-data-type nil) ;; lemacs 139 (defconst isearch-event-data-type nil) ;; lemacs
140 140
141
142 ;;;=========================================================================
143 ;;; The following, defined in loaddefs.el, are still used with isearch-mode.
144
145 (defvar search-last-string ""
146 "Last string search for by a search command.
147 This does not include direct calls to the primitive search functions,
148 and does not include searches that are aborted.")
149
150 (defvar search-last-regexp ""
151 "Last string searched for by a regexp search command.
152 This does not include direct calls to the primitive search functions,
153 and does not include searches that are aborted.")
154
155 (defconst search-exit-option t 141 (defconst search-exit-option t
156 "Non-nil means random control characters terminate incremental search.") 142 "*Non-nil means random control characters terminate incremental search.")
157 143
158 (defvar search-slow-window-lines 1 144 (defvar search-slow-window-lines 1
159 "*Number of lines in slow search display windows. 145 "*Number of lines in slow search display windows.
160 These are the short windows used during incremental search on slow terminals. 146 These are the short windows used during incremental search on slow terminals.
161 Negative means put the slow search window at the top (normally it's at bottom) 147 Negative means put the slow search window at the top (normally it's at bottom)
183 169
184 (defconst search-whitespace-regexp "\\s-+" 170 (defconst search-whitespace-regexp "\\s-+"
185 "*If non-nil, regular expression to match a sequence of whitespace chars. 171 "*If non-nil, regular expression to match a sequence of whitespace chars.
186 You might want to use something like \"[ \\t\\r\\n]+\" instead.") 172 You might want to use something like \"[ \\t\\r\\n]+\" instead.")
187 173
174 ;; I removed the * from the doc string because highlighting is not
175 ;; currently a clean thing to do. Once highlighting is made clean,
176 ;; this feature can be re-enabled and advertised.
188 (defvar search-highlight nil 177 (defvar search-highlight nil
189 "*Whether isearch and query-replace should highlight the text which 178 "Whether isearch and query-replace should highlight the text which
190 currently matches the search-string.") 179 currently matches the search-string.")
191 180
192 181
193 (defvar isearch-mode-hook nil 182 (defvar isearch-mode-hook nil
194 "Function(s) to call after starting up an incremental search.") 183 "Function(s) to call after starting up an incremental search.")
590 (set-buffer-modified-p (buffer-modified-p)) ;; update modeline 579 (set-buffer-modified-p (buffer-modified-p)) ;; update modeline
591 580
592 (if (> (length isearch-string) 0) 581 (if (> (length isearch-string) 0)
593 ;; Update the ring data. 582 ;; Update the ring data.
594 (if isearch-regexp 583 (if isearch-regexp
595 (if (and regexp-search-ring 584 (if (or (null regexp-search-ring)
596 (not (string= isearch-string (car regexp-search-ring)))) 585 (not (string= isearch-string (car regexp-search-ring))))
597 (progn 586 (progn
598 (setq regexp-search-ring 587 (setq regexp-search-ring
599 (cons isearch-string regexp-search-ring)) 588 (cons isearch-string regexp-search-ring))
600 (if (> (length regexp-search-ring) regexp-search-ring-max) 589 (if (> (length regexp-search-ring) regexp-search-ring-max)
601 (setcdr (nthcdr (1- search-ring-max) regexp-search-ring) 590 (setcdr (nthcdr (1- search-ring-max) regexp-search-ring)
602 nil)))) 591 nil))))
603 (if (and search-ring 592 (if (or (null search-ring)
604 (not (string= isearch-string (car search-ring)))) 593 (not (string= isearch-string (car search-ring))))
605 (progn 594 (progn
606 (setq search-ring (cons isearch-string search-ring)) 595 (setq search-ring (cons isearch-string search-ring))
607 (if (> (length search-ring) search-ring-max) 596 (if (> (length search-ring) search-ring-max)
608 (setcdr (nthcdr (1- search-ring-max) search-ring) nil)))))) 597 (setcdr (nthcdr (1- search-ring-max) search-ring) nil))))))
609 598
755 isearch-forward isearch-new-forward 744 isearch-forward isearch-new-forward
756 isearch-word isearch-new-word)) 745 isearch-word isearch-new-word))
757 746
758 ;; Empty isearch-string means use default. 747 ;; Empty isearch-string means use default.
759 (if (= 0 (length isearch-string)) 748 (if (= 0 (length isearch-string))
760 (setq isearch-string (if isearch-regexp search-last-regexp 749 (setq isearch-string (car (if isearch-regexp regexp-search-ring
761 search-last-string)) 750 search-ring)))
762 ;; Set last search string now so it is set even if we fail. 751 ;; This used to set the last search string,
763 (if search-last-regexp 752 ;; but I think it is not right to do that here.
764 (setq search-last-regexp isearch-string) 753 ;; Only the string actually used should be saved.
765 (setq search-last-string isearch-string))) 754 )
766 755
767 ;; Reinvoke the pending search. 756 ;; Reinvoke the pending search.
768 (isearch-push-state) 757 (isearch-push-state)
769 (isearch-search) 758 (isearch-search)
770 (isearch-update) 759 (isearch-update)