diff options
author | Richard M. Stallman <rms@gnu.org> | 1993-05-26 19:12:18 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1993-05-26 19:12:18 +0000 |
commit | c968e96c800fcbb89609bfcbe33689919eca3ae5 (patch) | |
tree | 70e47a0a21e281f9d4a1c0f75e8a7013666cf965 | |
parent | bc2ada626ab5102f645c23d755e4754988fced4b (diff) | |
download | emacs-c968e96c800fcbb89609bfcbe33689919eca3ae5.tar.gz |
(make-help-screen): Handle mouse events.
Be smart about window configurations--when and whether to restore.
-rw-r--r-- | lisp/help-macro.el | 63 |
1 files changed, 39 insertions, 24 deletions
diff --git a/lisp/help-macro.el b/lisp/help-macro.el index 04699ae3875..d12db10a270 100644 --- a/lisp/help-macro.el +++ b/lisp/help-macro.el @@ -81,30 +81,45 @@ from the HELPED-MAP and the corresponding interactive function is executed." (let ((line-prompt (substitute-command-keys (, help-line)))) (message line-prompt) - (let ((char (read-char))) - (if (or (= char ??) (= char help-char)) - (save-window-excursion - (switch-to-buffer-other-window "*Help*") - (erase-buffer) - (insert (documentation (quote (, fname)))) - (goto-char (point-min)) - (while (memq char (cons help-char '(?? ?\C-v ?\ ?\177 ?\M-v))) - (if (memq char '(?\C-v ?\ )) - (scroll-up)) - (if (memq char '(?\177 ?\M-v)) - (scroll-down)) - (message "%s%s: " - line-prompt - (if (pos-visible-in-window-p (point-max)) - "" " or Space to scroll")) - (let ((cursor-in-echo-area t)) - (setq char (read-char)))))) - (let ((defn (cdr (assq (downcase char) (, helped-map))))) - (if defn - (if (keymapp defn) - (error "sorry, this command cannot be run from the help screen. Start over.") - (call-interactively defn)) - (ding)))))) + (let ((char (read-event)) + config) + (unwind-protect + (progn + (if (or (eq char ??) (eq char help-char)) + (progn + (setq config (current-window-configuration)) + (switch-to-buffer-other-window "*Help*") + (erase-buffer) + (insert (documentation (quote (, fname)))) + (goto-char (point-min)) + (while (memq char (cons help-char '(?? ?\C-v ?\ ?\177 ?\M-v))) + (if (memq char '(?\C-v ?\ )) + (scroll-up)) + (if (memq char '(?\177 ?\M-v)) + (scroll-down)) + (message "%s%s: " + line-prompt + (if (pos-visible-in-window-p (point-max)) + "" " or Space to scroll")) + (let ((cursor-in-echo-area t)) + (setq char (read-event)))))) + + (let ((defn (cdr (assq (if (integerp char) (downcase char) char) (, helped-map))))) + (if defn + (if (keymapp defn) + (error "sorry, this command cannot be run from the help screen. Start over.") + (if config + (progn + (set-window-configuration config) + (setq config nil))) + (call-interactively defn)) + (if (listp char) + (setq unread-command-events + (cons char unread-command-events) + config nil) + (ding))))) + (if config + (set-window-configuration config)))))) )) ;;; help-macro.el |