comparison lisp/tmm.el @ 12763:b8e986069a58

Don't alter bindings in minibuffer-local-must-match-map or completion-list-mode-map. (tmm-add-prompt): Use make-local-hook; add hook locally. (tmm-delete-map): Delete hook locally.
author Richard M. Stallman <rms@gnu.org>
date Thu, 03 Aug 1995 17:39:53 +0000
parents 40810ac8d212
children 6db607a7b62d
comparison
equal deleted inserted replaced
12762:b616982e679b 12763:b8e986069a58
30 ;;; to your .emacs file. You can also add your own access to different 30 ;;; to your .emacs file. You can also add your own access to different
31 ;;; menus available in Window System Emacs modelling definition after 31 ;;; menus available in Window System Emacs modelling definition after
32 ;;; tmm-menubar. 32 ;;; tmm-menubar.
33 33
34 (require 'electric) 34 (require 'electric)
35 (define-key completion-list-mode-map "\e\e" 'abort-recursive-edit)
36 (define-key completion-list-mode-map [left] 'backward-word)
37 (define-key completion-list-mode-map [right] 'forward-word)
38 ;(define-key minibuffer-local-must-match-map [pageup] 'tmm-goto-completions) 35 ;(define-key minibuffer-local-must-match-map [pageup] 'tmm-goto-completions)
39 ;(define-key minibuffer-local-must-match-map [prior] 'tmm-goto-completions) 36 ;(define-key minibuffer-local-must-match-map [prior] 'tmm-goto-completions)
40 ;(define-key minibuffer-local-must-match-map "\ev" 'tmm-goto-completions) 37 ;(define-key minibuffer-local-must-match-map "\ev" 'tmm-goto-completions)
41 (define-key minibuffer-local-must-match-map [up] 'previous-history-element)
42 (define-key minibuffer-local-must-match-map [down] 'next-history-element)
43 38
44 ;;; The following will be localized, added only to pacify the compiler. 39 ;;; The following will be localized, added only to pacify the compiler.
45 (defvar tmm-short-cuts) 40 (defvar tmm-short-cuts)
46 (defvar tmm-old-mb-map) 41 (defvar tmm-old-mb-map)
47 (defvar tmm-old-comp-map) 42 (defvar tmm-old-comp-map)
48 (defvar tmm-c-prompt) 43 (defvar tmm-c-prompt)
49 (defvar tmm-km-list) 44 (defvar tmm-km-list)
50 (defvar tmm-table-undef) 45 (defvar tmm-table-undef)
51 46
47 ;;;###autoload (define-key global-map "\M-`" tmm-menubar)
48
52 ;;;###autoload 49 ;;;###autoload
53 (defun tmm-menubar () 50 (defun tmm-menubar ()
54 "Text-mode emulation of looking and choosing from a menubar. 51 "Text-mode emulation of looking and choosing from a menubar.
55 See the documentation for `tmm-prompt'." 52 See the documentation for `tmm-prompt'."
56 (interactive) 53 (interactive)
65 62
66 (defvar tmm-completion-prompt 63 (defvar tmm-completion-prompt
67 "Press PageUp Key to reach this buffer from the minibuffer. 64 "Press PageUp Key to reach this buffer from the minibuffer.
68 Alternatively, you can use Up/Down keys (or your History keys) to change 65 Alternatively, you can use Up/Down keys (or your History keys) to change
69 the item in the minibuffer, and press RET when you are done, or press the 66 the item in the minibuffer, and press RET when you are done, or press the
70 marked letters to pick up your choice. ESC ESC to cancel. 67 marked letters to pick up your choice. Type ESC ESC to cancel.
71 " 68 "
72 "What insert on top of completion buffer.") 69 "What insert on top of completion buffer.")
73 70
74 ;;;###autoload 71 ;;;###autoload
75 (defun tmm-prompt (bind &optional in-popup) 72 (defun tmm-prompt (bind &optional in-popup)
164 (cons (concat f tmm-mid-prompt str) (cdr elt))))) 161 (cons (concat f tmm-mid-prompt str) (cdr elt)))))
165 (reverse list))) 162 (reverse list)))
166 163
167 (defun tmm-add-prompt () 164 (defun tmm-add-prompt ()
168 (remove-hook 'minibuffer-setup-hook 'tmm-add-prompt) 165 (remove-hook 'minibuffer-setup-hook 'tmm-add-prompt)
169 (add-hook 'minibuffer-exit-hook 'tmm-delete-map) 166 (make-local-hook 'minibuffer-exit-hook)
167 (add-hook 'minibuffer-exit-hook 'tmm-delete-map nil t)
170 (let ((map (make-sparse-keymap)) (win (selected-window))) 168 (let ((map (make-sparse-keymap)) (win (selected-window)))
171 (mapcar (lambda (str) 169 (mapcar (lambda (str)
172 (define-key map str 'tmm-shortcut) 170 (define-key map str 'tmm-shortcut)
173 (define-key map (downcase str) 'tmm-shortcut)) 171 (define-key map (downcase str) 'tmm-shortcut))
174 tmm-short-cuts) 172 tmm-short-cuts)
196 ; it restores the size 194 ; it restores the size
197 ) 195 )
198 (insert tmm-c-prompt))) 196 (insert tmm-c-prompt)))
199 197
200 (defun tmm-delete-map () 198 (defun tmm-delete-map ()
201 (remove-hook 'minibuffer-exit-hook 'tmm-delete-map) 199 (remove-hook 'minibuffer-exit-hook 'tmm-delete-map t)
202 (use-local-map tmm-old-mb-map)) 200 (use-local-map tmm-old-mb-map))
203 201
204 (defun tmm-shortcut () 202 (defun tmm-shortcut ()
205 (interactive) 203 (interactive)
206 (let ((c (upcase (char-to-string last-command-char))) s) 204 (let ((c (upcase (char-to-string last-command-char))) s)