comparison lisp/tmm.el @ 91040:14c4a6aac623

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 866-879) - Merge multi-tty branch - Update from CVS - Merge from emacs--rel--22 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-257
author Miles Bader <miles@gnu.org>
date Thu, 11 Oct 2007 16:14:00 +0000
parents f55f9811f5d7 490362706869
children 606f2d163a64
comparison
equal deleted inserted replaced
91039:eefadc1e1d5e 91040:14c4a6aac623
45 (defvar tmm-km-list) 45 (defvar tmm-km-list)
46 (defvar tmm-next-shortcut-digit) 46 (defvar tmm-next-shortcut-digit)
47 (defvar tmm-table-undef) 47 (defvar tmm-table-undef)
48 48
49 ;;;###autoload (define-key global-map "\M-`" 'tmm-menubar) 49 ;;;###autoload (define-key global-map "\M-`" 'tmm-menubar)
50 ;;;###autoload (define-key global-map [f10] 'tmm-menubar)
51 ;;;###autoload (define-key global-map [menu-bar mouse-1] 'tmm-menubar-mouse) 50 ;;;###autoload (define-key global-map [menu-bar mouse-1] 'tmm-menubar-mouse)
52 51
53 ;;;###autoload 52 ;;;###autoload
54 (defun tmm-menubar (&optional x-position) 53 (defun tmm-menubar (&optional x-position)
55 "Text-mode emulation of looking and choosing from a menubar. 54 "Text-mode emulation of looking and choosing from a menubar.
99 See the documentation for `tmm-prompt'." 98 See the documentation for `tmm-prompt'."
100 (interactive "e") 99 (interactive "e")
101 (tmm-menubar (car (posn-x-y (event-start event))))) 100 (tmm-menubar (car (posn-x-y (event-start event)))))
102 101
103 (defcustom tmm-mid-prompt "==>" 102 (defcustom tmm-mid-prompt "==>"
104 "*String to insert between shortcut and menu item. 103 "String to insert between shortcut and menu item.
105 If nil, there will be no shortcuts. It should not consist only of spaces, 104 If nil, there will be no shortcuts. It should not consist only of spaces,
106 or else the correct item might not be found in the `*Completions*' buffer." 105 or else the correct item might not be found in the `*Completions*' buffer."
107 :type 'string 106 :type 'string
108 :group 'tmm) 107 :group 'tmm)
109 108
114 "Press PageUp key to reach this buffer from the minibuffer. 113 "Press PageUp key to reach this buffer from the minibuffer.
115 Alternatively, you can use Up/Down keys (or your History keys) to change 114 Alternatively, you can use Up/Down keys (or your History keys) to change
116 the item in the minibuffer, and press RET when you are done, or press the 115 the item in the minibuffer, and press RET when you are done, or press the
117 marked letters to pick up your choice. Type C-g or ESC ESC ESC to cancel. 116 marked letters to pick up your choice. Type C-g or ESC ESC ESC to cancel.
118 " 117 "
119 "*Help text to insert on the top of the completion buffer. 118 "Help text to insert on the top of the completion buffer.
120 To save space, you can set this to nil, 119 To save space, you can set this to nil,
121 in which case the standard introduction text is deleted too." 120 in which case the standard introduction text is deleted too."
122 :type '(choice string (const nil)) 121 :type '(choice string (const nil))
123 :group 'tmm) 122 :group 'tmm)
124 123
125 (defcustom tmm-shortcut-style '(downcase upcase) 124 (defcustom tmm-shortcut-style '(downcase upcase)
126 "*What letters to use as menu shortcuts. 125 "What letters to use as menu shortcuts.
127 Must be either one of the symbols `downcase' or `upcase', 126 Must be either one of the symbols `downcase' or `upcase',
128 or else a list of the two in the order you prefer." 127 or else a list of the two in the order you prefer."
129 :type '(choice (const downcase) 128 :type '(choice (const downcase)
130 (const upcase) 129 (const upcase)
131 (repeat (choice (const downcase) (const upcase)))) 130 (repeat (choice (const downcase) (const upcase))))
132 :group 'tmm) 131 :group 'tmm)
133 132
134 (defcustom tmm-shortcut-words 2 133 (defcustom tmm-shortcut-words 2
135 "*How many successive words to try for shortcuts, nil means all. 134 "How many successive words to try for shortcuts, nil means all.
136 If you use only one of `downcase' or `upcase' for `tmm-shortcut-style', 135 If you use only one of `downcase' or `upcase' for `tmm-shortcut-style',
137 specify nil for this variable." 136 specify nil for this variable."
138 :type '(choice integer (const nil)) 137 :type '(choice integer (const nil))
139 :group 'tmm) 138 :group 'tmm)
140 139
230 (concat gl-str 229 (concat gl-str
231 " (up/down to change, PgUp to menu): ") 230 " (up/down to change, PgUp to menu): ")
232 tmm-km-list nil t nil 231 tmm-km-list nil t nil
233 (cons 'history 232 (cons 'history
234 (- (* 2 history-len) index-of-default)))) 233 (- (* 2 history-len) index-of-default))))
235 (save-excursion 234 (remove-hook 'minibuffer-setup-hook 'tmm-add-prompt)
236 (remove-hook 'minibuffer-setup-hook 'tmm-add-prompt) 235 (if (get-buffer "*Completions*")
237 (if (get-buffer "*Completions*") 236 (with-current-buffer "*Completions*"
238 (progn 237 (use-local-map tmm-old-comp-map)
239 (set-buffer "*Completions*") 238 (bury-buffer (current-buffer)))))))))
240 (use-local-map tmm-old-comp-map)
241 (bury-buffer (current-buffer))))))))))
242 (setq choice (cdr (assoc out tmm-km-list))) 239 (setq choice (cdr (assoc out tmm-km-list)))
243 (and (null choice) 240 (and (null choice)
244 (> (length out) (length tmm-c-prompt)) 241 (> (length out) (length tmm-c-prompt))
245 (string= (substring out 0 (length tmm-c-prompt)) tmm-c-prompt) 242 (string= (substring out 0 (length tmm-c-prompt)) tmm-c-prompt)
246 (setq out (substring out (length tmm-c-prompt)) 243 (setq out (substring out (length tmm-c-prompt))
564 (setq bind (copy-sequence in))))) 561 (setq bind (copy-sequence in)))))
565 allbind) 562 allbind)
566 ;; Return that keymap. 563 ;; Return that keymap.
567 bind)))) 564 bind))))
568 565
566 ;; Huh? What's that about? --Stef
569 (add-hook 'calendar-load-hook (lambda () (require 'cal-menu))) 567 (add-hook 'calendar-load-hook (lambda () (require 'cal-menu)))
570 568
571 (provide 'tmm) 569 (provide 'tmm)
572 570
573 ;;; arch-tag: e7ddbdb6-4b95-4da3-afbe-ad6063d112f4 571 ;; arch-tag: e7ddbdb6-4b95-4da3-afbe-ad6063d112f4
574 ;;; tmm.el ends here 572 ;;; tmm.el ends here