home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / emacs / lisp / ehelp.elc < prev    next >
Text File  |  1991-01-09  |  7KB  |  82 lines

  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 "ˋÉÈ˘ÉÈ˙ÉȨÉȲ!Ç" [buffer-read-only t mode-name major-mode mode-line-buffer-identification electric-help-map "Help" help (" Help:  %b") use-local-map] 2))
  17.  
  18. (defun with-electric-help (thunk &optional buffer noerase) "\
  19. Arguments are THUNK &optional BUFFER NOERASE.
  20. BUFFER defaults to \"*Help*\"
  21. THUNK is a function of no arguments which is called to initialise
  22.  the contents of BUFFER.  BUFFER will be erased before THUNK is called unless
  23.  NOERASE is non-nil.  THUNK will be called with  standard-output  bound to
  24.  the buffer specified by BUFFER
  25.  
  26. After THUNK has been called, this function \"electrically\" pops up a window
  27. in which BUFFER is displayed and allows the user to scroll through that buffer
  28. in electric-help-mode.
  29. When the user exits (with electric-help-exit, or otherwise) the help
  30. buffer's window disappears (ie we use save-window-excursion)
  31. BUFFER is put into default-major-mode (or fundamental-mode) when we exit" (byte-code "¸Å³!ÉÈ˝´!˜˛ËÈ ÂU´˜
  32. ˇ!È—± !¼ ½\"ZÉ
  33. È
  34. ½VÄ8¾
  35. !Èà± ¼ á\"´#Èâ± ¼ ã\"\"ȼ ä\"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 "ÊÄ
  36. ˚¸ !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))
  37.  
  38. (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!Ä    Â$
  39. ²Á! Å!˚¸!ÉÁiÂ<
  40. Â0³Á9Å9˚˝!ÉÁi    ÂV
  41. ÂH˛ÁSÅS˚ˇ!ÉÁi
  42. Â^—Á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))
  43.  
  44. (defun electric-help-exit nil "\
  45. >>>Doc" (interactive) (byte-code "ˋÈ´ˆ¹\"Ç" [t nil throw exit] 3))
  46.  
  47. (defun electric-help-retain nil "\
  48. Exit electric-help, retaining the current window/buffer conifiguration.
  49. (The *Help* buffer will not be selected, but \\[switch-to-buffer-other-window] RET
  50. will select it.)" (interactive) (byte-code "¹Èˋ´ˆ\"Ç" [nil throw exit (retain)] 3))
  51.  
  52. (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))
  53.  
  54. (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))
  55.  
  56. (defun electric-helpify (fun) (byte-code "˙¨ËÄ ²˚˘#)Ç" [name p b m nil fun t "*Help*" ((byte-code "˙K¨
  57. !²    !    Ä˚    !?ĘÉȸγ˝˛ˇ!!\"È    Ä1Ê    qÈ—˘!)È˙±Mȼ!Ȩ
  58. !ÄZ˚¨
  59. !!ÄZ    ?ÅZ    ¨
  60. !=?ÅZ²    !?)+Ç" [p b name m nil fun t print-help-return-message get-buffer buffer-modified-p get-buffer-window ((byte-code "ˆMÈ    Ä˜    !ÄÊ    qȯ
  61. !)Ç" [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))
  62.  
  63. (defun electric-describe-key nil (interactive) (byte-code "¹Èˋ´!Ç" [nil electric-helpify describe-key] 2))
  64.  
  65. (defun electric-describe-mode nil (interactive) (byte-code "¹Èˋ´!Ç" [nil electric-helpify describe-mode] 2))
  66.  
  67. (defun electric-view-lossage nil (interactive) (byte-code "¹Èˋ´!Ç" [nil electric-helpify view-lossage] 2))
  68.  
  69. (defun electric-describe-function nil (interactive) (byte-code "¹Èˋ´!Ç" [nil electric-helpify describe-function] 2))
  70.  
  71. (defun electric-describe-variable nil (interactive) (byte-code "¹Èˋ´!Ç" [nil electric-helpify describe-variable] 2))
  72.  
  73. (defun electric-describe-bindings nil (interactive) (byte-code "¹Èˋ´!Ç" [nil electric-helpify describe-bindings] 2))
  74.  
  75. (defun electric-describe-syntax nil (interactive) (byte-code "¹Èˋ´!Ç" [nil electric-helpify describe-syntax] 2))
  76.  
  77. (defun electric-command-apropos nil (interactive) (byte-code "¹Èˋ´!Ç" [nil electric-helpify command-apropos] 2))
  78.  
  79. (defvar ehelp-map nil)
  80.  
  81. (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)))
  82.