emacs/lisp/ehelp.elc
2017-10-18 13:31:44 -04:00

81 lines
7.2 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(require (quote electric))
(provide (quote ehelp))
(defvar electric-help-map nil "\
Keymap defining commands available whilst scrolling
through a buffer in electric-help-mode")
(put (quote electric-help-undefined) (quote suppress-keymap) t)
(if electric-help-map nil (let ((map (make-keymap))) (fillarray map (quote electric-help-undefined)) (define-key map (char-to-string meta-prefix-char) (copy-keymap map)) (define-key map (char-to-string help-char) (quote electric-help-help)) (define-key map "?" (quote electric-help-help)) (define-key map " " (quote scroll-up)) (define-key map "" (quote scroll-down)) (define-key map "." (quote beginning-of-buffer)) (define-key map "<" (quote beginning-of-buffer)) (define-key map ">" (quote end-of-buffer)) (define-key map "q" (quote electric-help-exit)) (define-key map "Q" (quote electric-help-exit)) (define-key map "r" (quote electric-help-retain)) (setq electric-help-map map)))
(defun electric-help-mode nil "\
with-electric-help temporarily places its buffer in this mode
(On exit from with-electric-help, the buffer is put in default-major-mode)" (byte-code "Á‰ˆÆ‰ˆÇ‰ˆÈ‰ˆÉ
!‡" [buffer-read-only t mode-name major-mode mode-line-buffer-identification electric-help-map "Help" help (" Help: %b") use-local-map] 2))
(defun with-electric-help (thunk &optional buffer noerase) "\
Arguments are THUNK &optional BUFFER NOERASE.
BUFFER defaults to \"*Help*\"
THUNK is a function of no arguments which is called to initialise
the contents of BUFFER. BUFFER will be erased before THUNK is called unless
NOERASE is non-nil. THUNK will be called with standard-output bound to
the buffer specified by BUFFER
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.
When the user exits (with electric-help-exit, or otherwise) the help
buffer's window disappears (ie we use save-window-excursion)
BUFFER is put into default-major-mode (or fundamental-mode) when we exit" (byte-code "ËÌ!‰ˆÍÂ!Ä΋ˆ ƒUÂÄ
Ï!ˆÐÑ !Ò Ó\"Z‰
ˆ
ÓV…8Ô
!ˆÕÑ Ò Ö\"Â#ˆ×Ñ Ò Ø\"\"ˆÒ Ù\"b*\\Ú!ˆÛ!*‡" [buffer one t two nil pop-up-windows buffer-read-only noerase standard-output thunk tem get-buffer-create "*Help*" one-window-p ((byte-code "Š
ÊË !bˆÂÌ !)ˆÍŽŠ qˆÎ ˆÅ‰ˆ†&Ï )ˆ Ð!ƒ6ÅH qˆÑÅ!ˆebˆ…HÒË !)ˆ qˆÓÔ!ˆÕ ‰ ˆÖ !×=ƒuØÙË !ÊË !ÚË !`$‰ yʼn ))‡" [one pop-up-windows t buffer buffer-read-only nil noerase standard-output thunk two window-start selected-window pop-to-buffer ((byte-code "ÃÄ!ˆqˆÂ‰ˆÂÅÆ<C385>‡" [buffer buffer-read-only nil message "" (byte-code "ÁÂ!‡" [default-major-mode funcall fundamental-mode] 2) ((error (byte-code "À‡" [nil] 1)))] 4)) electric-help-mode erase-buffer funcall set-buffer-modified-p shrink-window-if-larger-than-buffer run-hooks electric-help-mode-hook electric-help-command-loop car-safe retain vector window-height window-hscroll] 23)) pop-to-buffer window-height selected-window elt 0 shrink-window set-window-start 1 set-window-hscroll 2 3 replace-buffer-in-windows bury-buffer] 17))
(defun electric-help-command-loop nil (byte-code "ÀÁ<C380>‡" [exit (byte-code "Çd!…ÈÉ!ˆr‰ÊU…ˉˆÌÍÁ\"ˆÎÎÎÎÏÐ!Ñ=…<ÏÒ!Ó=…<ÏÔ!Õ=…<ÏÖ!Õ=×ÍØÁ#-‡" [unread-command-char t up down both neither standard pos-visible-in-window-p message "<<< Press Space to bury the help buffer >>>" 32 -1 throw exit nil key-binding " " scroll-up "" scroll-down "Q" electric-help-exit "q" Electric-command-loop (lambda nil (byte-code "Èe!Èd!
ƒ$
ƒÉ‚! †!ÊË!‰iƒ<
ƒ0Ì9
†9ÊÍ!‰i ƒV
ƒHÎS†SÊÏ!‰i
ƒ^Ði†iÊÑ!‰*‡" [min max standard neither t up down both pos-visible-in-window-p "Press Q to exit " substitute-command-keys "Press \\[scroll-up] to exit " "Press SPC to scroll, Q to exit " "Press \\[scroll-up] to scroll; \\[electric-help-exit] to exit " "Press DEL to scroll back, Q to exit " "Press \\[scroll-down] to scroll back, \\[scroll-up] to exit " "Press SPC to scroll, DEL to scroll back, Q to exit " "Press \\[scroll-up] to scroll, \\[scroll-down] to scroll back, \\[electric-help-exit] to exit "] 8))] 13)] 2))
(defun electric-help-exit nil "\
>>>Doc" (interactive) (byte-code "ÁˆÂÃÀ\"‡" [t nil throw exit] 3))
(defun electric-help-retain nil "\
Exit electric-help, retaining the current window/buffer conifiguration.
(The *Help* buffer will not be selected, but \\[switch-to-buffer-other-window] RET
will select it.)" (interactive) (byte-code "ÀˆÁÂÃ\"‡" [nil throw exit (retain)] 3))
(defun electric-help-undefined nil (interactive) (byte-code "ÀˆÁÂÃÄÅ Æ#ÇÈ!É=ƒÈ‚ÊË!#‡" [nil error "%s is undefined -- Press %s to exit" mapconcat single-key-description this-command-keys " " key-binding "Q" electric-help-exit substitute-command-keys "\\[electric-help-exit]"] 8))
(defun electric-help-help nil (interactive) (byte-code "ÀˆÁÂ!Ã=…ÁÄ!Å=…ÁÆ!Ç=ƒ ÈÉ!*ÈÊ!ˆÈËÌÍ!\"ˆÎÏ!‡" [nil key-binding "Q" electric-help-exit " " scroll-up "" scroll-down message "SPC scrolls forward, DEL scrolls back, Q exits and burys help buffer" "Help..." "%s" substitute-command-keys "\\[scroll-up] scrolls forward, \\[scroll-down] scrolls back, \\[electric-help-exit] exits." sit-for 2] 9))
(defun electric-helpify (fun) (byte-code "ÇÈ‹… ÉÊÆ#)‡" [name p b m nil fun t "*Help*" ((byte-code "ÇKÈ
!É !Ê !?…ĉˆËŽÌÍÎÏ
!!\"ˆ …1Š qˆÐÆ!)ˆÇÑMˆÒ
!ˆÈ
!…ZÊÈ
!!…Z ?†Z È
!=?†ZÉ !?)+‡" [p b name m nil fun t print-help-return-message get-buffer buffer-modified-p get-buffer-window ((byte-code "ÃMˆÄ !…Š qˆÅ
!)‡" [p b m print-help-return-message buffer-name set-buffer-modified-p] 3)) message "%s..." capitalize symbol-name set-buffer-modified-p ignore call-interactively] 14)) with-electric-help ignore] 4))
(defun electric-describe-key nil (interactive) (byte-code "ÀˆÁÂ!‡" [nil electric-helpify describe-key] 2))
(defun electric-describe-mode nil (interactive) (byte-code "ÀˆÁÂ!‡" [nil electric-helpify describe-mode] 2))
(defun electric-view-lossage nil (interactive) (byte-code "ÀˆÁÂ!‡" [nil electric-helpify view-lossage] 2))
(defun electric-describe-function nil (interactive) (byte-code "ÀˆÁÂ!‡" [nil electric-helpify describe-function] 2))
(defun electric-describe-variable nil (interactive) (byte-code "ÀˆÁÂ!‡" [nil electric-helpify describe-variable] 2))
(defun electric-describe-bindings nil (interactive) (byte-code "ÀˆÁÂ!‡" [nil electric-helpify describe-bindings] 2))
(defun electric-describe-syntax nil (interactive) (byte-code "ÀˆÁÂ!‡" [nil electric-helpify describe-syntax] 2))
(defun electric-command-apropos nil (interactive) (byte-code "ÀˆÁÂ!‡" [nil electric-helpify command-apropos] 2))
(defvar ehelp-map nil)
(if ehelp-map nil (let ((map (copy-keymap help-map))) (substitute-key-definition (quote describe-key) (quote electric-describe-key) map) (substitute-key-definition (quote describe-mode) (quote electric-describe-mode) map) (substitute-key-definition (quote view-lossage) (quote electric-view-lossage) map) (substitute-key-definition (quote describe-function) (quote electric-describe-function) map) (substitute-key-definition (quote describe-variable) (quote electric-describe-variable) map) (substitute-key-definition (quote describe-bindings) (quote electric-describe-bindings) map) (substitute-key-definition (quote describe-syntax) (quote electric-describe-syntax) map) (setq ehelp-map map) (fset (quote ehelp-command) map)))