home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / gnu / epoch / misc / 1127 < prev    next >
Encoding:
Text File  |  1992-11-18  |  3.8 KB  |  114 lines

  1. Path: sparky!uunet!ogicse!das-news.harvard.edu!husc-news.harvard.edu!husc-news!carlton
  2. From: carlton@scws8.harvard.edu (david carlton)
  3. Newsgroups: gnu.epoch.misc
  4. Subject: Re: looking for Epoch goodies, e.g. screens for completion & compilation
  5. Message-ID: <CARLTON.92Nov18104223@scws8.harvard.edu>
  6. Date: 18 Nov 92 18:42:23 GMT
  7. Article-I.D.: scws8.CARLTON.92Nov18104223
  8. References: <SCOTTH.92Nov17120022@oldman.com> <1992Nov17.230847.23183@reed.edu>
  9. Organization: Citizens for Boysenberry Jam
  10. Lines: 100
  11. Nntp-Posting-Host: scws8.harvard.edu
  12. In-reply-to: nelson@reed.edu's message of 17 Nov 92 23:08:47 GMT
  13.  
  14. In article <1992Nov17.230847.23183@reed.edu>, nelson@reed.edu (Nelson Minar) writes:
  15.  
  16. > What I really want is a bit of elisp so that help windows (ie when you
  17. > type M-x apropos mail) come up in seperate screens.
  18.  
  19. Here's one of the first pieces of Epoch code I wrote.  It even tries
  20. to get the window that it pops up not to overlap with your current
  21. one, though admittedly it doesn't try all _that_ hard.  I require it
  22. in my .emacs if I'm running Epoch, though I suppose that a better way
  23. to do things would just to set the temp-buffer-show-hook in my .emacs
  24. and autoload this when I call check-help-screen-buffer.  Type 'q' to
  25. get out of the screen that it pops up.
  26.  
  27. david carlton
  28. carlton@husc.harvard.edu
  29.  
  30. ;; Help commands for Epoch.
  31. ;;
  32. ;; These commands cause help to create a new screen each time it is
  33. ;; run, rather than merely a new buffer.
  34. ;;
  35. ;; by david carlton, carlton@husc.harvard.edu
  36.  
  37. (provide 'epoch-help)
  38.  
  39. (defvar help-return-screen nil)        ; used to return to the old screen
  40. (defvar help-screen-mode-hooks nil)
  41. (defvar help-screen-mode-map nil)
  42. (defvar help-screen-cursor-glyph 92)    ; question-arrow
  43. (defvar help-screen-dimensions "80x24")
  44. (defvar help-screen-xpos 10)
  45. (defvar help-screen-ypos 100)
  46.  
  47. (defun check-help-screen-buffer (buffer)
  48.   (if (string-equal (buffer-name buffer) "*Help*")
  49.       (create-help-screen buffer)
  50.     (display-buffer buffer)))
  51.  
  52. (defun create-help-screen (buffer)
  53.   (set-buffer buffer)
  54.   (help-screen-mode)
  55.   (let
  56.       ((help-screen
  57.     (create-screen buffer (get-help-screen-alist))))
  58.     (setq help-return-screen (current-screen))
  59.     (map-screen help-screen)
  60.     (select-screen help-screen)
  61.     (cursor-to-screen (current-screen))))
  62.  
  63. (defun get-help-screen-alist ()
  64.   (cons (cons 'geometry (get-help-screen-geometry))
  65.     (list (cons 'cursor-glyph help-screen-cursor-glyph))))
  66.  
  67. (defun get-help-screen-geometry ()
  68.   (let ((screen-dims (screen-information)))
  69.     (concat help-screen-dimensions
  70.         (if (< (car screen-dims) (- (caddr screen-dims) help-screen-xpos))
  71.         "-"
  72.           "+")
  73.         help-screen-xpos
  74.         "+"
  75.         help-screen-ypos)))
  76.  
  77. (defun help-screen-mode ()
  78.   "Mode for help screen created by Epoch"
  79.   (interactive)
  80.   (kill-all-local-variables)
  81.   (use-local-map help-screen-mode-map)
  82.   (setq major-mode 'help-screen-mode)
  83.   (setq mode-name "help-screen")
  84.   (run-hooks 'help-screen-mode-hooks))
  85.  
  86. (defun create-help-screen-mode-map (keymap)
  87.   (suppress-keymap keymap)
  88.   (define-key keymap "q" 'exit-help-screen-mode)
  89.   (define-key keymap " " 'scroll-up)
  90.   (define-key keymap "\177" 'scroll-down)
  91.   (define-key keymap "s" 'isearch-forward)
  92.   keymap)
  93.  
  94. (defun exit-help-screen-mode ()
  95.   "Deletes help screen, leaves help-screen-mode"
  96.   (interactive)
  97.   (delete-screen)
  98.   (select-screen help-return-screen)
  99.   (cursor-to-screen help-return-screen))
  100.  
  101.  
  102. (defun print-help-return-message (&optional function)
  103.   "Prints help-return-message for help-screen"
  104.   (and (not (get-buffer-window standard-output))
  105.        (funcall (or function 'message)
  106.         "Type q to remove help screen."))) ; should be using
  107.                                ; substitute-command-keys
  108.  
  109. (if (not help-screen-mode-map)
  110.     (setq help-screen-mode-map
  111.       (create-help-screen-mode-map (make-keymap))))
  112.  
  113. (setq temp-buffer-show-hook 'check-help-screen-buffer)
  114.