comparison lisp/isearch.el @ 1458:ef32d654351e

(isearch-mode-map): Make the top-level keymap dense. Explicitly bind control characters at that level.
author Richard M. Stallman <rms@gnu.org>
date Tue, 20 Oct 1992 21:21:47 +0000
parents a7003e65eb66
children d0d11fa0ecf5
comparison
equal deleted inserted replaced
1457:7f3e86c53165 1458:ef32d654351e
2 ;; Copyright (C) 1992 Free Software Foundation, Inc. 2 ;; Copyright (C) 1992 Free Software Foundation, Inc.
3 3
4 ;; LCD Archive Entry: 4 ;; LCD Archive Entry:
5 ;; isearch-mode|Daniel LaLiberte|liberte@cs.uiuc.edu 5 ;; isearch-mode|Daniel LaLiberte|liberte@cs.uiuc.edu
6 ;; |A minor mode replacement for isearch.el. 6 ;; |A minor mode replacement for isearch.el.
7 ;; |$Date: 1992/09/21 08:28:43 $|$Revision: 1.10 $|~/modes/isearch-mode.el 7 ;; |$Date: 1992/10/11 05:25:11 $|$Revision: 1.11 $|~/modes/isearch-mode.el
8 8
9 ;; This file is not yet part of GNU Emacs, but it is based almost 9 ;; This file is not yet part of GNU Emacs, but it is based almost
10 ;; entirely on isearch.el which is part of GNU Emacs. 10 ;; entirely on isearch.el which is part of GNU Emacs.
11 11
12 ;; GNU Emacs is distributed in the hope that it will be useful, 12 ;; GNU Emacs is distributed in the hope that it will be useful,
86 ;; - Hooks and options for failed search. 86 ;; - Hooks and options for failed search.
87 87
88 ;;;==================================================================== 88 ;;;====================================================================
89 ;;; Change History 89 ;;; Change History
90 90
91 ;;; $Header: /gd/gnu/emacs/19.0/lisp/RCS/isearch-mode.el,v 1.10 1992/09/21 08:28:43 rms Exp rms $ 91 ;;; $Header: /gd/gnu/emacs/19.0/lisp/RCS/isearch-mode.el,v 1.11 1992/10/11 05:25:11 rms Exp rms $
92 ;;; $Log: isearch-mode.el,v $ 92 ;;; $Log: isearch-mode.el,v $
93 ; Revision 1.11 1992/10/11 05:25:11 rms
94 ; (isearch-ring-advance-edit): Delete spurious `)'.
95 ;
93 ; Revision 1.10 1992/09/21 08:28:43 rms 96 ; Revision 1.10 1992/09/21 08:28:43 rms
94 ; entered into RCS 97 ; entered into RCS
95 ; 98 ;
96 ;;; Revision 1.4 92/09/14 16:26:02 liberte 99 ;;; Revision 1.4 92/09/14 16:26:02 liberte
97 ;;; Added prefix args to isearch-forward, etc. to switch between 100 ;;; Added prefix args to isearch-forward, etc. to switch between
220 223
221 (or isearch-mode-map 224 (or isearch-mode-map
222 (let* ((i 0) 225 (let* ((i 0)
223 (map (make-keymap))) 226 (map (make-keymap)))
224 227
228 ;; Make function keys, etc, exit the search.
229 (define-key map [t] 'isearch-other-control-char)
225 ;; Control chars, by default, end isearch mode transparently. 230 ;; Control chars, by default, end isearch mode transparently.
231 ;; We need these explicit definitions because, in a dense keymap,
232 ;; the binding for t does not affect characters.
233 ;; We use a dense keymap to save space.
226 (while (< i ?\ ) 234 (while (< i ?\ )
227 (define-key map (make-string 1 i) 'isearch-other-control-char) 235 (define-key map (make-string 1 i) 'isearch-other-control-char)
228 (setq i (1+ i))) 236 (setq i (1+ i)))
229 237
230 ;; Printing chars extend the selection by default. 238 ;; Printing chars extend the selection by default.
231 ;; This assumes that all remaining chars are printable. 239 (setq i ?\ )
232 (while (< i 128) 240 (while (< i 128)
233 (define-key map (make-string 1 i) 'isearch-printing-char) 241 (define-key map (make-string 1 i) 'isearch-printing-char)
234 (setq i (1+ i))) 242 (setq i (1+ i)))
235 243
236 ;; Several non-printing chars change the searching behavior. 244 ;; Several non-printing chars change the searching behavior.
272 ;; To handle local bindings with meta char prefix keys, define 280 ;; To handle local bindings with meta char prefix keys, define
273 ;; another full keymap. This must be done for any other prefix 281 ;; another full keymap. This must be done for any other prefix
274 ;; keys as well, one full keymap per char of the prefix key. It 282 ;; keys as well, one full keymap per char of the prefix key. It
275 ;; would be simpler to disable the global keymap, and/or have a 283 ;; would be simpler to disable the global keymap, and/or have a
276 ;; default local key binding for any key not otherwise bound. 284 ;; default local key binding for any key not otherwise bound.
277 (define-key map (char-to-string meta-prefix-char) (make-keymap)) 285 (define-key map (char-to-string meta-prefix-char) (make-sparse-keymap))
278 (setq i 0) 286 (define-key map (vector meta-prefix-char t) 'isearch-other-meta-char)
279 (while (< i 128) 287 ;;; (setq i 0)
280 (define-key map (char-to-string (+ 128 i));; Needs to be generalized. 288 ;;; (while (< i 128)
281 'isearch-other-meta-char) 289 ;;; (define-key map (char-to-string (+ 128 i));; Needs to be generalized.
282 (setq i (1+ i))) 290 ;;; 'isearch-other-meta-char)
291 ;;; (setq i (1+ i)))
283 292
284 (define-key map "\M-n" 'isearch-ring-advance) 293 (define-key map "\M-n" 'isearch-ring-advance)
285 (define-key map "\M-p" 'isearch-ring-retreat) 294 (define-key map "\M-p" 'isearch-ring-retreat)
286 (define-key map "\M-\t" 'isearch-complete) 295 (define-key map "\M-\t" 'isearch-complete)
287 296