/[emacs]/emacs/lisp/isearch.el
ViewVC logotype

Diff of /emacs/lisp/isearch.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.234 by teirllm, Mon Aug 16 12:50:25 2004 UTC revision 1.235 by jurta, Wed Sep 1 19:42:58 2004 UTC
# Line 61  Line 61 
61  ;; - Integrate the emacs 19 generalized command history.  ;; - Integrate the emacs 19 generalized command history.
62  ;; - Hooks and options for failed search.  ;; - Hooks and options for failed search.
63    
 ;;; Change Log:  
   
 ;; Changes before those recorded in ChangeLog:  
   
 ;; Revision 1.4  92/09/14  16:26:02  liberte  
 ;; Added prefix args to isearch-forward, etc. to switch between  
 ;;    string and regular expression searching.  
 ;; Added some support for lemacs.  
 ;; Added general isearch-highlight option - but only for lemacs so far.  
 ;; Added support for frame switching in emacs 19.  
 ;; Added word search option to isearch-edit-string.  
 ;; Renamed isearch-quit to isearch-abort.  
 ;; Numerous changes to comments and doc strings.  
 ;;  
 ;; Revision 1.3  92/06/29  13:10:08  liberte  
 ;; Moved modal isearch-mode handling into isearch-mode.  
 ;; Got rid of buffer-local isearch variables.  
 ;; isearch-edit-string used by ring adjustments, completion, and  
 ;; nonincremental searching.  C-s and C-r are additional exit commands.  
 ;; Renamed all regex to regexp.  
 ;; Got rid of found-start and found-point globals.  
 ;; Generalized handling of upper-case chars.  
   
 ;; Revision 1.2  92/05/27  11:33:57  liberte  
 ;; Emacs version 19 has a search ring, which is supported here.  
 ;; Other fixes found in the version 19 isearch are included here.  
 ;;  
 ;; Also see variables search-caps-disable-folding,  
 ;; search-nonincremental-instead, search-whitespace-regexp, and  
 ;; commands isearch-toggle-regexp, isearch-edit-string.  
 ;;  
 ;; semi-modal isearching is supported.  
   
 ;; Changes for 1.1  
 ;; 3/18/92 Fixed invalid-regexp.  
 ;; 3/18/92 Fixed yanking in regexps.  
   
