aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-07-16 19:13:30 +0000
committerRichard M. Stallman2005-07-16 19:13:30 +0000
commit87e976736525a9cb2ce001d15ce39295c500fbbf (patch)
tree163ff1e6cff88e09f81baf75d53bec6b34bf87ec
parentad50a502a16b5cbc96c6a83565ae29abca60782e (diff)
downloademacs-87e976736525a9cb2ce001d15ce39295c500fbbf.tar.gz
emacs-87e976736525a9cb2ce001d15ce39295c500fbbf.zip
(isearch-mode-end-hook-quit): New variable.
(isearch-done): Bind it. (isearch-mode-end-hook): Doc fix.
-rw-r--r--lisp/isearch.el16
1 files changed, 14 insertions, 2 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 58c8fd5829a..44d7bccb8e6 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -154,7 +154,12 @@ command history."
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.
158When these functions are called, `isearch-mode-end-hook-quit'
159is 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.
@@ -744,6 +749,12 @@ is treated as a regexp. See \\[isearch-forward] for more info."
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.
753For successful search, pass no args.
754For a failing search, NOPUSH is t.
755For going to the minibuffer to edit the search string,
756NOPUSH 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
@@ -795,7 +806,8 @@ is treated as a regexp. See \\[isearch-forward] for more info."
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.