🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #189407

Re: Mouse under X

#189407
From: Dion Hollenbeck
Date: Tue, 05 Mar 1991 16:21
223 lines
9835 bytes
In article <1991Mar2.020840.20301@uicbert.eecs.uic.edu> sloan@uicbert.eecs.uic.edu (Bob Sloan) writes:
> 	I just built emacs 18.57 for my Sun SLC, running SunOS4.1.1
> with X11 with XMenu.  All is well, except that the mouse doesn't
> perform quite as advertised in the manual pages.
> 
> 	When I try to find out what the keys are bound to with ctrl-h k, 
> for all mouse combinations I get back C-x C-@, x-flush-mouse-queue,
> which is obviously a lie.  
> 
1)  This is not a lie.  Before I fixed things, indeed, these were
	the bindings.  I did not take the time to find out why.

2)  Here is what I do to set up for both mouse and sun keypad, both
	in and out of X.  I finally wrote it all into one file
	since I have mailed snippets of it numerous times to various
	people, I have made it into a generic key/mouse whacking
	information package.

;;===============================================================
HOW TO SET UP SUN FUNCTION KEYPAD IN OR OUT OF X WINDOWS AND
ALSO SET UP MOUSE FOR X WINDOWS
-----------------------------------------------------
It must be understood that these are my mappings and are not
necessarily RIGHT for everyone, but give examples of how to get
control over these functions as well as set up a second level
keypad mapping system like used in VAX/VMS EDT and EVE.
Also, do not try to implement these files AS IS.  The key mappings
refer to many functions not in the standard distribution.

Tested on GNU Emacs 18.55, but should work on later versions too.

For more information contact:	hollen@megatek.uucp (Dion Hollenbeck)

;==================================================
Add the following to ..../lisp/term/x-win.el:

(defvar x-win-hook nil
  "Hook to run things like key setup and such.")

