aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2004-09-01 20:35:12 +0000
committerJuri Linkov2004-09-01 20:35:12 +0000
commit6a18e4e72c2ab83d2cca8b6a6c432676ade70347 (patch)
treedc8e3d0fa7fb18a4beee0b2031e7f33e0bb5c4e4
parent1a699acfc29e47c6ea37346005612c6e3ae8b681 (diff)
downloademacs-6a18e4e72c2ab83d2cca8b6a6c432676ade70347.tar.gz
emacs-6a18e4e72c2ab83d2cca8b6a6c432676ade70347.zip
* 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.
-rw-r--r--lisp/ChangeLog66
-rw-r--r--lisp/isearch.el44
2 files changed, 91 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ef39c44370a..9871aac6976 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,60 @@
12004-09-01 Juri Linkov <juri@jurta.org>
2
3 * isearch.el (isearch-wrap-function)
4 (isearch-push-state-function): New defvars.
5 (isearch-pop-fun-state): New defsubst.
6 (isearch-top-state): Call function saved in `isearch-pop-fun-state'.
7 (isearch-push-state): Set the result of calling
8 `isearch-push-state-function' to the `isearch-pop-fun-state' field.
9 (isearch-cancel): Call function saved in `isearch-pop-fun-state' to
10 restore the mode-specific starting point of terminated search.
11 (isearch-abort): Call `isearch-cancel' instead of its duplicated code.
12 (isearch-repeat): Call `isearch-wrap-function' if defined.
13 (isearch-message-prefix): Don't add prefix "over" to the message
14 for wrapped search if `isearch-wrap-function' is defined.
15 (isearch-search): Call function saved in `isearch-pop-fun-state' to
16 restore the mode-specific starting point of failed search.
17
18 * info.el (Info-search-whitespace-regexp): Fix backslashes.
19 (Info-search): Add new optional arguments for the sake of isearch.
20 Replace whitespace in Info-search-whitespace-regexp literally.
21 Add backward search. Don't call `Info-select-node' if regexp is
22 found in the same Info node. Don't add node to Info-history for
23 wrapped isearch.
24 (Info-search-backward, Info-isearch-search, Info-isearch-wrap)
25 (Info-isearch-push-state, Info-isearch-pop-state): New funs.
26 (Info-mode): Set local variables `isearch-search-fun-function',
27 `isearch-wrap-function', `isearch-push-state-function',
28 `search-whitespace-regexp'.
29
30 * isearch.el: Remove ancient Change Log section.
31 (isearch-string, isearch-message-string, isearch-point)
32 (isearch-success, isearch-forward-flag, isearch-other-end)
33 (isearch-word, isearch-invalid-regexp, isearch-wrapped)
34 (isearch-barrier, isearch-within-brackets)
35 (isearch-case-fold-search): Add suffix `-state' to state-related
36 defsubsts to avoid name clashes with other function names.
37
38 * simple.el (next-error): New defgroup and defface.
39 (next-error-highlight, next-error-highlight-no-select):
40 New defcustoms.
41 (next-error-no-select): Let-bind next-error-highlight to the value
42 of next-error-highlight-no-select before calling `next-error'.
43
44 * progmodes/compile.el (compilation-goto-locus):
45 Use `next-error' face instead of `region'. Set 4-th argument of
46 `move-overlay' to `current-buffer' to move overlay to different
47 source buffers. Use new variable `next-error-highlight'.
48
49 * simple.el (next-error-find-buffer): Move the rule
50 "if current buffer is a next-error capable buffer" after the
51 rule "if next-error-last-buffer is set to a live buffer".
52 Simplify to test all rules in one `or'.
53 (next-error): Doc fix.
54 (next-error, previous-error, first-error)
55 (next-error-no-select, previous-error-no-select):
56 Make arguments optional.
57
12004-08-31 Luc Teirlinck <teirllm@auburn.edu> 582004-08-31 Luc Teirlinck <teirllm@auburn.edu>
2 59
3 * macros.el (apply-macro-to-region-lines): Make it operate on all 60 * macros.el (apply-macro-to-region-lines): Make it operate on all
@@ -612,7 +669,6 @@
612 (ps-generate-string-list): Comment fix. 669 (ps-generate-string-list): Comment fix.
613 (ps-message-log-max): Code fix. 670 (ps-message-log-max): Code fix.
614 671
615
6162004-07-22 Michael Piotrowski <mxp@dynalabs.de> (tiny change) 6722004-07-22 Michael Piotrowski <mxp@dynalabs.de> (tiny change)
617 673
618 * ps-print.el (ps-begin-file): Improve the DSC compliance of the 674 * ps-print.el (ps-begin-file): Improve the DSC compliance of the
@@ -632,11 +688,9 @@
632 688
6332004-07-20 Richard M. Stallman <rms@gnu.org> 6892004-07-20 Richard M. Stallman <rms@gnu.org>
634 690
635 * textmodes/fill.el (fill-comment-paragraph): Handle indent-tabs-mode. 691 * textmodes/fill.el (fill-nobreak-p): If this break point is
636 (fill-delete-newlines): Call sentence-end as function. 692 at the end of the line, don't consider the newline which follows
637 (fill-nobreak-p, canonically-space-region): Likewise. 693 as a reason to return t.
638 (fill-nobreak-p): If this break point is at the end of the line,
639 don't consider the newline which follows as a reason to return t.
640 694
6412004-07-19 John Paul Wallington <jpw@gnu.org> 6952004-07-19 John Paul Wallington <jpw@gnu.org>
642 696
diff --git a/lisp/isearch.el b/lisp/isearch.el
index d21e28008a9..b8865693d0b 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -57,10 +57,6 @@
57;; keep the behavior. No point in forcing nonincremental search until 57;; keep the behavior. No point in forcing nonincremental search until
58;; the last possible moment. 58;; the last possible moment.
59 59
60;; TODO
61;; - Integrate the emacs 19 generalized command history.
62;; - Hooks and options for failed search.
63
64;;; Code: 60;;; Code:
65 61
66 62
@@ -161,6 +157,15 @@ Ordinarily the text becomes invisible again at the end of the search."
161(defvar isearch-mode-end-hook nil 157(defvar isearch-mode-end-hook nil
162 "Function(s) to call after terminating an incremental search.") 158 "Function(s) to call after terminating an incremental search.")
163 159
160(defvar isearch-wrap-function nil
161 "Function to call to wrap the search when search is failed.
162If nil, move point to the beginning of the buffer for a forward search,
163or to the end of the buffer for a backward search.")
164
165(defvar isearch-push-state-function nil
166 "Function to save a function restoring the mode-specific isearch state
167to the search status stack.")
168
164;; Search ring. 169;; Search ring.
165 170
166(defvar search-ring nil 171(defvar search-ring nil
@@ -775,6 +780,9 @@ REGEXP says which ring to use."
775(defsubst isearch-case-fold-search-state (frame) 780(defsubst isearch-case-fold-search-state (frame)
776 "Return the case-folding flag in FRAME." 781 "Return the case-folding flag in FRAME."
777 (aref frame 11)) 782 (aref frame 11))
783(defsubst isearch-pop-fun-state (frame)
784 "Return the function restoring the mode-specific isearch state in FRAME."
785 (aref frame 12))
778 786
779(defun isearch-top-state () 787(defun isearch-top-state ()
780 (let ((cmd (car isearch-cmds))) 788 (let ((cmd (car isearch-cmds)))
@@ -789,6 +797,8 @@ REGEXP says which ring to use."
789 isearch-barrier (isearch-barrier-state cmd) 797 isearch-barrier (isearch-barrier-state cmd)
790 isearch-within-brackets (isearch-within-brackets-state cmd) 798 isearch-within-brackets (isearch-within-brackets-state cmd)
791 isearch-case-fold-search (isearch-case-fold-search-state cmd)) 799 isearch-case-fold-search (isearch-case-fold-search-state cmd))
800 (if (functionp (isearch-pop-fun-state cmd))
801 (funcall (isearch-pop-fun-state cmd) cmd))
792 (goto-char (isearch-point-state cmd)))) 802 (goto-char (isearch-point-state cmd))))
793 803
794(defun isearch-pop-state () 804(defun isearch-pop-state ()
@@ -801,7 +811,9 @@ REGEXP says which ring to use."
801 isearch-success isearch-forward isearch-other-end 811 isearch-success isearch-forward isearch-other-end
802 isearch-word 812 isearch-word
803 isearch-invalid-regexp isearch-wrapped isearch-barrier 813 isearch-invalid-regexp isearch-wrapped isearch-barrier
804 isearch-within-brackets isearch-case-fold-search) 814 isearch-within-brackets isearch-case-fold-search
815 (if isearch-push-state-function
816 (funcall isearch-push-state-function)))
805 isearch-cmds))) 817 isearch-cmds)))
806 818
807 819
@@ -987,10 +999,13 @@ If first char entered is \\[isearch-yank-word-or-char], then do word search inst
987(defun isearch-cancel () 999(defun isearch-cancel ()
988 "Terminate the search and go back to the starting point." 1000 "Terminate the search and go back to the starting point."
989 (interactive) 1001 (interactive)
1002 (if (functionp (isearch-pop-fun-state (car (last isearch-cmds))))
1003 (funcall (isearch-pop-fun-state (car (last isearch-cmds)))
1004 (car (last isearch-cmds))))
990 (goto-char isearch-opoint) 1005 (goto-char isearch-opoint)
991 (isearch-done t) 1006 (isearch-done t) ; exit isearch
992 (isearch-clean-overlays) 1007 (isearch-clean-overlays)
993 (signal 'quit nil)) ; and pass on quit signal 1008 (signal 'quit nil)) ; and pass on quit signal
994 1009
995(defun isearch-abort () 1010(defun isearch-abort ()
996 "Abort incremental search mode if searching is successful, signaling quit. 1011 "Abort incremental search mode if searching is successful, signaling quit.
@@ -1002,11 +1017,9 @@ Use `isearch-exit' to quit without signaling."
1002 (if isearch-success 1017 (if isearch-success
1003 ;; If search is successful, move back to starting point 1018 ;; If search is successful, move back to starting point
1004 ;; and really do quit. 1019 ;; and really do quit.
1005 (progn (goto-char isearch-opoint) 1020 (progn
1006 (setq isearch-success nil) 1021 (setq isearch-success nil)
1007 (isearch-done t) ; exit isearch 1022 (isearch-cancel))
1008 (isearch-clean-overlays)
1009 (signal 'quit nil)) ; and pass on quit signal
1010 ;; If search is failing, or has an incomplete regexp, 1023 ;; If search is failing, or has an incomplete regexp,
1011 ;; rub out until it is once more successful. 1024 ;; rub out until it is once more successful.
1012 (while (or (not isearch-success) isearch-invalid-regexp) 1025 (while (or (not isearch-success) isearch-invalid-regexp)
@@ -1031,7 +1044,9 @@ Use `isearch-exit' to quit without signaling."
1031 ;; If already have what to search for, repeat it. 1044 ;; If already have what to search for, repeat it.
1032 (or isearch-success 1045 (or isearch-success
1033 (progn 1046 (progn
1034 (goto-char (if isearch-forward (point-min) (point-max))) 1047 (if isearch-wrap-function
1048 (funcall isearch-wrap-function)
1049 (goto-char (if isearch-forward (point-min) (point-max))))
1035 (setq isearch-wrapped t)))) 1050 (setq isearch-wrapped t))))
1036 ;; C-s in reverse or C-r in forward, change direction. 1051 ;; C-s in reverse or C-r in forward, change direction.
1037 (setq isearch-forward (not isearch-forward))) 1052 (setq isearch-forward (not isearch-forward)))
@@ -1881,6 +1896,7 @@ If there is no completion possible, say so and continue searching."
1881 (or isearch-success (setq ellipsis nil)) 1896 (or isearch-success (setq ellipsis nil))
1882 (let ((m (concat (if isearch-success "" "failing ") 1897 (let ((m (concat (if isearch-success "" "failing ")
1883 (if (and isearch-wrapped 1898 (if (and isearch-wrapped
1899 (not isearch-wrap-function)
1884 (if isearch-forward 1900 (if isearch-forward
1885 (> (point) isearch-opoint) 1901 (> (point) isearch-opoint)
1886 (< (point) isearch-opoint))) 1902 (< (point) isearch-opoint)))
@@ -1977,6 +1993,8 @@ Can be changed via `isearch-search-fun-function' for special needs."
1977 ;; Ding if failed this time after succeeding last time. 1993 ;; Ding if failed this time after succeeding last time.
1978 (and (isearch-success-state (car isearch-cmds)) 1994 (and (isearch-success-state (car isearch-cmds))
1979 (ding)) 1995 (ding))
1996 (if (functionp (isearch-pop-fun-state (car isearch-cmds)))
1997 (funcall (isearch-pop-fun-state (car isearch-cmds)) (car isearch-cmds)))
1980 (goto-char (isearch-point-state (car isearch-cmds))))) 1998 (goto-char (isearch-point-state (car isearch-cmds)))))
1981 1999
1982 2000