64  ;;; Code:  ;;; Code:
65    
66    
# Line 776  REGEXP says which ring to use." Line 739  REGEXP says which ring to use."
739    
740  ;; The search status structure and stack.  ;; The search status structure and stack.
741    
742  (defsubst isearch-string (frame)  (defsubst isearch-string-state (frame)
743    "Return the search string in FRAME."    "Return the search string in FRAME."
744    (aref frame 0))    (aref frame 0))
745  (defsubst isearch-message-string (frame)  (defsubst isearch-message-state (frame)
746    "Return the search string to display to the user in FRAME."    "Return the search string to display to the user in FRAME."
747    (aref frame 1))    (aref frame 1))
748  (defsubst isearch-point (frame)  (defsubst isearch-point-state (frame)
749    "Return the point in FRAME."    "Return the point in FRAME."
750    (aref frame 2))    (aref frame 2))
751  (defsubst isearch-success (frame)  (defsubst isearch-success-state (frame)
752    "Return the success flag in FRAME."    "Return the success flag in FRAME."
753    (aref frame 3))    (aref frame 3))
754  (defsubst isearch-forward-flag (frame)  (defsubst isearch-forward-state (frame)
755    "Return the searching-forward flag in FRAME."    "Return the searching-forward flag in FRAME."
756    (aref frame 4))    (aref frame 4))
757  (defsubst isearch-other-end (frame)  (defsubst isearch-other-end-state (frame)
758    "Return the other end of the match in FRAME."    "Return the other end of the match in FRAME."
759    (aref frame 5))    (aref frame 5))
760  (defsubst isearch-word (frame)  (defsubst isearch-word-state (frame)
761    "Return the search-by-word flag in FRAME."    "Return the search-by-word flag in FRAME."
762    (aref frame 6))    (aref frame 6))
763  (defsubst isearch-invalid-regexp (frame)  (defsubst isearch-invalid-regexp-state (frame)
764    "Return the regexp error message in FRAME, or nil if its regexp is valid."    "Return the regexp error message in FRAME, or nil if its regexp is valid."
765    (aref frame 7))    (aref frame 7))
766  (defsubst isearch-wrapped (frame)  (defsubst isearch-wrapped-state (frame)
767    "Return the search-wrapped flag in FRAME."    "Return the search-wrapped flag in FRAME."
768    (aref frame 8))    (aref frame 8))
769  (defsubst isearch-barrier (frame)  (defsubst isearch-barrier-state (frame)
770    "Return the barrier value in FRAME."    "Return the barrier value in FRAME."
771    (aref frame 9))    (aref frame 9))
772  (defsubst isearch-within-brackets (frame)  (defsubst isearch-within-brackets-state (frame)
773    "Return the in-character-class flag in FRAME."    "Return the in-character-class flag in FRAME."
774    (aref frame 10))    (aref frame 10))
775  (defsubst isearch-case-fold-search (frame)  (defsubst isearch-case-fold-search-state (frame)
776    "Return the case-folding flag in FRAME."    "Return the case-folding flag in FRAME."
777    (aref frame 11))    (aref frame 11))
778    
779  (defun isearch-top-state ()  (defun isearch-top-state ()
780    (let ((cmd (car isearch-cmds)))    (let ((cmd (car isearch-cmds)))
781      (setq isearch-string (isearch-string cmd)      (setq isearch-string (isearch-string-state cmd)
782            isearch-message (isearch-message-string cmd)            isearch-message (isearch-message-state cmd)
783            isearch-success (isearch-success cmd)            isearch-success (isearch-success-state cmd)
784            isearch-forward (isearch-forward-flag cmd)            isearch-forward (isearch-forward-state cmd)
785            isearch-other-end (isearch-other-end cmd)            isearch-other-end (isearch-other-end-state cmd)
786            isearch-word (isearch-word cmd)            isearch-word (isearch-word-state cmd)
787            isearch-invalid-regexp (isearch-invalid-regexp cmd)            isearch-invalid-regexp (isearch-invalid-regexp-state cmd)
788            isearch-wrapped (isearch-wrapped cmd)            isearch-wrapped (isearch-wrapped-state cmd)
789            isearch-barrier (isearch-barrier cmd)            isearch-barrier (isearch-barrier-state cmd)
790            isearch-within-brackets (isearch-within-brackets cmd)            isearch-within-brackets (isearch-within-brackets-state cmd)
791            isearch-case-fold-search (isearch-case-fold-search cmd))            isearch-case-fold-search (isearch-case-fold-search-state cmd))
792      (goto-char (isearch-point cmd))))      (goto-char (isearch-point-state cmd))))
793    
794  (defun isearch-pop-state ()  (defun isearch-pop-state ()
795    (setq isearch-cmds (cdr isearch-cmds))    (setq isearch-cmds (cdr isearch-cmds))
# Line 1347  barrier." Line 1310  barrier."
1310               ;; We have to check 2 stack frames because the last might be               ;; We have to check 2 stack frames because the last might be
1311               ;; invalid just because of a backslash.               ;; invalid just because of a backslash.
1312               (or (not isearch-invalid-regexp)               (or (not isearch-invalid-regexp)
1313                   (not (isearch-invalid-regexp (cadr isearch-cmds)))                   (not (isearch-invalid-regexp-state (cadr isearch-cmds)))
1314                   allow-invalid))                   allow-invalid))
1315      (if to-barrier      (if to-barrier
1316          (progn (goto-char isearch-barrier)          (progn (goto-char isearch-barrier)
# Line 1362  barrier." Line 1325  barrier."
1325          ;; Also skip over postfix operators -- though horrid,          ;; Also skip over postfix operators -- though horrid,
1326          ;; 'ab?\{5,6\}+\{1,2\}*' is perfectly legal.          ;; 'ab?\{5,6\}+\{1,2\}*' is perfectly legal.
1327          (while (and previous          (while (and previous
1328                      (or (isearch-invalid-regexp frame)                      (or (isearch-invalid-regexp-state frame)
1329                          (let* ((string (isearch-string frame))                          (let* ((string (isearch-string-state frame))
1330                                 (lchar (aref string (1- (length string)))))                                 (lchar (aref string (1- (length string)))))
1331                            ;; The operators aren't always operators; check                            ;; The operators aren't always operators; check
1332                            ;; backslashes.  This doesn't handle the case of                            ;; backslashes.  This doesn't handle the case of
# Line 1371  barrier." Line 1334  barrier."
1334                            ;; being special, but then we should fall back to                            ;; being special, but then we should fall back to
1335                            ;; the barrier anyway because it's all optional.                            ;; the barrier anyway because it's all optional.
1336                            (if (isearch-backslash                            (if (isearch-backslash
1337                                 (isearch-string (car previous)))                                 (isearch-string-state (car previous)))
1338                                (eq lchar ?\})                                (eq lchar ?\})
1339                              (memq lchar '(?* ?? ?+))))))                              (memq lchar '(?* ?? ?+))))))
1340            (setq stack previous previous (cdr previous) frame (car stack)))            (setq stack previous previous (cdr previous) frame (car stack)))
# Line 1379  barrier." Line 1342  barrier."
1342            ;; `stack' now refers the most recent valid regexp that is not at            ;; `stack' now refers the most recent valid regexp that is not at
1343            ;; all optional in its last term.  Now dig one level deeper and find            ;; all optional in its last term.  Now dig one level deeper and find
1344            ;; what matched before that.            ;; what matched before that.
1345            (let ((last-other-end (or (isearch-other-end (car previous))            (let ((last-other-end (or (isearch-other-end-state (car previous))
1346                                      isearch-barrier)))                                      isearch-barrier)))
1347              (goto-char (if isearch-forward              (goto-char (if isearch-forward
1348                             (max last-other-end isearch-barrier)                             (max last-other-end isearch-barrier)
# Line 2012  Can be changed via `isearch-search-fun-f Line 1975  Can be changed via `isearch-search-fun-f
1975    (if isearch-success    (if isearch-success
1976        nil        nil
1977      ;; Ding if failed this time after succeeding last time.      ;; Ding if failed this time after succeeding last time.
1978      (and (isearch-success (car isearch-cmds))      (and (isearch-success-state (car isearch-cmds))
1979           (ding))           (ding))
1980      (goto-char (isearch-point (car isearch-cmds)))))      (goto-char (isearch-point-state (car isearch-cmds)))))
1981    
1982    
1983  ;; Called when opening an overlay, and we are still in isearch.  ;; Called when opening an overlay, and we are still in isearch.

Legend:
Removed from v.1.234  
changed lines
  Added in v.1.235

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26