[comp.emacs] GNUemacs and HP2392

saponara@batcomputer.tn.cornell.edu (John Saponara) (05/05/88)

To anyone who has figured out how to get the `Extend char' key on their HP2392
to act as the Meta key, using GNU emacs 18.50 on an HP 300 series machine (a
350, to be exact):  Help!

I've tried and tried, but it don't go (and I've seen it done at another site,
but can't contact them).  First, using untic and tic, I added to the
/usr/lib/terminfo/2/2392 file:

    km,		[which allegedly says that there is a meta key]

and tic'ed it into place.

Then I added to my .emacs startup file:

    (setq meta-flag t)

and tried out gnu-emacs.  No go: the ESC key still acted as the Meta key, and
`Extend char' was still useless.  So, does anyone know how to set things up
to make this work?

Also, while I'm here:  if you have been able to do the above, you are also
probably smart enough to have made a default.el which sets up all the special
keys to the right of the main keyboard to be useful (i.e. `Clear display',
`Prev', the arrow keys, etc).  Could you please send this on to me and save
me some more hacking through the swamps?

Any help appreciated,

Eric Haines (not John Saponara, no matter what my header says)

wayne@dsndata.UUCP (Wayne Schlitt) (05/06/88)

Posting-Front-End: GNU Emacs 18.44.2 of Tue Jun  2 1987 on dsndata (hpux)




> 
> To anyone who has figured out how to get the `Extend char' key on their HP2392
> to act as the Meta key, using GNU emacs 18.50 on an HP 300 series machine (a
> 350, to be exact):  Help!
> 

it is my understanding that the extend char key does not just set the
top bit of the key that you hit, it accesses an alternate character
set.  some keys, like "z" dont seem to have an extended char.  if you
do find a way of doing this, PLEASE let me know...  it would be most
useful.

> 
> Also, while I'm here:  if you have been able to do the above, you are also
> probably smart enough to have made a default.el which sets up all the special
> keys to the right of the main keyboard to be useful (i.e. `Clear display',
> `Prev', the arrow keys, etc). 
> 


here is what we use for our lisp/term/hp2392.el file, minus some local
junk that you probably dont want anyway...  (yes, i know, this should
probably use the keypad stuff that has already been set up, but i had
this written before i knew that it existed.  if someone has a cleaner
hack, i would be interested in that too.)



----------------  cut here ---------------------

;;
;; cursor pad
;;

(global-set-key "\eA" 'previous-line)	; up arrow
(global-set-key "\eB" 'next-line)	; down arrow
(global-set-key "\eC" 'forward-char)	; right arrow
(global-set-key "\eD" 'backward-char)	; left arrow
(global-set-key "\eh" 'home)		; home to the top of the window


(global-set-key "\eS" 'beginning-of-buffer); shift up arrow - top of file
(global-set-key "\eT" 'end-of-buffer)	; shift down arrow - end of file
(global-set-key "\e&rR" 'end-of-line)	; shift right arrow - end of line
(global-set-key "\e&rL" 'beginning-of-line); shift left arrow - beg of line
(global-set-key "\eF" 'home-bottom)	; shift home to bottom of window


;;
;; named keys
;;

(global-set-key "\eK" 'clear-end-of-line) ; clear line
(global-set-key "\eJ" 'hide-window)	; clear display
(global-set-key "\eL" 'insert-line)	; insert line
(global-set-key "\eM" 'delete-line)	; delete line
(global-set-key "\eQ" 'overwrite-mode)	; insert char
(global-set-key "\eP" 'delete-char)	; delete char
(global-set-key "\eV" 'scroll-down)	; prev screen
(global-set-key "\eU" 'scroll-up)	; next screen


(global-set-key "\e&a0C" 'beginning-of-line) ; from shift clear line & display
(global-set-key "\eG" 'beginning-of-line) ; from shift clear line & display

;;(global-set-key "\eK" 'clear-end-of-line) ; shift clear line
;;(global-set-key "\eJ" 'delete-window)	; shift clear display
;;(global-set-key "\eL" 'insert-line)	; shift insert line
;;(global-set-key "\eM" 'delete-line)	; shift delete line
(global-set-key "\eN" 'overwrite-mode)	; shift insert char
(global-set-key "\eO" 'delete-char)	; shift delete char
(global-set-key "\e&r-1H" 'scroll-down)	; shift prev
(global-set-key "\e&r+1H" 'scroll-up)	; shift next



;;
;; function definitions for the cursor and named keys
;;

(defun home ()
  "Home to the upper left of the window."
  (interactive)

  (move-to-window-line 0)
  (move-to-column (window-hscroll (selected-window)))
  (setq temporary-goal-column (window-hscroll (selected-window)))
  )


(defun home-bottom ()
  "Home to the lower right of the window."
  (interactive)

  (move-to-window-line -1)
  (move-to-column (window-hscroll (selected-window)))
  (setq temporary-goal-column (window-hscroll (selected-window)))
  )


(defun insert-line ()
  "Insert a line before the current line."
  (interactive)

  (let ((org-point (point))
	)
    (condition-case conditions
	(progn
	  (beginning-of-line)
	  (open-line 1)
	  )
      (error (goto-char org-point)
	     (signal (car conditions) (cdr conditions))
	     )
      )
    )
  
  )


(defun delete-line ()
  "Delete the current line."
  (interactive)

  (let ((org-point (point))
	)
    (condition-case conditions
	(kill-region (progn
		       (beginning-of-line)
		       (point)
		       )
		     (progn
		       (end-of-line)
		       (if (eobp)
			   (point)
			 (forward-char)
			 (point)
			 )
		       )
		     )
      (error (goto-char org-point)
	     (signal (car conditions) (cdr conditions))
	     )
      )
    )

  )


(defun clear-end-of-line ()
  "Clear to the end of the line."
  (interactive)

  (let ((org-point (point))
	)
    (condition-case conditions
	(kill-region (point)
		     (progn
		       (end-of-line)
		       (point)
		       )
		     )
      (error (goto-char org-point)
	     (signal (car conditions) (cdr conditions))
	     )
      )
    )

  )


(defun hide-window ()
  "Hide the current window from view."
  (interactive)

  (if (one-window-p t)
      (bury-buffer)
    (delete-window)
    )
  )




;;
;; set up dired keys
;;

(define-key dired-mode-map "\eA" 'dired-previous-line)
(define-key dired-mode-map "\eB" 'dired-next-line)



;;
;; set up the pf keys functions
;;

(global-set-key "\C-x@"'set-mark-command)


(defun update-pf-keys ()
  "Display the updated pf key labels."
  (send-string-to-terminal "\e&jB")
  (sleep-for 1)
)


(defun set-pf (key-num label def)
  "Define a pf key."
  (interactive)

  (send-string-to-terminal
   (concat "\e&f0a" key-num "k" (length label) "d" (length def) "L"
	   label def)
   )

  )


(defun clr-pf (key-num)
  "Clear a pf key."
  (interactive)

  (send-string-to-terminal (concat "\e&f0a" key-num "k1d-1L "))
  
  )



;;
;; define the main level pf keys
;;

(defun pf-keys-main ()
  "Display main level pf keys."
  (interactive)

  (message "Main options...")
  (sit-for 0)
  
  (set-pf 1 "Printer Options" "\expf-keys-printer\r")
  (set-pf 2 " Buffer  Options" "\expf-keys-buffer\r")
  (set-pf 3 "  Word   Options" "\expf-keys-word\r")
  (set-pf 4 "Compile" "\excompile")
  
  (set-pf 5 "  Load    File" "\C-x")
  (set-pf 6 "  Save    Files" "\C-xs")
  (set-pf 7 "  Mark   Region" "\C-x@")
  (set-pf 8 "  Undo" "\C-_")

  (update-pf-keys)
  (message "")

  )


;;
;; define the print option pf keys
;;

(defun pf-keys-printer ()
  "Display printer option pf keys."
  (interactive)
  
  (message "Printer options...")
  (sit-for 0)
  
  (clr-pf 1 )
  (clr-pf 2 )           ; these keys send to various printers at our site
  (clr-pf 3 )
  (clr-pf 4 )
  
  (set-pf 5 " Spell   Buffer"  "\exspell-buffer\r")
  (set-pf 6 "  Find    Word"  "\exfind-word\r")
  (set-pf 7 "  Main  Options" "\expf-keys-main\r")
  (set-pf 8 "  Undo" "\C-_")

  (update-pf-keys)
  (message "")

  )




;;
;; define the buffer option pf keys
;;

(defun pf-keys-buffer ()
  "Display buffer option pf keys."
  (interactive)
  
  (message "Buffer options...")
  (sit-for 0)
  
  (set-pf 1 "  One    Window" "\C-x1")
  (set-pf 2 " Split   Screen" "\C-x4b\r")
  (set-pf 3 " Switch  Buffer" "\C-xb?")
  (set-pf 4 "  Kill   Buffer" "\C-xk\r")
  
  (set-pf 5 "  Read    Mail" "\exrmail\r")
  (set-pf 6 "  Send    Mail" "\C-xm")
  (set-pf 7 "  Main  Options" "\expf-keys-main\r")
  (set-pf 8 "  Undo" "\C-_")

  (update-pf-keys)
  (message "")

  )





;;
;; define the word option pf keys
;;

(defun pf-keys-word ()
  "Display buffer option pf keys."
  (interactive)
  
  (message "Word options...")
  (sit-for 0)
  
  (set-pf 1 "  Page   Break" "\C-a\C-q\C-l\r")
  (set-pf 2 "Compress Print" "\C-q\C-c")    ; we got a filter for these
  (set-pf 3 " Under    Line" "\C-q\C-u")    ; letters to translate them
  (set-pf 4 "  Bold    Text" "\C-q\C-b")    ; into something useful
  
  (set-pf 5 " Center   Text"  "\excenter-line\r")
  (set-pf 6 "  Fill  Paragrph" "\eq")
  (set-pf 7 "  Main   Options" "\expf-keys-main\r")
  (set-pf 8 "  Undo" "\C-_")

  (update-pf-keys)
  (message "")

  )



;;
;; put the options on the screen
;;


(sit-for 0)
(update-pf-keys)
(sleep-for 1)
(pf-keys-main)
(sleep-for 1)



----------------  cut here ---------------------

dana@faline.bellcore.com (Dana A. Chee) (05/06/88)

If anyone has an answer to this question, please post it, since there
are othes of us out here with 2392's that would also like to do this.

--
			Dana Chee
			Bellcore
			MRE 2Q-250
			(201) 829-4488
			dana@bellcore.com

mark@cogent.UUCP (Captain Neptune) (05/12/88)

In article <DANA.GNUS1@faline.bellcore.com> dana@faline.bellcore.com (Dana A. Chee) writes:
>
>If anyone has an answer to this question, please post it, since there
>are othes of us out here with 2392's that would also like to do this.

After much struggling and hair pulling, we have come to the conclusion
that while the HP2392 is a nice terminal, HP mode (which is more or less
the escape codes used on most all HP terminals) suck pathetically. 
Worst of all being the lame implementation of video attributes. 
Everything we have (including EMACS) works 500% better when we switch
the terminals to ANSI mode and use either the "ansi" terminfo driver, or
"ansi-d", an enhanced version we made for ourselves.

For those who lack a good ansi driver, here is our "ansi-d":

ansi-d|generic ansi standard terminal w/ dim,
	am, xhp, xenl, xon, 
	cols#80, lines#24, 
	bel=^G, cr=\r, clear=\E[H\E[J, el=\E[K, 
	ed=\E[J, cup=\E[%i%p1%d;%p2%dH, cud1=\n, home=\E[H, 
	cub1=\b, cuf1=\E[C, cuu1=\E[A, dch1=\E[P, 
	dl1=\E[M, blink=\E[5m, bold=\E[7m, dim=\E[1m, 
	smir=\E[4h, rev=\E[7m, smso=\E[7m, smul=\E[4m, 
	sgr0=\E[0m, rmir=\E[4l, rmso=\E[0m, rmul=\E[0m, 
	is1=\E[?1l\E(B\E)B, ich1=\E[@, il1=\E[L, kbs=\b, 
	kcud1=\E[B, khome=\E[>0s, kcub1=\E[D, kcuf1=\E[C, 
	kcuu1=\E[A, ich=\E[%p1%d@, rep=%p1%c\E[%p2%{1}%-%db, ind=\n, 
	ht=\t, 

Compile that with 'tic' then do this:

TERM=ansi-d ; export TERM

We added "dim", maybe some other stuff, I don't remember, but "dim" for
sure.

P.S.  Flames about my contempt for HP mode are not wanted, especially
from HP.  You won't change my mind, and I don't care to try and change
yours. 

-- 
# Mark ###################### Ernie: Gee, Bert!  Where'd all your files go ? #
# Steven #################### Bert:  My files!  Er-r-r-r-r-r-rnie-e-e-e-e !! #
# Jeghers ############ {ihnp4,cbosgd,lll-lcc}!ptsfa!cogent!{mark,shawn!mark} #
# Standard Disclaimer: Don't sue me.  Sue my company.  They have more money. #