1 |
;;; ehelp.el --- bindings for electric-help mode |
;;; ehelp.el --- bindings for electric-help mode |
2 |
|
|
3 |
;; Copyright (C) 1986, 1995, 2000, 2001 Free Software Foundation, Inc. |
;; Copyright (C) 1986, 1995, 2000, 2001, 2004 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Maintainer: FSF |
;; Maintainer: FSF |
6 |
;; Keywords: help, extensions |
;; Keywords: help, extensions |
200 |
(progn (setq unread-command-events nil) |
(progn (setq unread-command-events nil) |
201 |
(throw 'exit t))))) |
(throw 'exit t))))) |
202 |
(let (up down both neither |
(let (up down both neither |
203 |
(standard (and (eq (key-binding " ") |
(standard (and (eq (key-binding " " nil t) |
204 |
'scroll-up) |
'scroll-up) |
205 |
(eq (key-binding "\^?") |
(eq (key-binding "\^?" nil t) |
206 |
'scroll-down) |
'scroll-down) |
207 |
(eq (key-binding "q") |
(eq (key-binding "q" nil t) |
208 |
'electric-help-exit) |
'electric-help-exit) |
209 |
(eq (key-binding "r") |
(eq (key-binding "r" nil t) |
210 |
'electric-help-retain)))) |
'electric-help-retain)))) |
211 |
(Electric-command-loop |
(Electric-command-loop |
212 |
'exit |
'exit |
215 |
;beginning-of-buffer - otherwise pos-visible-in-window-p |
;beginning-of-buffer - otherwise pos-visible-in-window-p |
216 |
;will yield a wrong result. |
;will yield a wrong result. |
217 |
(let ((min (pos-visible-in-window-p (point-min))) |
(let ((min (pos-visible-in-window-p (point-min))) |
218 |
(max (pos-visible-in-window-p (point-max)))) |
(max (pos-visible-in-window-p (1- (point-max))))) |
219 |
(cond (isearch-mode 'noprompt) |
(cond (isearch-mode 'noprompt) |
220 |
((and min max) |
((and min max) |
221 |
(cond (standard "Press q to exit, r to retain ") |
(cond (standard "Press q to exit, r to retain ") |
272 |
(interactive) |
(interactive) |
273 |
(error "%s is undefined -- Press %s to exit" |
(error "%s is undefined -- Press %s to exit" |
274 |
(mapconcat 'single-key-description (this-command-keys) " ") |
(mapconcat 'single-key-description (this-command-keys) " ") |
275 |
(if (eq (key-binding "q") 'electric-help-exit) |
(if (eq (key-binding "q" nil t) 'electric-help-exit) |
276 |
"q" |
"q" |
277 |
(substitute-command-keys "\\[electric-help-exit]")))) |
(substitute-command-keys "\\[electric-help-exit]")))) |
278 |
|
|
280 |
;>>> this needs to be hairified (recursive help, anybody?) |
;>>> this needs to be hairified (recursive help, anybody?) |
281 |
(defun electric-help-help () |
(defun electric-help-help () |
282 |
(interactive) |
(interactive) |
283 |
(if (and (eq (key-binding "q") 'electric-help-exit) |
(if (and (eq (key-binding "q" nil t) 'electric-help-exit) |
284 |
(eq (key-binding " ") 'scroll-up) |
(eq (key-binding " " nil t) 'scroll-up) |
285 |
(eq (key-binding "\^?") 'scroll-down) |
(eq (key-binding "\^?" nil t) 'scroll-down) |
286 |
(eq (key-binding "r") 'electric-help-retain)) |
(eq (key-binding "r" nil t) 'electric-help-retain)) |
287 |
(message "SPC scrolls up, DEL scrolls down, q exits burying help buffer, r exits") |
(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"))) |
(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)) |
(sit-for 2)) |