and at the end of the function x-new-display:

      ;; Run any user's hooks
      (run-hooks 'x-win-hook)
;===============================================

In your .emacs:

(defun my-x-win-hook()
        (load "x-sunkeys" nil t nil)
)
(setq x-win-hook 'my-x-win-hook)

(load "goldkeys" nil t nil )


;;  Set up to define Sun keymap
(defun myterm-setup-hook ()
;;  ABSOLUTELY DO NOT LOAD THE BYTE-COMPILED VERSION !!!!!
;;    May have already been done by ../term/x-win.el calling x-sunkeys.el
;;    so don't do it again
(if (eq window-system 'x)
    (load "mod-x-mouse.el" nil t nil))
(if (eq mysunkeys-defined nil)
  (load "sunkeys.el" nil t nil))
)


(setq sun-esc-bracket t)
(setq term-setup-hook 'myterm-setup-hook)


;;======================   mod-x-mouse.el  ===============
;;
;;      mod-x-mouse.el
;;
;;         Make our own mouse mappings
;;         This should be run out of the terminal hook function
;;

(define-key mouse-map x-button-left 'x-mouse-set-point)
(define-key mouse-map x-button-middle 'x-mouse-set-mark)
(define-key mouse-map x-button-right 'x-mouse-ignore)

(define-key mouse-map x-button-s-left 'x-cut-text)
(define-key mouse-map x-button-s-middle 'x-cut-and-wipe-text)
(define-key mouse-map x-button-s-right 'x-paste-text)

(define-key mouse-map x-button-c-left 'x-mouse-ignore)
(define-key mouse-map x-button-c-middle 'x-mouse-ignore)
(define-key mouse-map x-button-c-right 'x-mouse-ignore)

;=================== x-sunkeys.el  =========================
;;
;; SUN console keyboard stuff for X-Windows
;;
;;     Loaded from:  ...term/x-win.el

(setq mysunkeys-defined t)
(defvar sun-raw-map (make-sparse-keymap) 
       "*Keymap for ESC-[ encoded keyboard")

;;  set up prefix through ESCAPE map
(define-key esc-map "[" sun-raw-map)		; Install sun-raw-map

;; R keys
(define-key sun-raw-map "208z" 'GOLD-prefix)	        ; R1 ("gold")
(define-key sun-raw-map "209z" 'query-replace)		; R2
(define-key sun-raw-map "210z" 'yank)       		; R3
(define-key sun-raw-map "211z" 'set-mark-command)		; R4
(define-key sun-raw-map "212z" 'kill-region)		; R5
(define-key sun-raw-map "213z" 'copy-region-as-kill)	; R6
(define-key sun-raw-map "214z" 'beginning-of-buffer)	; R7
(define-key sun-raw-map "215z" 'previous-line)		; R8  (up-arrow)
(define-key sun-raw-map "216z" 'scroll-down)		; R9
(define-key sun-raw-map "217z" 'backward-char)		; R10 (rt-arrow)
(define-key sun-raw-map "219z" 'forward-char)		; R12 (dn-arrow)
(define-key sun-raw-map "221z" 'next-line)		; R14 (lf-arrow)
(define-key sun-raw-map "218z" 'recenter)               ; R11
(define-key sun-raw-map "220z" 'end-of-buffer)		; R13
(define-key sun-raw-map "222z" 'scroll-up)		; R15

;; L keys
;;NOTE:  L1 does not work
;;(define-key sun-raw-map "192z" 'nothing)	                ; L1
;;(define-key sun-raw-map "193z" 'nothing)  		; L2
(define-key sun-raw-map "194z" 'next-start-of-line)	; L3
(define-key sun-raw-map "195z" 'next-end-of-line)		; L4
(define-key sun-raw-map "196z" 'delete-char)		; L5
(define-key sun-raw-map "197z" 'delete-current-word)	; L6
(define-key sun-raw-map "198z" 'kill-line) 		; L7
(define-key sun-raw-map "199z" 'delete-current-line)       ; L8
;;(define-key sun-raw-map "200z" 'nothing)       ; L9
;;(define-key sun-raw-map "201z" 'nothing)       ; L10


;========================x-sunkeys.el ========================
;;
;; SUN console keyboard stuff for X-Windows
;;
;;     Loaded from:  ...term/x-win.el
(setq mysunkeys-defined t)
(defvar sun-raw-map (make-sparse-keymap) 
       "*Keymap for ESC-[ encoded keyboard")

;;  set up prefix through ESCAPE map
(define-key esc-map "[" sun-raw-map)		; Install sun-raw-map

;; R keys
(define-key sun-raw-map "208z" 'GOLD-prefix)	        ; R1 ("gold")
(define-key sun-raw-map "209z" 'query-replace)		; R2
(define-key sun-raw-map "210z" 'yank)       		; R3
(define-key sun-raw-map "211z" 'set-mark-command)		; R4
(define-key sun-raw-map "212z" 'kill-region)		; R5
(define-key sun-raw-map "213z" 'copy-region-as-kill)	; R6
(define-key sun-raw-map "214z" 'beginning-of-buffer)	; R7
(define-key sun-raw-map "215z" 'previous-line)		; R8  (up-arrow)
(define-key sun-raw-map "216z" 'scroll-down)		; R9
(define-key sun-raw-map "217z" 'backward-char)		; R10 (rt-arrow)
(define-key sun-raw-map "219z" 'forward-char)		; R12 (dn-arrow)
(define-key sun-raw-map "221z" 'next-line)		; R14 (lf-arrow)
(define-key sun-raw-map "218z" 'recenter)               ; R11
(define-key sun-raw-map "220z" 'end-of-buffer)		; R13
(define-key sun-raw-map "222z" 'scroll-up)		; R15

;; L keys
;;NOTE:  L1 does not work
;;(define-key sun-raw-map "192z" 'nothing)	                ; L1
;;(define-key sun-raw-map "193z" 'nothing)  		; L2
(define-key sun-raw-map "194z" 'next-start-of-line)	; L3
(define-key sun-raw-map "195z" 'next-end-of-line)		; L4
(define-key sun-raw-map "196z" 'delete-char)		; L5
(define-key sun-raw-map "197z" 'delete-current-word)	; L6
(define-key sun-raw-map "198z" 'kill-line) 		; L7
(define-key sun-raw-map "199z" 'delete-current-line)       ; L8
;;(define-key sun-raw-map "200z" 'nothing)       ; L9
;;(define-key sun-raw-map "201z" 'nothing)       ; L10

;====================  goldkeys.el ======================

;; set up GOLD keymap for both sun and wyse

(setq GOLD-map (make-keymap))
(fset 'GOLD-prefix GOLD-map)

(defvar GOLD-map nil
   "GOLD-map maps the function keys on the keyboard preceeded
by the GOLD key.  GOLD is PF1 on Wyse-75 and R1 on Sun console")

(defun define-keypad-key (keymap function-keymap-slot definition)
  (let ((function-key-sequence (function-key-sequence function-keymap-slot)))
    (if function-key-sequence
	(define-key keymap function-key-sequence definition))))

;;Bind GOLD/Keyboard keys
(define-key GOLD-map "\C-g" 'keyboard-quit)             ; just for safety
(define-key GOLD-map "\C-m" 'newline-and-indent)        ;"Return"
(define-key GOLD-map " " 'undo)				;"Spacebar"
(define-key GOLD-map "=" 'goto-line)                    ; "="
(define-key GOLD-map "%" 'match-it)                     ; "%"
(define-key GOLD-map "]" 'call-last-kbd-macro)          ; "]"
(define-key GOLD-map "`" 'what-line)                    ; "`"
(define-key GOLD-map "/" 'c-comment)                    ; "/"
;  several defs deleted to convserve bandwidth, but you can imagine
(define-key GOLD-map "0" 'insert-hfile)                 ; "0"

;; letter combinations:
(define-key GOLD-map "b" 'buffer-writeable)             ; "b"
(define-key GOLD-map "B" 'buffer-writeable)             ; "B"
(define-key GOLD-map "c" 'case-flip-character)          ; "c"
(define-key GOLD-map "C" 'case-flip-character)          ; "C"
(define-key GOLD-map "d" 'compare-windows)              ; "d"
(define-key GOLD-map "D" 'compare-windows)              ; "D"
(define-key GOLD-map "f" 'fill-paragraph)               ; "f"
;  several defs deleted to convserve bandwidth, but you can imagine
(define-key GOLD-map "w" 'other-window)                 ; "w"
(define-key GOLD-map "W" 'other-window)                 ; "W"

;=================== end =============================
--
-----
	Dion Hollenbeck             (619) 455-5590 x2814
	Megatek Corporation, 9645 Scranton Road, San Diego, CA  92121
        uunet!megatek!hollen       or  hollen@megatek.uucp
Technical Details
Message-ID: <HOLLEN.91Mar5082144@tau.megatek.UUCP>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!elroy.jpl.nasa.gov!jarthur!ucivax!megatek!tau!hollen
References: <1991Mar2.020840.20301@uicbert.eecs.uic.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103b8b,e4f178fe636a0d5
X-Google-Attributes: gid103b8b,public
X-Google-ArrivalTime: 1991-03-06 13:45:53 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!elroy.jpl.nasa.gov!jarthur!ucivax!megatek!tau!hollen
From: hollen@megatek.UUCP (Dion Hollenbeck)
Newsgroups: gnu.emacs.help
Subject: Re: Mouse under X
Message-ID: <HOLLEN.91Mar5082144@tau.megatek.UUCP>
Date: 5 Mar 91 16:21:44 GMT
References: <1991Mar2.020840.20301@uicbert.eecs.uic.edu>
Sender: hollen@megatek.UUCP
Distribution: gnu
Organization: Megatek Corporation, San Diego, California
Lines: 223
In-reply-to: sloan@uicbert.eecs.uic.edu's message of 2 Mar 91 02:08:40 GMT