home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Text / Emacs-1.12d folder / lisp / ehelp.elc < prev    next >
Encoding:
Text File  |  1993-11-09  |  7.2 KB  |  82 lines  |  [dELC/EMAC]

  1.  
  2. (require (quote electric))
  3.  
  4. (provide (quote ehelp))
  5.  
  6. (defvar electric-help-map nil "\
  7. Keymap defining commands available whilst scrolling
  8. through a buffer in electric-help-mode")
  9.  
  10. (put (quote electric-help-undefined) (quote suppress-keymap) t)
  11.  
  12. (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)))
  13.  
  14. (defun electric-help-mode nil "\
  15. with-electric-help temporarily places its buffer in this mode
  16. (On exit from with-electric-help, the buffer is put in default-major-mode)" (byte-code "¡âàΔâà«âà»âà…
  17. !á" [buffer-read-only t mode-name major-mode mode-line-buffer-identification electric-help-map "Help" help (" Help:  %b") use-local-map] 2))
  18.  
  19. (defun with-electric-help (thunk &optional buffer noerase) "\
  20. Arguments are THUNK &optional BUFFER NOERASE.
  21. BUFFER defaults to \"*Help*\"
  22. THUNK is a function of no arguments which is called to initialise
  23.  the contents of BUFFER.  BUFFER will be erased before THUNK is called unless
  24.  NOERASE is non-nil.  THUNK will be called with  standard-output  bound to
  25.  the buffer specified by BUFFER
  26.  
  27. After THUNK has been called, this function \"electrically\" pops up a window
  28. in which BUFFER is displayed and allows the user to scroll through that buffer
  29. in electric-help-mode.
  30. When the user exits (with electric-help-exit, or otherwise) the help
  31. buffer's window disappears (ie we use save-window-excursion)
  32. BUFFER is put into default-major-mode (or fundamental-mode) when we exit" (byte-code "ÀÜÃ!âàÕ¬!ƒŒãà ÉU¬ƒ
  33. œ!à–— !“ ”\"Zâ
  34. à
  35. ”VÖ8‘
  36. !à’— “ ÷\"¬#à◊— “ ÿ\"\"à“ Ÿ\"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 "äÖ
  37.  À !bà¬à !)àÕéä qàŒ à≈âàÜ&œ )à –!É6≈ÇH qà—≈!àebàÖH“À !)à qà”‘!à’ â    à÷    !◊=ÉuÿŸÀ ! À !⁄À !`$â    Çy≈â    ))á" [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))
  38.  
  39. (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!Ö
  40.     É$
  41. É…Ç! Ü! À!âÇiÉ<
  42. É0ÃÇ9
  43. Ü9 Õ!âÇi    ÉV
  44. ÉHŒÇSÜS œ!âÇi
  45. É^–Ç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))
  46.  
  47. (defun electric-help-exit nil "\
  48. >>>Doc" (interactive) (byte-code "¡à¬√¿\"á" [t nil throw exit] 3))
  49.  
  50. (defun electric-help-retain nil "\
  51. Exit electric-help, retaining the current window/buffer conifiguration.
  52. (The *Help* buffer will not be selected, but \\[switch-to-buffer-other-window] RET
  53. will select it.)" (interactive) (byte-code "¿à¡¬√\"á" [nil throw exit (retain)] 3))
  54.  
  55. (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))
  56.  
  57. (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))
  58.  
  59. (defun electric-helpify (fun) (byte-code "«»ãÖ … Δ#)á" [name p b m nil fun t "*Help*" ((byte-code "«K»
  60. !…    !    Ö     !?ÖƒâàÀéÃÕŒœ
  61. !!\"à    Ö1ä    qà–Δ!)à«—Mà“
  62. !à»
  63. !ÖZ »
  64. !!ÖZ    ?ÜZ    »
  65. !=?ÜZ…    !?)+á" [p b name m nil fun t print-help-return-message get-buffer buffer-modified-p get-buffer-window ((byte-code "√Mà    Öƒ    !Öä    qà≈
  66. !)á" [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))
  67.  
  68. (defun electric-describe-key nil (interactive) (byte-code "¿à¡¬!á" [nil electric-helpify describe-key] 2))
  69.  
  70. (defun electric-describe-mode nil (interactive) (byte-code "¿à¡¬!á" [nil electric-helpify describe-mode] 2))
  71.  
  72. (defun electric-view-lossage nil (interactive) (byte-code "¿à¡¬!á" [nil electric-helpify view-lossage] 2))
  73.  
  74. (defun electric-describe-function nil (interactive) (byte-code "¿à¡¬!á" [nil electric-helpify describe-function] 2))
  75.  
  76. (defun electric-describe-variable nil (interactive) (byte-code "¿à¡¬!á" [nil electric-helpify describe-variable] 2))
  77.  
  78. (defun electric-describe-bindings nil (interactive) (byte-code "¿à¡¬!á" [nil electric-helpify describe-bindings] 2))
  79.  
  80. (defun electric-describe-syntax nil (interactive) (byte-code "¿à¡¬!á" [nil electric-helpify describe-syntax] 2))
  81.  
  82. (defun electric-command-apropos nil (interactive) (byte-code "¿à¡¬!á" [nil electric-helpify command-apropos] 2))
  83.  
  84. (defvar ehelp-map nil)
  85.  
  86. (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)))
  87.