]> code.delx.au - gnu-emacs/blobdiff - lisp/isearch.el
* isearch.el (isearch-switch-frame-handler): Call
[gnu-emacs] / lisp / isearch.el
index dd9ed0790101e410b944f58a6bbdc384a3a3adf5..85b8924ac0d97a7f7c87f406a4c846af0a6d970e 100644 (file)
@@ -1,10 +1,10 @@
-;; Incremental search minor mode.
+;;; isearch.el --- incremental search minor mode.
+
 ;; Copyright (C) 1992 Free Software Foundation, Inc.
 
-;; LCD Archive Entry:
-;; isearch-mode|Daniel LaLiberte|liberte@cs.uiuc.edu
-;; |A minor mode replacement for isearch.el.
-;; |$Date: 1993/03/06 06:15:05 $|$Revision: 1.20 $|~/modes/isearch-mode.el
+;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu>
+
+;; |$Date: 1993/03/17 17:17:05 $|$Revision: 1.26 $
 
 ;; This file is not yet part of GNU Emacs, but it is based almost
 ;; entirely on isearch.el which is part of GNU Emacs.
@@ -24,6 +24,8 @@
 ;; file named COPYING.  Among other things, the copyright notice
 ;; and this notice must be preserved on all copies.
 
+;;; Commentary:
+
 ;;;====================================================================
 ;; Instructions
 
 ;; - Think about incorporating query-replace.
 ;; - Hooks and options for failed search.
 
+;;; Change Log:
+
 ;;;====================================================================
 ;;; Change History
 
-;;; $Header: /gd/gnu/emacs/19.0/lisp/RCS/isearch-mode.el,v 1.20 1993/03/06 06:15:05 rms Exp rms $
-;;; $Log: isearch-mode.el,v $
+;;; $Header: /home/gd/gnu/emacs/19.0/lisp/RCS/isearch.el,v 1.26 1993/03/17 17:17:05 eric Exp jimb $
+;;; $Log: isearch.el,v $
+; Revision 1.26  1993/03/17  17:17:05  eric
+; Add standard library headers.
+;
+; Revision 1.25  1993/03/17  16:44:50  eric
+; Add standard library headers.
+;
+; Revision 1.24  1993/03/17  15:58:09  eric
+; Add standard library headers.
+;
+; Revision 1.23  1993/03/07  20:17:27  rms
+; (isearch-other-meta-char): Call listify-key-sequence.
+; (isearch-unread): Don't call it here.
+; (isearch-mode-map): Bind the ASCII-equivalent function keys.
+;
+; Revision 1.22  1993/03/07  08:43:57  rms
+; (isearch-mode): Don't make a pre-command-hook.
+;
+; Revision 1.21  1993/03/07  04:22:00  rms
+; (isearch-unread): Find last list element by hand.
+;
 ; Revision 1.20  1993/03/06  06:15:05  rms
 ; (isearch-unread): Handle multiple args.
 ; For Emacs 19, use listify-key-sequence.
 ;;; 3/18/92 Fixed invalid-regexp.
 ;;; 3/18/92 Fixed yanking in regexps.
 
+;;; Code:
 
 \f
 ;;;=========================================================================
