comparison lisp/isearch.el @ 30476:26fe451fc5f7

(isearch-resume): New function. (isearch-done): Add something to command-history to resume the search. (isearch-yank-line, isearch-yank-word): Use buffer-substring-no-properties instead of buffer-substring.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 26 Jul 2000 14:48:00 +0000
parents b614192b22ce
children 9b1d5a50bddd
comparison
equal deleted inserted replaced
30475:fe219c6d2ba2 30476:26fe451fc5f7
623 ;; We must prevent the point moving to the end of composition when a 623 ;; We must prevent the point moving to the end of composition when a
624 ;; part of the composition has just been searched. 624 ;; part of the composition has just been searched.
625 (setq disable-point-adjustment t)) 625 (setq disable-point-adjustment t))
626 626
627 (defun isearch-done (&optional nopush edit) 627 (defun isearch-done (&optional nopush edit)
628 (let ((command `(isearch-resume ,isearch-string ,isearch-regexp
629 ,isearch-word ,isearch-forward
630 ,isearch-message
631 ,isearch-case-fold-search)))
632 (unless (equal (car command-history) command)
633 (setq command-history (cons command command-history))))
634
628 (remove-hook 'mouse-leave-buffer-hook 'isearch-done) 635 (remove-hook 'mouse-leave-buffer-hook 'isearch-done)
629 ;; Called by all commands that terminate isearch-mode. 636 ;; Called by all commands that terminate isearch-mode.
630 ;; If NOPUSH is non-nil, we don't push the string on the search ring. 637 ;; If NOPUSH is non-nil, we don't push the string on the search ring.
631 (setq overriding-terminal-local-map nil) 638 (setq overriding-terminal-local-map nil)
632 ;; (setq pre-command-hook isearch-old-pre-command-hook) ; for lemacs 639 ;; (setq pre-command-hook isearch-old-pre-command-hook) ; for lemacs
1028 (interactive) 1035 (interactive)
1029 (isearch-yank-string 1036 (isearch-yank-string
1030 (save-excursion 1037 (save-excursion
1031 (and (not isearch-forward) isearch-other-end 1038 (and (not isearch-forward) isearch-other-end
1032 (goto-char isearch-other-end)) 1039 (goto-char isearch-other-end))
1033 (buffer-substring (point) (progn (forward-word 1) (point)))))) 1040 (buffer-substring-no-properties
1041 (point) (progn (forward-word 1) (point))))))
1034 1042
1035 (defun isearch-yank-line () 1043 (defun isearch-yank-line ()
1036 "Pull rest of line from buffer into search string." 1044 "Pull rest of line from buffer into search string."
1037 (interactive) 1045 (interactive)
1038 (isearch-yank-string 1046 (isearch-yank-string
1039 (save-excursion 1047 (save-excursion
1040 (and (not isearch-forward) isearch-other-end 1048 (and (not isearch-forward) isearch-other-end
1041 (goto-char isearch-other-end)) 1049 (goto-char isearch-other-end))
1042 (buffer-substring (point) (line-end-position))))) 1050 (buffer-substring-no-properties (point) (line-end-position)))))
1043 1051
1044 1052
1045 (defun isearch-search-and-update () 1053 (defun isearch-search-and-update ()
1046 ;; Do the search and update the display. 1054 ;; Do the search and update the display.
1047 (if (and (not isearch-success) 1055 (if (and (not isearch-success)
1936 'isearch-lazy-highlight-update)) 1944 'isearch-lazy-highlight-update))
1937 (if isearch-forward 1945 (if isearch-forward
1938 (setq isearch-lazy-highlight-end (point-min)) 1946 (setq isearch-lazy-highlight-end (point-min))
1939 (setq isearch-lazy-highlight-start (point-max)))))))))) 1947 (setq isearch-lazy-highlight-start (point-max))))))))))
1940 1948
1949 (defun isearch-resume (search regexp word forward message case-fold)
1950 "Resume an incremental search.
1951 SEARCH is the string or regexp searched for.
1952 REGEXP non-nil means the resumed search was a regexp search.
1953 WORD non-nil means resume a word search.
1954 FORWARD non-nil means resume a forward search.
1955 MESSAGE is the echo-area message recorded for the search resumed.
1956 CASE-FOLD non-nil means the search was case-insensitive."
1957 (isearch-mode forward regexp nil nil word)
1958 (setq isearch-string search
1959 isearch-message message
1960 isearch-case-fold-search case-fold)
1961 (isearch-search))
1962
1941 ;;; isearch.el ends here 1963 ;;; isearch.el ends here