1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-02-04 20:27:45 +00:00

* isearch.el (isearch-wrap-function)

(isearch-push-state-function): New defvars.
(isearch-pop-fun-state): New defsubst.
(isearch-top-state): Call function saved in `isearch-pop-fun-state'.
(isearch-push-state): Set the result of calling
`isearch-push-state-function' to the `isearch-pop-fun-state' field.
(isearch-cancel): Call function saved in `isearch-pop-fun-state' to
restore the mode-specific starting point of terminated search.
(isearch-abort): Call `isearch-cancel' instead of its duplicated code.
(isearch-repeat): Call `isearch-wrap-function' if defined.
(isearch-message-prefix): Don't add prefix "over" to the message
for wrapped search if `isearch-wrap-function' is defined.
(isearch-search): Call function saved in `isearch-pop-fun-state' to
restore the mode-specific starting point of failed search.
This commit is contained in:
Juri Linkov 2004-09-01 20:35:12 +00:00
parent 1a699acfc2
commit 6a18e4e72c
2 changed files with 91 additions and 19 deletions

View File

@ -1,3 +1,60 @@
2004-09-01 Juri Linkov <juri@jurta.org>
* isearch.el (isearch-wrap-function)
(isearch-push-state-function): New defvars.
(isearch-pop-fun-state): New defsubst.
(isearch-top-state): Call function saved in `isearch-pop-fun-state'.
(isearch-push-state): Set the result of calling
`isearch-push-state-function' to the `isearch-pop-fun-state' field.
(isearch-cancel): Call function saved in `isearch-pop-fun-state' to
restore the mode-specific starting point of terminated search.
(isearch-abort): Call `isearch-cancel' instead of its duplicated code.
(isearch-repeat): Call `isearch-wrap-function' if defined.
(isearch-message-prefix): Don't add prefix "over" to the message
for wrapped search if `isearch-wrap-function' is defined.
(isearch-search): Call function saved in `isearch-pop-fun-state' to
restore the mode-specific starting point of failed search.
* info.el (Info-search-whitespace-regexp): Fix backslashes.
(Info-search): Add new optional arguments for the sake of isearch.
Replace whitespace in Info-search-whitespace-regexp literally.
Add backward search. Don't call `Info-select-node' if regexp is
found in the same Info node. Don't add node to Info-history for
wrapped isearch.
(Info-search-backward, Info-isearch-search, Info-isearch-wrap)
(Info-isearch-push-state, Info-isearch-pop-state): New funs.
(Info-mode): Set local variables `isearch-search-fun-function',
`isearch-wrap-function', `isearch-push-state-function',
`search-whitespace-regexp'.
* isearch.el: Remove ancient Change Log section.
(isearch-string, isearch-message-string, isearch-point)
(isearch-success, isearch-forward-flag, isearch-other-end)
(isearch-word, isearch-invalid-regexp, isearch-wrapped)
(isearch-barrier, isearch-within-brackets)
(isearch-case-fold-search): Add suffix `-state' to state-related
defsubsts to avoid name clashes with other function names.
* simple.el (next-error): New defgroup and defface.
(next-error-highlight, next-error-highlight-no-select):
New defcustoms.
(next-error-no-select): Let-bind next-error-highlight to the value
of next-error-highlight-no-select before calling `next-error'.
* progmodes/compile.el (compilation-goto-locus):
Use `next-error' face instead of `region'. Set 4-th argument of
`move-overlay' to `current-buffer' to move overlay to different
source buffers. Use new variable `next-error-highlight'.
* simple.el (next-error-find-buffer): Move the rule
"if current buffer is a next-error capable buffer" after the
rule "if next-error-last-buffer is set to a live buffer".
Simplify to test all rules in one `or'.
(next-error): Doc fix.
(next-error, previous-error, first-error)
(next-error-no-select, previous-error-no-select):
Make arguments optional.
2004-08-31 Luc Teirlinck <teirllm@auburn.edu>
* macros.el (apply-macro-to-region-lines): Make it operate on all
@ -612,7 +669,6 @@
(ps-generate-string-list): Comment fix.
(ps-message-log-max): Code fix.
2004-07-22 Michael Piotrowski <mxp@dynalabs.de> (tiny change)
* ps-print.el (ps-begin-file): Improve the DSC compliance of the
@ -632,11 +688,9 @@
2004-07-20 Richard M. Stallman <rms@gnu.org>
* textmodes/fill.el (fill-comment-paragraph): Handle indent-tabs-mode.
(fill-delete-newlines): Call sentence-end as function.
(fill-nobreak-p, canonically-space-region): Likewise.
(fill-nobreak-p): If this break point is at the end of the line,
don't consider the newline which follows as a reason to return t.
* textmodes/fill.el (fill-nobreak-p): If this break point is
at the end of the line, don't consider the newline which follows
as a reason to return t.
2004-07-19 John Paul Wallington <jpw@gnu.org>

View File

@ -57,10 +57,6 @@
;; 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:
@ -161,6 +157,15 @@ Ordinarily the text becomes invisible again at the end of the search."
(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,6 +780,9 @@ REGEXP says which ring to use."
(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,6 +797,8 @@ REGEXP says which ring to use."
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,7 +811,9 @@ REGEXP says which ring to use."
isearch-success isearch-forward isearch-other-end
isearch-word
isearch-invalid-regexp isearch-wrapped isearch-barrier
isearch-within-brackets isearch-case-fold-search)
isearch-within-brackets isearch-case-fold-search
(if isearch-push-state-function
(funcall isearch-push-state-function)))
isearch-cmds)))
@ -987,10 +999,13 @@ If first char entered is \\[isearch-yank-word-or-char], then do word search inst
(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)
(isearch-done t) ; exit isearch
(isearch-clean-overlays)
(signal 'quit nil)) ; and pass on quit signal
(signal 'quit nil)) ; and pass on quit signal
(defun isearch-abort ()
"Abort incremental search mode if searching is successful, signaling quit.
@ -1002,11 +1017,9 @@ Use `isearch-exit' to quit without signaling."
(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
(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,7 +1044,9 @@ Use `isearch-exit' to quit without signaling."
;; If already have what to search for, repeat it.
(or isearch-success
(progn
(goto-char (if isearch-forward (point-min) (point-max)))
(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,6 +1896,7 @@ If there is no completion possible, say so and continue searching."
(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,6 +1993,8 @@ Can be changed via `isearch-search-fun-function' for special needs."
;; 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)))))