ehelp.el 16.7 KB
Newer Older
1
;;; ehelp.el --- bindings for electric-help mode -*- lexical-binding: t -*-
Eric S. Raymond's avatar
Eric S. Raymond committed
2

Paul Eggert's avatar
Paul Eggert committed
3
;; Copyright (C) 1986, 1995, 2000-2020 Free Software Foundation, Inc.
Eric S. Raymond's avatar
Eric S. Raymond committed
4

5 6
;; Author: Richard Mlynarik
;; (according to ack.texi and authors.el)
7
;; Maintainer: emacs-devel@gnu.org
Eric S. Raymond's avatar
Eric S. Raymond committed
8
;; Keywords: help, extensions
Eric S. Raymond's avatar
Eric S. Raymond committed
9

Joseph Arceneaux's avatar
Joseph Arceneaux committed
10 11
;; This file is part of GNU Emacs.

12
;; GNU Emacs is free software: you can redistribute it and/or modify
Joseph Arceneaux's avatar
Joseph Arceneaux committed
13
;; it under the terms of the GNU General Public License as published by
14 15
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
Joseph Arceneaux's avatar
Joseph Arceneaux committed
16 17 18 19 20 21 22

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
23
;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
Joseph Arceneaux's avatar
Joseph Arceneaux committed
24

25 26 27
;;; Commentary:

;; This package provides a pre-packaged `Electric Help Mode' for
28
;; browsing Emacs help screens.  There is one entry point,
29
;; `with-electric-help'; all you have to give it is a no-argument
Jim Blandy's avatar
Jim Blandy committed
30
;; function that generates the actual text of the help into the current
31 32
;; buffer.

