🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.epoch.misc
Article #1358

Re: Help Windows in epoch

#1358
From: Bikash Sabata
Date: Fri, 12 Jun 1992 15:28
90 lines
3410 bytes
Someone requested for code that would create a new help screen instead
of just a window. Here is something I got out of the net sometime ago.
May be it will help.

bikash

---------------------- CUT HERE ----------------------------
;; Help commands for Epoch.
;;
;; These commands cause help to create a new screen each time it is
;; run, rather than merely a new buffer.
;;
;; by david carlton, carlton@linus.mitre.org or carlton@harvard.harvard.edu

(defvar help-return-screen nil)		; used to return to the old screen
(defvar help-screen-mode-hooks nil)
(defvar help-screen-mode-map nil)
(defvar help-screen-cursor-glyph 92)	; question-arrow
(defvar help-screen-dimensions "80x24")
(defvar help-screen-xpos 10)
(defvar help-screen-ypos 100)

(defun check-help-screen-buffer (buffer)
  (if (string-equal (buffer-name buffer) "*Help*")
      (create-help-screen buffer)
    (display-buffer buffer)))

(defun create-help-screen (buffer)
  (set-buffer buffer)
;  (help-screen-mode)
  (let
      ((help-screen
	(create-screen buffer (get-help-screen-alist))))
    (setq help-return-screen (current-screen))
    (map-screen help-screen)
    (select-screen help-screen)
    (cursor-to-screen (current-screen))
    (help-screen-mode)))

(defun get-help-screen-alist ()
  (cons (cons 'geometry (get-help-screen-geometry))
	(list (cons 'cursor-glyph help-screen-cursor-glyph))))

(defun get-help-screen-geometry ()
  (let ((screen-dims (screen-information)))
    (concat help-screen-dimensions
	    (if (< (car screen-dims) (- (caddr screen-dims) help-screen-xpos))
		"-"
	      "+")
	    help-screen-xpos
	    "+"
	    help-screen-ypos)))

(defun help-screen-mode ()
  "Mode for help screen created by Epoch"
  (interactive)
  (kill-all-local-variables)
  (use-local-map help-screen-mode-map)
  (setq major-mode 'help-screen-mode)
  (setq mode-name "help-screen")
  (run-hooks 'help-screen-mode-hooks))

(defun create-help-screen-mode-map (keymap)
  (suppress-keymap keymap)
  (define-key keymap "q" 'exit-help-screen-mode)
  (define-key keymap " " 'scroll-up)
  (define-key keymap "\177" 'scroll-down)
  keymap)

(defun exit-help-screen-mode ()
  "Deletes help screen, leaves help-screen-mode"
  (interactive)
  (delete-screen)
  (select-screen help-return-screen)
  (cursor-to-screen help-return-screen))


(defun print-help-return-message (&optional function)
  "Prints help-return-message for help-screen"
  (and (not (get-buffer-window standard-output))
       (funcall (or function 'message)
		"Type q to remove help screen."))) ; should be using
					           ; substitute-command-keys

(if (not help-screen-mode-map)
    (setq help-screen-mode-map
	  (create-help-screen-mode-map (make-keymap))))

(setq temp-buffer-show-hook 'check-help-screen-buffer)
Technical Details
Message-ID: <73808@ut-emx.uucp>
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!sdd.hp.com!cs.utexas.edu!ut-emx!bsabata

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc7ee,9729fe1c897e412f,start
X-Google-Attributes: gidfc7ee,public
X-Google-ArrivalTime: 1992-06-12 02:54:20 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!sdd.hp.com!cs.utexas.edu!ut-emx!bsabata
From: bsabata@ut-emx.cc.utexas.edu (Bikash Sabata)
Newsgroups: gnu.epoch.misc
Subject: Re: Help Windows in epoch
Message-ID: <73808@ut-emx.uucp>
Date: 12 Jun 92 15:28:23 GMT
Sender: news@ut-emx.uucp
Reply-To: bsabata@ut-emx.cc.utexas.edu (Bikash Sabata)
Organization: The University of Texas at Austin
Lines: 91