Mercurial > emacs
comparison lisp/isearch.el @ 64399:d41de3ff06c8
(isearch-mode-end-hook-quit): New variable.
(isearch-done): Bind it.
(isearch-mode-end-hook): Doc fix.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 16 Jul 2005 19:13:30 +0000 |
parents | 6fb026ad601f |
children | 8c591f014cf5 |
comparison
equal
deleted
inserted
replaced
64398:de27914c814e | 64399:d41de3ff06c8 |
---|---|
152 | 152 |
153 (defvar isearch-mode-hook nil | 153 (defvar isearch-mode-hook nil |
154 "Function(s) to call after starting up an incremental search.") | 154 "Function(s) to call after starting up an incremental search.") |
155 | 155 |
156 (defvar isearch-mode-end-hook nil | 156 (defvar isearch-mode-end-hook nil |
157 "Function(s) to call after terminating an incremental search.") | 157 "Function(s) to call after terminating an incremental search. |
158 When these functions are called, `isearch-mode-end-hook-quit' | |
159 is non-nil if the user quit the search.") | |
160 | |
161 (defvar isearch-mode-end-hook-quit nil | |
162 "Non-nil while running `isearch-mode-end-hook' if user quit the search.") | |
158 | 163 |
159 (defvar isearch-wrap-function nil | 164 (defvar isearch-wrap-function nil |
160 "Function to call to wrap the search when search is failed. | 165 "Function to call to wrap the search when search is failed. |
161 If nil, move point to the beginning of the buffer for a forward search, | 166 If nil, move point to the beginning of the buffer for a forward search, |
162 or to the end of the buffer for a backward search.") | 167 or to the end of the buffer for a backward search.") |
742 ;; We must prevent the point moving to the end of composition when a | 747 ;; We must prevent the point moving to the end of composition when a |
743 ;; part of the composition has just been searched. | 748 ;; part of the composition has just been searched. |
744 (setq disable-point-adjustment t)) | 749 (setq disable-point-adjustment t)) |
745 | 750 |
746 (defun isearch-done (&optional nopush edit) | 751 (defun isearch-done (&optional nopush edit) |
752 "Exit Isearch mode. | |
753 For successful search, pass no args. | |
754 For a failing search, NOPUSH is t. | |
755 For going to the minibuffer to edit the search string, | |
756 NOPUSH is t and EDIT is t." | |
757 | |
747 (if isearch-resume-in-command-history | 758 (if isearch-resume-in-command-history |
748 (let ((command `(isearch-resume ,isearch-string ,isearch-regexp | 759 (let ((command `(isearch-resume ,isearch-string ,isearch-regexp |
749 ,isearch-word ,isearch-forward | 760 ,isearch-word ,isearch-forward |
750 ,isearch-message | 761 ,isearch-message |
751 ',isearch-case-fold-search))) | 762 ',isearch-case-fold-search))) |
793 | 804 |
794 (if (and (> (length isearch-string) 0) (not nopush)) | 805 (if (and (> (length isearch-string) 0) (not nopush)) |
795 ;; Update the ring data. | 806 ;; Update the ring data. |
796 (isearch-update-ring isearch-string isearch-regexp)) | 807 (isearch-update-ring isearch-string isearch-regexp)) |
797 | 808 |
798 (run-hooks 'isearch-mode-end-hook) | 809 (let ((isearch-mode-end-hook-quit (and nopush (not edit)))) |
810 (run-hooks 'isearch-mode-end-hook)) | |
799 | 811 |
800 ;; If there was movement, mark the starting position. | 812 ;; If there was movement, mark the starting position. |
801 ;; Maybe should test difference between and set mark iff > threshold. | 813 ;; Maybe should test difference between and set mark iff > threshold. |
802 (if (/= (point) isearch-opoint) | 814 (if (/= (point) isearch-opoint) |
803 (or (and transient-mark-mode mark-active) | 815 (or (and transient-mark-mode mark-active) |