diff options
| author | Richard M. Stallman | 1996-02-03 03:18:00 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-02-03 03:18:00 +0000 |
| commit | db30b383887214cd26213f0c431be6ba9fafaa9c (patch) | |
| tree | 7d9b2327f80e3bec919ea791ad8d8e971e44d3d2 | |
| parent | 4115d3f71e0c6ae8844ab8c8d502746e4a4c3cfb (diff) | |
| download | emacs-db30b383887214cd26213f0c431be6ba9fafaa9c.tar.gz emacs-db30b383887214cd26213f0c431be6ba9fafaa9c.zip | |
(with-electric-help):
Bind inhibit-read-only around the erase-buffer.
(electric-help-form-to-execute): Renamed from to-be-executed.
Add defvar for it.
(electric-help-mode): Turn off view-mode.
| -rw-r--r-- | lisp/ehelp.el | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lisp/ehelp.el b/lisp/ehelp.el index c03003205e4..8063ec3954c 100644 --- a/lisp/ehelp.el +++ b/lisp/ehelp.el | |||
| @@ -42,6 +42,8 @@ | |||
| 42 | (defvar electric-help-map () | 42 | (defvar electric-help-map () |
| 43 | "Keymap defining commands available in `electric-help-mode'.") | 43 | "Keymap defining commands available in `electric-help-mode'.") |
| 44 | 44 | ||
| 45 | (defvar electric-help-form-to-execute nil) | ||
| 46 | |||
| 45 | (put 'electric-help-undefined 'suppress-keymap t) | 47 | (put 'electric-help-undefined 'suppress-keymap t) |
| 46 | (if electric-help-map | 48 | (if electric-help-map |
| 47 | () | 49 | () |
| @@ -87,6 +89,7 @@ | |||
| 87 | (setq mode-line-buffer-identification '(" Help: %b")) | 89 | (setq mode-line-buffer-identification '(" Help: %b")) |
| 88 | (use-local-map electric-help-map) | 90 | (use-local-map electric-help-map) |
| 89 | (setq mouse-leave-buffer-hook '(electric-help-retain)) | 91 | (setq mouse-leave-buffer-hook '(electric-help-retain)) |
| 92 | (view-mode -1) | ||
| 90 | ;; this is done below in with-electric-help | 93 | ;; this is done below in with-electric-help |
| 91 | ;(run-hooks 'electric-help-mode-hook) | 94 | ;(run-hooks 'electric-help-mode-hook) |
| 92 | ) | 95 | ) |
| @@ -120,7 +123,7 @@ BUFFER is put into `default-major-mode' (or `fundamental-mode') when we exit." | |||
| 120 | (let ((one (one-window-p t)) | 123 | (let ((one (one-window-p t)) |
| 121 | (config (current-window-configuration)) | 124 | (config (current-window-configuration)) |
| 122 | (bury nil) | 125 | (bury nil) |
| 123 | (to-be-executed nil)) | 126 | (electric-help-form-to-execute nil)) |
| 124 | (unwind-protect | 127 | (unwind-protect |
| 125 | (save-excursion | 128 | (save-excursion |
| 126 | (if one (goto-char (window-start (selected-window)))) | 129 | (if one (goto-char (window-start (selected-window)))) |
| @@ -131,7 +134,9 @@ BUFFER is put into `default-major-mode' (or `fundamental-mode') when we exit." | |||
| 131 | (if (and minheight (< (window-height) minheight)) | 134 | (if (and minheight (< (window-height) minheight)) |
| 132 | (enlarge-window (- minheight (window-height)))) | 135 | (enlarge-window (- minheight (window-height)))) |
| 133 | (electric-help-mode) | 136 | (electric-help-mode) |
| 134 | (or noerase (erase-buffer))) | 137 | (or noerase |
| 138 | (let ((inhibit-read-only t)) | ||
| 139 | (erase-buffer)))) | ||
| 135 | (let ((standard-output buffer)) | 140 | (let ((standard-output buffer)) |
| 136 | (if (not (funcall thunk)) | 141 | (if (not (funcall thunk)) |
| 137 | (progn | 142 | (progn |
| @@ -159,7 +164,7 @@ BUFFER is put into `default-major-mode' (or `fundamental-mode') when we exit." | |||
| 159 | (replace-buffer-in-windows buffer) | 164 | (replace-buffer-in-windows buffer) |
| 160 | ;; must do this outside of save-window-excursion | 165 | ;; must do this outside of save-window-excursion |
| 161 | (bury-buffer buffer))) | 166 | (bury-buffer buffer))) |
| 162 | (eval to-be-executed)))) | 167 | (eval electric-help-form-to-execute)))) |
| 163 | 168 | ||
| 164 | (defun electric-help-command-loop () | 169 | (defun electric-help-command-loop () |
| 165 | (catch 'exit | 170 | (catch 'exit |
| @@ -311,14 +316,14 @@ will select it.)" | |||
| 311 | ;; continues with execute-extended-command. | 316 | ;; continues with execute-extended-command. |
| 312 | (defun electric-help-execute-extended (prefixarg) | 317 | (defun electric-help-execute-extended (prefixarg) |
| 313 | (interactive "p") | 318 | (interactive "p") |
| 314 | (setq to-be-executed '(execute-extended-command nil)) | 319 | (setq electric-help-form-to-execute '(execute-extended-command nil)) |
| 315 | (electric-help-retain)) | 320 | (electric-help-retain)) |
| 316 | 321 | ||
| 317 | ;; This is to be buond to C-x in ehelp mode. Retains ehelp buffer and then | 322 | ;; This is to be buond to C-x in ehelp mode. Retains ehelp buffer and then |
| 318 | ;; continues with ctrl-x prefix. | 323 | ;; continues with ctrl-x prefix. |
| 319 | (defun electric-help-ctrl-x-prefix (prefixarg) | 324 | (defun electric-help-ctrl-x-prefix (prefixarg) |
| 320 | (interactive "p") | 325 | (interactive "p") |
| 321 | (setq to-be-executed '(progn (message nil) (setq unread-command-char ?\C-x))) | 326 | (setq electric-help-form-to-execute '(progn (message nil) (setq unread-command-char ?\C-x))) |
| 322 | (electric-help-retain)) | 327 | (electric-help-retain)) |
| 323 | 328 | ||
| 324 | 329 | ||