Mercurial > emacs
comparison lisp/help-macro.el @ 5640:f0f285e628d0
(make-help-screen): Use overriding-local-map.
Recognize C-v and M-v properly.
Compute help-screen after changing the map.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 20 Jan 1994 14:27:51 +0000 |
parents | 32a291ab0c5f |
children | 90ba98c692b5 |
comparison
equal
deleted
inserted
replaced
5639:360a711e7e06 | 5640:f0f285e628d0 |
---|---|
80 and then returns." | 80 and then returns." |
81 (` (defun (, fname) () | 81 (` (defun (, fname) () |
82 (, help-text) | 82 (, help-text) |
83 (interactive) | 83 (interactive) |
84 (let ((line-prompt | 84 (let ((line-prompt |
85 (substitute-command-keys (, help-line))) | 85 (substitute-command-keys (, help-line)))) |
86 (help-screen (documentation (quote (, fname))))) | |
87 (message line-prompt) | 86 (message line-prompt) |
88 (let ((old-local-map (current-local-map)) | 87 (let* ((overriding-local-map (make-sparse-keymap)) |
89 (old-global-map (current-global-map)) | 88 (minor-mode-map-alist nil) |
90 (minor-mode-map-alist nil) | 89 config key char help-screen) |
91 config key char) | |
92 (unwind-protect | 90 (unwind-protect |
93 (progn | 91 (progn |
94 (use-global-map (, helped-map)) | 92 (setcdr overriding-local-map (, helped-map)) |
95 (use-local-map nil) | 93 (define-key overriding-local-map [t] 'undefined) |
94 (setq help-screen (documentation (quote (, fname)))) | |
96 (setq key (read-key-sequence nil)) | 95 (setq key (read-key-sequence nil)) |
97 (setq char (aref key 0)) | 96 (setq char (aref key 0)) |
98 (if (or (eq char ??) (eq char help-char)) | 97 (if (or (eq char ??) (eq char help-char)) |
99 (progn | 98 (progn |
100 (setq config (current-window-configuration)) | 99 (setq config (current-window-configuration)) |
101 (switch-to-buffer-other-window "*Help*") | 100 (switch-to-buffer-other-window "*Help*") |
102 (erase-buffer) | 101 (erase-buffer) |
103 (insert help-screen) | 102 (insert help-screen) |
104 (goto-char (point-min)) | 103 (goto-char (point-min)) |
105 (while (memq char (cons help-char '(?? ?\C-v ?\ ?\177 ?\M-v))) | 104 (while (or (memq char (cons help-char '(?? ?\C-v ?\ ?\177 ?\M-v))) |
105 (equal key "\M-v")) | |
106 (setq list (cons key list)) | |
106 (condition-case nil | 107 (condition-case nil |
107 (progn | 108 (progn |
108 (if (memq char '(?\C-v ?\ )) | 109 (if (memq char '(?\C-v ?\ )) |
109 (scroll-up)) | 110 (scroll-up)) |
110 (if (memq char '(?\177 ?\M-v)) | 111 (if (or (memq char '(?\177 ?\M-v)) |
112 (equal key "\M-v")) | |
111 (scroll-down))) | 113 (scroll-down))) |
112 (error nil)) | 114 (error nil)) |
113 (message "%s%s: " | 115 (message "%s%s: " |
114 line-prompt | 116 line-prompt |
115 (if (pos-visible-in-window-p (point-max)) | 117 (if (pos-visible-in-window-p (point-max)) |
116 "" " or Space to scroll")) | 118 "" " or Space to scroll")) |
117 (let ((cursor-in-echo-area t)) | 119 (let ((cursor-in-echo-area t)) |
118 (setq key (read-key-sequence nil) | 120 (setq key (read-key-sequence nil) |
119 char (aref key 0)))))) | 121 char (aref key 0)))) |
122 (setq list (cons key list)))) | |
120 ;; Mouse clicks are not part of the help feature, | 123 ;; Mouse clicks are not part of the help feature, |
121 ;; so reexecute them in the standard environment. | 124 ;; so reexecute them in the standard environment. |
122 (if (listp char) | 125 (if (listp char) |
123 (setq unread-command-events | 126 (setq unread-command-events |
124 (cons char unread-command-events) | 127 (cons char unread-command-events) |
128 (progn | 131 (progn |
129 (if config | 132 (if config |
130 (progn | 133 (progn |
131 (set-window-configuration config) | 134 (set-window-configuration config) |
132 (setq config nil))) | 135 (setq config nil))) |
133 (use-local-map old-local-map) | 136 (setq overriding-local-map nil) |
134 (use-global-map old-global-map) | |
135 (call-interactively defn)) | 137 (call-interactively defn)) |
136 (ding))))) | 138 (ding))))) |
137 (use-local-map old-local-map) | |
138 (use-global-map old-global-map) | |
139 (if config | 139 (if config |
140 (set-window-configuration config)))))) | 140 (set-window-configuration config)))))) |
141 )) | 141 )) |
142 | 142 |
143 ;;; help-macro.el | 143 ;;; help-macro.el |