comparison lisp/ehelp.el @ 55347:ca50b63ed141

(electric-help-command-loop, electric-help-undefined, electric-help-help): Check against unmapped commands.
author Juanma Barranquero <lekktu@gmail.com>
date Mon, 03 May 2004 22:21:46 +0000
parents 695cf19ef79e
children a5a7f792d532
comparison
equal deleted inserted replaced
55346:db73f720cd94 55347:ca50b63ed141
1 ;;; ehelp.el --- bindings for electric-help mode 1 ;;; ehelp.el --- bindings for electric-help mode
2 2
3 ;; Copyright (C) 1986, 1995, 2000, 2001 Free Software Foundation, Inc. 3 ;; Copyright (C) 1986, 1995, 2000, 2001, 2004 Free Software Foundation, Inc.
4 4
5 ;; Maintainer: FSF 5 ;; Maintainer: FSF
6 ;; Keywords: help, extensions 6 ;; Keywords: help, extensions
7 7
8 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
198 (if (equal (setq unread-command-events (list (read-event))) 198 (if (equal (setq unread-command-events (list (read-event)))
199 '(?\ )) 199 '(?\ ))
200 (progn (setq unread-command-events nil) 200 (progn (setq unread-command-events nil)
201 (throw 'exit t))))) 201 (throw 'exit t)))))
202 (let (up down both neither 202 (let (up down both neither
203 (standard (and (eq (key-binding " ") 203 (standard (and (eq (key-binding " " nil t)
204 'scroll-up) 204 'scroll-up)
205 (eq (key-binding "\^?") 205 (eq (key-binding "\^?" nil t)
206 'scroll-down) 206 'scroll-down)
207 (eq (key-binding "q") 207 (eq (key-binding "q" nil t)
208 'electric-help-exit) 208 'electric-help-exit)
209 (eq (key-binding "r") 209 (eq (key-binding "r" nil t)
210 'electric-help-retain)))) 210 'electric-help-retain))))
211 (Electric-command-loop 211 (Electric-command-loop
212 'exit 212 'exit
213 (function (lambda () 213 (function (lambda ()
214 (sit-for 0) ;necessary if last command was end-of-buffer or 214 (sit-for 0) ;necessary if last command was end-of-buffer or
270 270
271 (defun electric-help-undefined () 271 (defun electric-help-undefined ()
272 (interactive) 272 (interactive)
273 (error "%s is undefined -- Press %s to exit" 273 (error "%s is undefined -- Press %s to exit"
274 (mapconcat 'single-key-description (this-command-keys) " ") 274 (mapconcat 'single-key-description (this-command-keys) " ")
275 (if (eq (key-binding "q") 'electric-help-exit) 275 (if (eq (key-binding "q" nil t) 'electric-help-exit)
276 "q" 276 "q"
277 (substitute-command-keys "\\[electric-help-exit]")))) 277 (substitute-command-keys "\\[electric-help-exit]"))))
278 278
279 279
280 ;>>> this needs to be hairified (recursive help, anybody?) 280 ;>>> this needs to be hairified (recursive help, anybody?)
281 (defun electric-help-help () 281 (defun electric-help-help ()
282 (interactive) 282 (interactive)
283 (if (and (eq (key-binding "q") 'electric-help-exit) 283 (if (and (eq (key-binding "q" nil t) 'electric-help-exit)
284 (eq (key-binding " ") 'scroll-up) 284 (eq (key-binding " " nil t) 'scroll-up)
285 (eq (key-binding "\^?") 'scroll-down) 285 (eq (key-binding "\^?" nil t) 'scroll-down)
286 (eq (key-binding "r") 'electric-help-retain)) 286 (eq (key-binding "r" nil t) 'electric-help-retain))
287 (message "SPC scrolls up, DEL scrolls down, q exits burying help buffer, r exits") 287 (message "SPC scrolls up, DEL scrolls down, q exits burying help buffer, r exits")
288 (message "%s" (substitute-command-keys "\\[scroll-up] scrolls up, \\[scroll-down] scrolls down, \\[electric-help-exit] exits burying help buffer, \\[electric-help-retain] exits"))) 288 (message "%s" (substitute-command-keys "\\[scroll-up] scrolls up, \\[scroll-down] scrolls down, \\[electric-help-exit] exits burying help buffer, \\[electric-help-retain] exits")))
289 (sit-for 2)) 289 (sit-for 2))
290 290
291 291