ehelp.elc 7.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. (require (quote electric))
  2. (provide (quote ehelp))
  3. (defvar electric-help-map nil "\
  4. Keymap defining commands available whilst scrolling
  5. through a buffer in electric-help-mode")
  6. (put (quote electric-help-undefined) (quote suppress-keymap) t)
  7. (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)))
  8. (defun electric-help-mode nil "\
  9. with-electric-help temporarily places its buffer in this mode
  10. (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))
  11. (defun one-window-p (&optional nomini) (byte-code "Á …
  12. Âà !ƒÄ ‚ÄÄ !=‡" [nomini selected-window zerop minibuffer-depth next-window] 8))
  13. (defun with-electric-help (thunk &optional buffer noerase) "\
  14. Arguments are THUNK &optional BUFFER NOERASE.
  15. BUFFER defaults to \"*Help*\"
  16. THUNK is a function of no arguments which is called to initialise
  17. the contents of BUFFER. BUFFER will be erased before THUNK is called unless
  18. NOERASE is non-nil. THUNK will be called with standard-output bound to
  19. the buffer specified by BUFFER
  20. After THUNK has been called, this function \"electrically\" pops up a window
  21. in which BUFFER is displayed and allows the user to scroll through that buffer
  22. in electric-help-mode.
  23. When the user exits (with electric-help-exit, or otherwise) the help
  24. buffer's window disappears (ie we use save-window-excursion)
  25. BUFFER is put into default-major-mode (or fundamental-mode) when we exit" (byte-code "ˆÌ!‰ˆÍÂ!Ä΋ˆ ƒUÂÄ
  26. Ï!ˆÐÑ !Ò Ó\"Z‰
  27. ˆ
  28. ÓV…8Ô
  29. !ˆÕÑ Ò Ö\"Â#ˆ×Ñ Ò Ø\"\"ˆÒ Ù\"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 "Š…
  30. ÊË !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ˆÂ‰ˆÂÅÆ�‡" [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))
  31. (defun electric-help-command-loop nil (byte-code "ÀÁ�‡" [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!… ƒ$
  32. ƒÉ‚! †!ÊË!‰‚iƒ<
  33. ƒ0Ì‚9 †9ÊÍ!‰‚i ƒV
  34. ƒH΂S†SÊÏ!‰‚i
  35. ƒ^Ђ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))
  36. (defun electric-help-exit nil "\
  37. >>>Doc" (interactive) (byte-code "ÁˆÂÃÀ\"‡" [t nil throw exit] 3))
  38. (defun electric-help-retain nil "\
  39. Exit electric-help, retaining the current window/buffer conifiguration.
  40. (The *Help* buffer will not be selected, but \\[switch-to-buffer-other-window] RET
  41. will select it.)" (interactive) (byte-code "ÀˆÁÂÃ\"‡" [nil throw exit (retain)] 3))
  42. (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))
  43. (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))
  44. (defun electric-helpify (fun) (byte-code "ÇÈ‹… ÉÊÆ#)‡" [name p b m nil fun t "*Help*" ((byte-code "ÇKÈ
  45. !É ! …Ê !?…ĉˆËŽÌÍÎÏ !!\"ˆ …1Š qˆÐÆ!)ˆÇÑMˆÒ !ˆÈ
  46. !…ZÊÈ
  47. !!…Z ?†Z È
  48. !=?†ZÉ !?)+‡" [p b name m nil fun t print-help-return-message get-buffer buffer-modified-p get-buffer-window ((byte-code "ÃMˆ …Ä !…Š qˆÅ
  49. !)‡" [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))
  50. (defun electric-describe-key nil (interactive) (byte-code "ÀˆÁÂ!‡" [nil electric-helpify describe-key] 2))
  51. (defun electric-describe-mode nil (interactive) (byte-code "ÀˆÁÂ!‡" [nil electric-helpify describe-mode] 2))
  52. (defun electric-view-lossage nil (interactive) (byte-code "ÀˆÁÂ!‡" [nil electric-helpify view-lossage] 2))
  53. (defun electric-describe-function nil (interactive) (byte-code "ÀˆÁÂ!‡" [nil electric-helpify describe-function] 2))
  54. (defun electric-describe-variable nil (interactive) (byte-code "ÀˆÁÂ!‡" [nil electric-helpify describe-variable] 2))
  55. (defun electric-describe-bindings nil (interactive) (byte-code "ÀˆÁÂ!‡" [nil electric-helpify describe-bindings] 2))
  56. (defun electric-describe-syntax nil (interactive) (byte-code "ÀˆÁÂ!‡" [nil electric-helpify describe-syntax] 2))
  57. (defun electric-command-apropos nil (interactive) (byte-code "ÀˆÁÂ!‡" [nil electric-helpify command-apropos] 2))
  58. (defvar ehelp-map nil)
  59. (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)))