33 34 35 36 37 38
;; To make this the default, you must do
;; (require 'ehelp)
;; (define-key global-map "\C-h" 'ehelp-command)
;; (define-key global-map [help] 'ehelp-command)
;; (define-key global-map [f1] 'ehelp-command)

Eric S. Raymond's avatar
Eric S. Raymond committed
39 40
;;; Code:

Joseph Arceneaux's avatar
Joseph Arceneaux committed
41 42
(require 'electric)

Richard M. Stallman's avatar
Richard M. Stallman committed
43 44
(defvar electric-help-form-to-execute nil)

45 46 47 48 49 50 51 52 53 54
(defgroup electric-help ()
  "Electric help facility."
  :version "21.1"
  :group 'help)

(defcustom electric-help-shrink-window t
  "If set, adjust help window sizes to buffer sizes when displaying help."
  :type 'boolean
  :group 'electric-help)

55 56 57 58 59
(defcustom electric-help-mode-hook nil
  "Hook run by `with-electric-help' after initializing the buffer."
  :type 'hook
  :group 'electric-help)

Joseph Arceneaux's avatar
Joseph Arceneaux committed
60
(put 'electric-help-undefined 'suppress-keymap t)
61 62

(defvar electric-help-map
Joseph Arceneaux's avatar
Joseph Arceneaux committed
63
  (let ((map (make-keymap)))
64 65
    ;; FIXME fragile.  Should derive from help-mode-map in a smarter way.
    (set-keymap-parent map button-buffer-map)
Richard M. Stallman's avatar
Richard M. Stallman committed
66 67
    ;; allow all non-self-inserting keys - search, scroll, etc, but
    ;; let M-x and C-x exit ehelp mode and retain buffer:
68
    (suppress-keymap map)
Richard M. Stallman's avatar
Richard M. Stallman committed
69 70 71 72 73 74 75 76 77 78 79
    (define-key map "\C-u" 'electric-help-undefined)
    (define-key map [?\C-0] 'electric-help-undefined)
    (define-key map [?\C-1] 'electric-help-undefined)
    (define-key map [?\C-2] 'electric-help-undefined)
    (define-key map [?\C-3] 'electric-help-undefined)
    (define-key map [?\C-4] 'electric-help-undefined)
    (define-key map [?\C-5] 'electric-help-undefined)
    (define-key map [?\C-6] 'electric-help-undefined)
    (define-key map [?\C-7] 'electric-help-undefined)
    (define-key map [?\C-8] 'electric-help-undefined)
    (define-key map [?\C-9] 'electric-help-undefined)
Joseph Arceneaux's avatar
Joseph Arceneaux committed
80 81 82
    (define-key map (char-to-string help-char) 'electric-help-help)
    (define-key map "?" 'electric-help-help)
    (define-key map " " 'scroll-up)
83
    (define-key map [?\S-\ ] 'scroll-down)
Joseph Arceneaux's avatar
Joseph Arceneaux committed
84 85 86 87 88 89
    (define-key map "\^?" 'scroll-down)
    (define-key map "." 'beginning-of-buffer)
    (define-key map "<" 'beginning-of-buffer)
    (define-key map ">" 'end-of-buffer)
    ;(define-key map "\C-g" 'electric-help-exit)
    (define-key map "Q" 'electric-help-exit)
90
    (define-key map "q" 'electric-help-exit)
Joseph Arceneaux's avatar
Joseph Arceneaux committed
91
    ;;a better key than this?
92
    (define-key map "R" 'electric-help-retain)
93
    (define-key map "r" 'electric-help-retain)
Richard M. Stallman's avatar
Richard M. Stallman committed
94 95
    (define-key map "\ex" 'electric-help-execute-extended)
    (define-key map "\C-x" 'electric-help-ctrl-x-prefix)
96 97
    map)
  "Keymap defining commands available in `electric-help-mode'.")
Richard M. Stallman's avatar
Richard M. Stallman committed
98

99 100 101
(defvar electric-help-orig-major-mode nil)
(make-variable-buffer-local 'electric-help-orig-major-mode)

Joseph Arceneaux's avatar
Joseph Arceneaux committed
102
(defun electric-help-mode ()
Jim Blandy's avatar
Jim Blandy committed
103
  "`with-electric-help' temporarily places its buffer in this mode.
104
\(On exit from `with-electric-help', the original `major-mode' is restored.)"
Joseph Arceneaux's avatar
Joseph Arceneaux committed
105
  (setq buffer-read-only t)
106
  (setq electric-help-orig-major-mode major-mode)
Joseph Arceneaux's avatar
Joseph Arceneaux committed
107
  (setq mode-name "Help")
108
  (setq major-mode 'help-mode)
Joseph Arceneaux's avatar
Joseph Arceneaux committed
109 110
  (setq mode-line-buffer-identification '(" Help:  %b"))
  (use-local-map electric-help-map)
111
  (add-hook 'mouse-leave-buffer-hook 'electric-help-retain)
Richard M. Stallman's avatar
Richard M. Stallman committed
112
  (view-mode -1)
Joseph Arceneaux's avatar
Joseph Arceneaux committed
113 114 115 116
  ;; this is done below in with-electric-help
  ;(run-hooks 'electric-help-mode-hook)
  )

117
;;;###autoload
118
(defun with-electric-help (thunk &optional buffer noerase minheight)
119
  "Pop up an \"electric\" help buffer.
Richard M. Stallman's avatar
Richard M. Stallman committed
120 121 122 123
THUNK is a function of no arguments which is called to initialize the
contents of BUFFER.  BUFFER defaults to `*Help*'.  BUFFER will be
erased before THUNK is called unless NOERASE is non-nil.  THUNK will
be called while BUFFER is current and with `standard-output' bound to
124 125
the buffer specified by BUFFER.

126 127
If THUNK returns nil, we display BUFFER starting at the top, and shrink
the window to fit.  If THUNK returns non-nil, we don't do those things.
Joseph Arceneaux's avatar
Joseph Arceneaux committed
128

129 130 131 132
After THUNK has been called, this function \"electrically\" pops up a
window in which BUFFER is displayed and allows the user to scroll
through that buffer in `electric-help-mode'.  The window's height will
be at least MINHEIGHT if this value is non-nil.
Richard M. Stallman's avatar
Richard M. Stallman committed
133 134

If THUNK returns nil, we display BUFFER starting at the top, and
135 136
shrink the window to fit if `electric-help-shrink-window' is non-nil.
If THUNK returns non-nil, we don't do those things.
Richard M. Stallman's avatar
Richard M. Stallman committed
137

Eli Zaretskii's avatar
Eli Zaretskii committed
138 139
When the user exits (with `electric-help-exit', or otherwise), the help
buffer's window disappears (i.e., we use `save-window-excursion'), and
140
BUFFER is put back into its original major mode."
Joseph Arceneaux's avatar
Joseph Arceneaux committed
141 142
  (setq buffer (get-buffer-create (or buffer "*Help*")))
  (let ((one (one-window-p t))
root's avatar
root committed
143
	(config (current-window-configuration))
Richard M. Stallman's avatar
Richard M. Stallman committed
144
        (bury nil)
Richard M. Stallman's avatar
Richard M. Stallman committed
145
        (electric-help-form-to-execute nil))
root's avatar
root committed
146 147
    (unwind-protect
         (save-excursion
148
           (when one
149
	     (goto-char (window-start)))
root's avatar
root committed
150 151
           (let ((pop-up-windows t))
             (pop-to-buffer buffer))
152
           (with-current-buffer buffer
153 154
             (when (and minheight (< (window-height) minheight))
	       (enlarge-window (- minheight (window-height))))
root's avatar
root committed
155
             (electric-help-mode)
156
	     (setq buffer-read-only nil)
157 158
	     (unless noerase
	       (erase-buffer)))
root's avatar
root committed
159
           (let ((standard-output buffer))
160 161 162 163 164 165
             (unless (funcall thunk)
	       (set-buffer buffer)
	       (set-buffer-modified-p nil)
	       (goto-char (point-min))
	       (when (and one electric-help-shrink-window)
		 (shrink-window-if-larger-than-buffer))))
root's avatar
root committed
166 167
           (set-buffer buffer)
           (run-hooks 'electric-help-mode-hook)
168
	   (setq buffer-read-only t)
169
           (if (eq (car-safe (electric-help-command-loop)) 'retain)
root's avatar
root committed
170
               (setq config (current-window-configuration))
171
	     (setq bury t))
172
	   ;; Remove the hook.
173 174
	   (when (memq 'electric-help-retain mouse-leave-buffer-hook)
	     (remove-hook 'mouse-leave-buffer-hook 'electric-help-retain)))
root's avatar
root committed
175 176 177
      (message "")
      (set-buffer buffer)
      (setq buffer-read-only nil)
178

179
      ;; Restore the original major mode saved by `electric-help-mode'.
180 181
      ;; We should really get a usable *Help* buffer when retaining
      ;; the electric one with `r'.  The problem is that a simple
182 183 184 185 186 187
      ;; call to `help-mode' won't cut it; e.g. RET is bound wrong
      ;; afterwards (`View-scroll-line-forward' instead of `help-follow').
      ;; That's because Help mode should be set with `with-help-window'
      ;; instead of the direct call to `help-mode'. But at least
      ;; RET works correctly on links after using `help-mode'.
      ;; This is satisfactory enough.
root's avatar
root committed
188
      (condition-case ()
189
          (funcall (or electric-help-orig-major-mode 'fundamental-mode))
root's avatar
root committed
190
        (error nil))
191

root's avatar
root committed
192
      (set-window-configuration config)
193
      (when bury
Eli Zaretskii's avatar
Eli Zaretskii committed
194
	;;>> Perhaps this shouldn't be done,
195 196 197 198
	;; so that when we say "Press space to bury" we mean it
	(replace-buffer-in-windows buffer)
	;; must do this outside of save-window-excursion
	(bury-buffer buffer))
Stefan Monnier's avatar
Stefan Monnier committed
199 200 201
      (if (functionp electric-help-form-to-execute)
          (funcall electric-help-form-to-execute)
        (eval electric-help-form-to-execute)))))
Joseph Arceneaux's avatar
Joseph Arceneaux committed
202 203 204 205

(defun electric-help-command-loop ()
  (catch 'exit
    (if (pos-visible-in-window-p (point-max))
206
	(progn (message "%s" (substitute-command-keys "<<< Press Space to bury the help buffer, Press \\[electric-help-retain] to retain it >>>"))
207 208 209 210
               (let ((ev (read-event)))
                 (if (equal ev ?\s)
                     (throw 'exit t)
                   (push ev unread-command-events)))))
Joseph Arceneaux's avatar
Joseph Arceneaux committed
211
    (let (up down both neither
212
	  (standard (and (eq (key-binding " " nil t)
Joseph Arceneaux's avatar
Joseph Arceneaux committed
213
			     'scroll-up)
214
			 (eq (key-binding "\^?" nil t)
Joseph Arceneaux's avatar
Joseph Arceneaux committed
215
			     'scroll-down)
216
			 (eq (key-binding "q" nil t)
217
			     'electric-help-exit)
218
			 (eq (key-binding "r" nil t)
219
			     'electric-help-retain))))
Joseph Arceneaux's avatar
Joseph Arceneaux committed
220 221 222
      (Electric-command-loop
        'exit
	(function (lambda ()
223 224
	  (sit-for 0) ;necessary if last command was end-of-buffer or
	              ;beginning-of-buffer - otherwise pos-visible-in-window-p
Richard M. Stallman's avatar
Richard M. Stallman committed
225
	              ;will yield a wrong result.
Joseph Arceneaux's avatar
Joseph Arceneaux committed
226
	  (let ((min (pos-visible-in-window-p (point-min)))
227
		(max (pos-visible-in-window-p (1- (point-max)))))
Richard M. Stallman's avatar
Richard M. Stallman committed
228 229
	    (cond (isearch-mode 'noprompt)
		  ((and min max)
230
		   (cond (standard "Press q to exit, r to retain ")
Joseph Arceneaux's avatar
Joseph Arceneaux committed
231
			 (neither)
232
			 (t (setq neither (substitute-command-keys "Press \\[electric-help-exit] to exit, \\[electric-help-retain] to retain ")))))
Joseph Arceneaux's avatar
Joseph Arceneaux committed
233
		  (min
234
		   (cond (standard "Press SPC to scroll, q to exit, r to retain ")
Joseph Arceneaux's avatar
Joseph Arceneaux committed
235
			 (up)
236
			 (t (setq up (substitute-command-keys "Press \\[scroll-up] to scroll, \\[electric-help-exit] to exit, \\[electric-help-retain] to retain ")))))
Joseph Arceneaux's avatar
Joseph Arceneaux committed
237
		  (max
Richard M. Stallman's avatar
Richard M. Stallman committed
238
		   (cond (standard "Press DEL to scroll back, q to exit, r to retain ")
Joseph Arceneaux's avatar
Joseph Arceneaux committed
239
			 (down)
240
			 (t (setq down (substitute-command-keys "Press \\[scroll-down] to scroll back, \\[electric-help-exit] to exit, \\[electric-help-retain] to retain ")))))
Joseph Arceneaux's avatar
Joseph Arceneaux committed
241
		  (t
Richard M. Stallman's avatar
Richard M. Stallman committed
242
		   (cond (standard "Press SPC to scroll, DEL to scroll back, q to exit, r to retain ")
Joseph Arceneaux's avatar
Joseph Arceneaux committed
243
			 (both)
244
			 (t (setq both (substitute-command-keys "Press \\[scroll-up] to scroll, \\[scroll-down] to scroll back, \\[electric-help-exit] to exit, \\[electric-help-retain] to retain ")))))))))
Joseph Arceneaux's avatar
Joseph Arceneaux committed
245 246 247 248 249 250 251 252 253 254 255 256
		    t))))



;(defun electric-help-scroll-up (arg)
;  ">>>Doc"
;  (interactive "P")
;  (if (and (null arg) (pos-visible-in-window-p (point-max)))
;      (electric-help-exit)
;    (scroll-up arg)))

(defun electric-help-exit ()
257
  "Exit `with-electric-help', restoring the previous window/buffer configuration.
258
\(The *Help* buffer will be buried.)"
Joseph Arceneaux's avatar
Joseph Arceneaux committed
259
  (interactive)
260 261 262 263 264 265
  ;; Make sure that we don't throw twice, even if two events cause
  ;; calling this function:
  (if (memq 'electric-help-retain mouse-leave-buffer-hook)
      (progn
	(remove-hook 'mouse-leave-buffer-hook 'electric-help-retain)
	(throw 'exit t))))
Joseph Arceneaux's avatar
Joseph Arceneaux committed
266 267

(defun electric-help-retain ()
268
  "Exit `with-electric-help', retaining the current window/buffer configuration.
Joseph Arceneaux's avatar
Joseph Arceneaux committed
269 270 271
\(The *Help* buffer will not be selected, but \\[switch-to-buffer-other-window] RET
will select it.)"
  (interactive)
Richard M. Stallman's avatar
Richard M. Stallman committed
272 273
  ;; Make sure that we don't throw twice, even if two events cause
  ;; calling this function:
274 275 276 277
  (if (memq 'electric-help-retain mouse-leave-buffer-hook)
      (progn
	(remove-hook 'mouse-leave-buffer-hook 'electric-help-retain)
	(throw 'exit '(retain)))))
Joseph Arceneaux's avatar
Joseph Arceneaux committed
278 279 280 281 282 283


(defun electric-help-undefined ()
  (interactive)
  (error "%s is undefined -- Press %s to exit"
	 (mapconcat 'single-key-description (this-command-keys) " ")
284
	 (if (eq (key-binding "q" nil t) 'electric-help-exit)
Richard M. Stallman's avatar
Richard M. Stallman committed
285
	     "q"
Joseph Arceneaux's avatar
Joseph Arceneaux committed
286 287 288 289 290 291
	   (substitute-command-keys "\\[electric-help-exit]"))))


;>>> this needs to be hairified (recursive help, anybody?)
(defun electric-help-help ()
  (interactive)
292 293 294 295
  (if (and (eq (key-binding "q" nil t) 'electric-help-exit)
	   (eq (key-binding " " nil t) 'scroll-up)
	   (eq (key-binding "\^?" nil t) 'scroll-down)
	   (eq (key-binding "r" nil t) 'electric-help-retain))
296 297
      (message "SPC scrolls up, DEL scrolls down, q exits burying help buffer, r 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")))
Joseph Arceneaux's avatar
Joseph Arceneaux committed
298 299 300
  (sit-for 2))


301
;;;###autoload
302 303
(defun electric-helpify (fun &optional name)
  (let ((name (or name "*Help*")))
Joseph Arceneaux's avatar
Joseph Arceneaux committed
304 305
    (if (save-window-excursion
	  ;; kludge-o-rama
306
	  (let* ((p (symbol-function 'help-print-return-message))
Joseph Arceneaux's avatar
Joseph Arceneaux committed
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335
		 (b (get-buffer name))
		 (m (buffer-modified-p b)))
	    (and b (not (get-buffer-window b))
		 (setq b nil))
	    (unwind-protect
		(progn
		  (message "%s..." (capitalize (symbol-name fun)))
		  ;; with-output-to-temp-buffer marks the buffer as unmodified.
		  ;; kludging excessively and relying on that as some sort
		  ;;  of indication leads to the following abomination...
		  ;;>> This would be doable without such icky kludges if either
		  ;;>> (a) there were a function to read the interactive
		  ;;>>     args for a command and return a list of those args.
		  ;;>>     (To which one would then just apply the command)
		  ;;>>     (The only problem with this is that interactive-p
		  ;;>>      would break, but that is such a misfeature in
		  ;;>>      any case that I don't care)
		  ;;>>     It is easy to do this for emacs-lisp functions;
		  ;;>>     the only problem is getting the interactive spec
		  ;;>>     for subrs
		  ;;>> (b) there were a function which returned a
		  ;;>>     modification-tick for a buffer.  One could tell
		  ;;>>     whether a buffer had changed by whether the
		  ;;>>     modification-tick were different.
		  ;;>>     (Presumably there would have to be a way to either
		  ;;>>      restore the tick to some previous value, or to
		  ;;>>      suspend updating of the tick in order to allow
		  ;;>>      things like momentary-string-display)
		  (and b
336
		       (with-current-buffer b
Joseph Arceneaux's avatar
Joseph Arceneaux committed
337
			 (set-buffer-modified-p t)))
338
		  (fset 'help-print-return-message 'ignore)
Joseph Arceneaux's avatar
Joseph Arceneaux committed
339 340 341 342 343 344
		  (call-interactively fun)
		  (and (get-buffer name)
		       (get-buffer-window (get-buffer name))
		       (or (not b)
			   (not (eq b (get-buffer name)))
			   (not (buffer-modified-p b)))))
345
	      (fset 'help-print-return-message p)
Joseph Arceneaux's avatar
Joseph Arceneaux committed
346
	      (and b (buffer-name b)
347
		   (with-current-buffer b
Joseph Arceneaux's avatar
Joseph Arceneaux committed
348 349 350
		     (set-buffer-modified-p m))))))
	(with-electric-help 'ignore name t))))

Richard M. Stallman's avatar
Richard M. Stallman committed
351 352


353
;; This is to be bound to M-x in ehelp mode. Retains ehelp buffer and then
Richard M. Stallman's avatar
Richard M. Stallman committed
354
;; continues with execute-extended-command.
355
(defun electric-help-execute-extended (_prefixarg)
Richard M. Stallman's avatar
Richard M. Stallman committed
356
  (interactive "p")
Stefan Monnier's avatar
Stefan Monnier committed
357
  (setq electric-help-form-to-execute
Lars Ingebrigtsen's avatar
Lars Ingebrigtsen committed
358 359 360 361
        (lambda ()
          (with-suppressed-warnings ((interactive-only
                                      execute-extended-command))
            (execute-extended-command nil))))
Richard M. Stallman's avatar
Richard M. Stallman committed
362 363 364 365
  (electric-help-retain))

;; This is to be buond to C-x in ehelp mode. Retains ehelp buffer and then
;; continues with ctrl-x prefix.
366
(defun electric-help-ctrl-x-prefix (_prefixarg)
Richard M. Stallman's avatar
Richard M. Stallman committed
367
  (interactive "p")
Stefan Monnier's avatar
Stefan Monnier committed
368 369 370 371 372
  (setq electric-help-form-to-execute
        (lambda ()
          (message nil)
          (setq unread-command-events
                (append unread-command-events '(?\C-x)))))
Richard M. Stallman's avatar
Richard M. Stallman committed
373 374
  (electric-help-retain))

Joseph Arceneaux's avatar
Joseph Arceneaux committed
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410

(defun electric-describe-key ()
  (interactive)
  (electric-helpify 'describe-key))

(defun electric-describe-mode ()
  (interactive)
  (electric-helpify 'describe-mode))

(defun electric-view-lossage ()
  (interactive)
  (electric-helpify 'view-lossage))

;(defun electric-help-for-help ()
;  "See help-for-help"
;  (interactive)
;  )

(defun electric-describe-function ()
  (interactive)
  (electric-helpify 'describe-function))

(defun electric-describe-variable ()
  (interactive)
  (electric-helpify 'describe-variable))

(defun electric-describe-bindings ()
  (interactive)
  (electric-helpify 'describe-bindings))

(defun electric-describe-syntax ()
  (interactive)
  (electric-helpify 'describe-syntax))

(defun electric-command-apropos ()
  (interactive)
411
  (electric-helpify 'command-apropos "*Apropos*"))
Joseph Arceneaux's avatar
Joseph Arceneaux committed
412 413 414

;(define-key help-map "a" 'electric-command-apropos)

415 416 417
(defun electric-apropos ()
  (interactive)
  (electric-helpify 'apropos))
Joseph Arceneaux's avatar
Joseph Arceneaux committed
418 419 420 421


;;;; ehelp-map

422
(defvar ehelp-map
423
  (let ((map (copy-keymap help-map)))
Richard M. Stallman's avatar
Richard M. Stallman committed
424
    (substitute-key-definition 'apropos 'electric-apropos map)
425
    (substitute-key-definition 'command-apropos 'electric-command-apropos map)
Joseph Arceneaux's avatar
Joseph Arceneaux committed
426 427 428 429 430 431 432
    (substitute-key-definition 'describe-key 'electric-describe-key map)
    (substitute-key-definition 'describe-mode 'electric-describe-mode map)
    (substitute-key-definition 'view-lossage 'electric-view-lossage map)
    (substitute-key-definition 'describe-function 'electric-describe-function map)
    (substitute-key-definition 'describe-variable 'electric-describe-variable map)
    (substitute-key-definition 'describe-bindings 'electric-describe-bindings map)
    (substitute-key-definition 'describe-syntax 'electric-describe-syntax map)
433
    map))
434 435 436 437

;;;###(autoload 'ehelp-command "ehelp" "Prefix command for ehelp." t 'keymap)
(defalias 'ehelp-command ehelp-map)
(put 'ehelp-command 'documentation "Prefix command for ehelp.")
Joseph Arceneaux's avatar
Joseph Arceneaux committed
438

439
(provide 'ehelp)
Jim Blandy's avatar
Jim Blandy committed
440

Eric S. Raymond's avatar
Eric S. Raymond committed
441
;;; ehelp.el ends here