@@ -300,9 +325,6 @@ Default value, nil, means edit the string instead.")
     
       (define-key map "\C-q" 'isearch-quote-char)
 
-      ;;  (define-key map "\r" 'isearch-return-char)
-      ;; For version 19, RET (C-m) terminates search and LFD (C-j) matches eol.
-      ;; We could make this conditional.
       (define-key map "\r" 'isearch-exit)
       (define-key map "\C-j" 'isearch-printing-char)
       (define-key map "\t" 'isearch-printing-char)
@@ -311,6 +333,16 @@ Default value, nil, means edit the string instead.")
       (define-key map "\C-w" 'isearch-yank-word)
       (define-key map "\C-y" 'isearch-yank-line)
 
+      ;; Bind the ASCII-equivalent "function keys" explicitly
+      ;; if we bind their equivalents, 
+      ;; since otherwise the default binding would override.
+      ;; We bind [escape] below.
+      (define-key map [tab] 'isearch-printing-char)
+      (define-key map [delete] 'isearch-delete-char)
+      (define-key map [backspace] 'isearch-delete-char)
+      (define-key map [return] 'isearch-exit)
+      (define-key map [newline] 'isearch-printing-char)
+
       ;; Define keys for regexp chars * ? |.
       ;; Nothing special for + because it matches at least once.
       (define-key map "*" 'isearch-*-char)
@@ -333,13 +365,10 @@ Default value, nil, means edit the string instead.")
       ;; keys as well, one full keymap per char of the prefix key.  It
       ;; would be simpler to disable the global keymap, and/or have a
       ;; default local key binding for any key not otherwise bound.
-      (define-key map (char-to-string meta-prefix-char) (make-sparse-keymap))
+      (let ((meta-map (make-sparse-keymap)))
+       (define-key map (char-to-string meta-prefix-char) meta-map)
+       (define-key map [escape] meta-map))
       (define-key map (vector meta-prefix-char t) 'isearch-other-meta-char)
-;;;      (setq i 0)
-;;;      (while (< i 128)
-;;;    (define-key map (char-to-string (+ 128 i));; Needs to be generalized.
-;;;      'isearch-other-meta-char)
-;;;    (setq i (1+ i)))
 
       (define-key map "\M-n" 'isearch-ring-advance)
       (define-key map "\M-p" 'isearch-ring-retreat)
@@ -558,8 +587,10 @@ is treated as a regexp.  See \\[isearch-forward] for more info."
        isearch-old-local-map (current-local-map)
        search-ring-yank-pointer nil
        regexp-search-ring-yank-pointer nil)
-  (if isearch-pre-command-hook-exists
-      (add-hook 'pre-command-hook 'isearch-pre-command-hook))
+;; This was for Lucid Emacs.  But now that we have pre-command-hook,
+;; it causes trouble.
+;;  (if isearch-pre-command-hook-exists
+;;      (add-hook 'pre-command-hook 'isearch-pre-command-hook))
   (setq        isearch-mode " Isearch")  ;; forward? regexp?
   (set-buffer-modified-p (buffer-modified-p)) ; update modeline
 
@@ -674,7 +705,7 @@ is treated as a regexp.  See \\[isearch-forward] for more info."
   (interactive) ;; Is this necessary?
   ;; First terminate isearch-mode.
   (isearch-done)
-  (select-frame (car (cdr (isearch-last-command-char)))))
+  (handle-switch-frame (car (cdr (isearch-last-command-char)))))
 
 ;;;========================================================
 
@@ -1044,11 +1075,11 @@ and the meta character is unread so that it applies to editing the string."
   (interactive)
   (cond ((eq search-exit-option 'edit)
         (let ((key (this-command-keys)))
-          (apply 'isearch-unread (append key nil)))
+          (apply 'isearch-unread (listify-key-sequence key)))
         (isearch-edit-string))
        (search-exit-option
         (let ((key (this-command-keys)))
-          (apply 'isearch-unread (append key nil)))
+          (apply 'isearch-unread (listify-key-sequence key)))
         (isearch-done))
        (t;; otherwise nil
         (isearch-process-search-string (this-command-keys)
@@ -1438,10 +1469,10 @@ have special meaning in a regexp."
   (isearch-char-to-string c))
 
 (defun isearch-unread (&rest char-or-events)
-  (setq foo char-or-events)
   ;; General function to unread characters or events.
   (if isearch-gnu-emacs-events
-      (setq unread-command-events (listify-key-sequence char-or-events))
+      (setq unread-command-events
+           (append char-or-events unread-command-events))
     (let ((char (if (cdr char-or-events)
                    (progn
                      (while (cdr char-or-events)
@@ -1562,3 +1593,4 @@ have special meaning in a regexp."
 
 ;;))
 
+;;; isearch.el ends here