[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/isearch.el
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/isearch.el |
Date: |
Wed, 01 Sep 2004 16:37:18 -0400 |
Index: emacs/lisp/isearch.el
diff -c emacs/lisp/isearch.el:1.235 emacs/lisp/isearch.el:1.236
*** emacs/lisp/isearch.el:1.235 Wed Sep 1 19:42:58 2004
--- emacs/lisp/isearch.el Wed Sep 1 20:32:13 2004
***************
*** 57,66 ****
;; keep the behavior. No point in forcing nonincremental search until
;; the last possible moment.
- ;; TODO
- ;; - Integrate the emacs 19 generalized command history.
- ;; - Hooks and options for failed search.
-
;;; Code:
--- 57,62 ----
***************
*** 161,166 ****
--- 157,171 ----
(defvar isearch-mode-end-hook nil
"Function(s) to call after terminating an incremental search.")
+ (defvar isearch-wrap-function nil
+ "Function to call to wrap the search when search is failed.
+ If nil, move point to the beginning of the buffer for a forward search,
+ or to the end of the buffer for a backward search.")
+
+ (defvar isearch-push-state-function nil
+ "Function to save a function restoring the mode-specific isearch state
+ to the search status stack.")
+
;; Search ring.
(defvar search-ring nil
***************
*** 775,780 ****
--- 780,788 ----
(defsubst isearch-case-fold-search-state (frame)
"Return the case-folding flag in FRAME."
(aref frame 11))
+ (defsubst isearch-pop-fun-state (frame)
+ "Return the function restoring the mode-specific isearch state in FRAME."
+ (aref frame 12))
(defun isearch-top-state ()
(let ((cmd (car isearch-cmds)))
***************
*** 789,794 ****
--- 797,804 ----
isearch-barrier (isearch-barrier-state cmd)
isearch-within-brackets (isearch-within-brackets-state cmd)
isearch-case-fold-search (isearch-case-fold-search-state cmd))
+ (if (functionp (isearch-pop-fun-state cmd))
+ (funcall (isearch-pop-fun-state cmd) cmd))
(goto-char (isearch-point-state cmd))))
(defun isearch-pop-state ()
***************
*** 801,807 ****
isearch-success isearch-forward isearch-other-end
isearch-word
isearch-invalid-regexp isearch-wrapped isearch-barrier
! isearch-within-brackets isearch-case-fold-search)
isearch-cmds)))
--- 811,819 ----
isearch-success isearch-forward isearch-other-end
isearch-word
isearch-invalid-regexp isearch-wrapped isearch-barrier
! isearch-within-brackets isearch-case-fold-search
! (if isearch-push-state-function
! (funcall isearch-push-state-function)))
isearch-cmds)))
***************
*** 987,996 ****
(defun isearch-cancel ()
"Terminate the search and go back to the starting point."
(interactive)
(goto-char isearch-opoint)
! (isearch-done t)
(isearch-clean-overlays)
! (signal 'quit nil)) ; and pass on quit signal
(defun isearch-abort ()
"Abort incremental search mode if searching is successful, signaling quit.
--- 999,1011 ----
(defun isearch-cancel ()
"Terminate the search and go back to the starting point."
(interactive)
+ (if (functionp (isearch-pop-fun-state (car (last isearch-cmds))))
+ (funcall (isearch-pop-fun-state (car (last isearch-cmds)))
+ (car (last isearch-cmds))))
(goto-char isearch-opoint)
! (isearch-done t) ; exit isearch
(isearch-clean-overlays)
! (signal 'quit nil)) ; and pass on quit signal
(defun isearch-abort ()
"Abort incremental search mode if searching is successful, signaling quit.
***************
*** 1002,1012 ****
(if isearch-success
;; If search is successful, move back to starting point
;; and really do quit.
! (progn (goto-char isearch-opoint)
! (setq isearch-success nil)
! (isearch-done t) ; exit isearch
! (isearch-clean-overlays)
! (signal 'quit nil)) ; and pass on quit signal
;; If search is failing, or has an incomplete regexp,
;; rub out until it is once more successful.
(while (or (not isearch-success) isearch-invalid-regexp)
--- 1017,1025 ----
(if isearch-success
;; If search is successful, move back to starting point
;; and really do quit.
! (progn
! (setq isearch-success nil)
! (isearch-cancel))
;; If search is failing, or has an incomplete regexp,
;; rub out until it is once more successful.
(while (or (not isearch-success) isearch-invalid-regexp)
***************
*** 1031,1037 ****
;; If already have what to search for, repeat it.
(or isearch-success
(progn
! (goto-char (if isearch-forward (point-min) (point-max)))
(setq isearch-wrapped t))))
;; C-s in reverse or C-r in forward, change direction.
(setq isearch-forward (not isearch-forward)))
--- 1044,1052 ----
;; If already have what to search for, repeat it.
(or isearch-success
(progn
! (if isearch-wrap-function
! (funcall isearch-wrap-function)
! (goto-char (if isearch-forward (point-min) (point-max))))
(setq isearch-wrapped t))))
;; C-s in reverse or C-r in forward, change direction.
(setq isearch-forward (not isearch-forward)))
***************
*** 1881,1886 ****
--- 1896,1902 ----
(or isearch-success (setq ellipsis nil))
(let ((m (concat (if isearch-success "" "failing ")
(if (and isearch-wrapped
+ (not isearch-wrap-function)
(if isearch-forward
(> (point) isearch-opoint)
(< (point) isearch-opoint)))
***************
*** 1977,1982 ****
--- 1993,2000 ----
;; Ding if failed this time after succeeding last time.
(and (isearch-success-state (car isearch-cmds))
(ding))
+ (if (functionp (isearch-pop-fun-state (car isearch-cmds)))
+ (funcall (isearch-pop-fun-state (car isearch-cmds)) (car
isearch-cmds)))
(goto-char (isearch-point-state (car isearch-cmds)))))