home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / emacs / 2967 < prev    next >
Encoding:
Internet Message Format  |  1992-08-27  |  16.5 KB

  1. Path: sparky!uunet!sun-barr!news2me.ebay.sun.com!cronkite.Central.Sun.COM!texsun!exucom.exu.ericsson.se!news
  2. From: exujsch@exu.ericsson.se (Johnny Schmittou EXU-T-EEG x7887 Dallas Texas USA)
  3. Newsgroups: comp.emacs
  4. Subject: xterm key bindings for jove and GNUEmacs (Part 2)
  5. Keywords: xterm, .Xdefaults, .joverc, .emacs
  6. Message-ID: <1992Aug27.145032.25092@exu.ericsson.se>
  7. Date: 27 Aug 92 14:50:32 GMT
  8. Sender: news@exu.ericsson.se
  9. Reply-To: exujsch@exu.ericsson.se (Johnny Schmittou EXU-T-EEG x7887 Dallas Texas USA)
  10. Organization: Ericsson Network Systems
  11. Lines: 433
  12. Nntp-Posting-Host: s08b02.exu.ericsson.se
  13.  
  14.  
  15. This is Part 2 to my previous posting.  Please see Part 1 for the
  16. introductory details.  Note that my jove bindings and GNUEmacs bindings
  17. are almost mirror images of each other.  Thus I can be using either
  18. editor and my key bindings are virtually (95%?) the same...
  19.  
  20. Following are the GNUemacs key bindings for use in the .emacs file, to be
  21. used in conjunction with the ".Xdefaults" file and the "xterm" shell:
  22.  
  23. ------------- begin cut here for use in .emacs file, GNUEmacs V18.57 --------------------
  24. ;; File:  define-sun4-keys-xterm.el
  25. ;;
  26. ;; Binds Sun xterm keys with emacs commands.  For use on a SUN4 type keyboard.
  27. ;;
  28.  
  29. ;  (message "Start of define-sun4-keys-xterm")
  30. ;  (sit-for 2)
  31.  
  32. ;; unset key sequence ESC-O, so that cursor keys work
  33. ;(global-unset-key "\eO")
  34.  
  35. ;; unset key sequence ESC-[ (normally forward-paragraph)
  36. ;; so that Sun xterm keyboard function keys do useful things
  37. ;(global-unset-key "\e[")
  38.  
  39. ;-------------------------------------------------------------------------
  40. ;  Sun xterm top row righthand keypad keys
  41. ;-------------------------------------------------------------------------
  42.  
  43. ;  (message "Before top row keypad keys")
  44. ;  (sit-for 2)
  45.  
  46.   (global-set-key "\C-x3" 'execute-extended-command) ; Pause
  47. ;  (global-set-key "\C-w" 'kill-region)               ; PrSc, R2
  48. ;  (global-set-key "\e[210z" 'kill-region)            ; Scroll Lock Break, R3
  49.  
  50. ;-------------------------------------------------------------------------
  51. ;  Sun xterm top row shifted righthand keypad keys
  52. ;-------------------------------------------------------------------------
  53.  
  54. ;  (message "Before shifted top row keypad keys")
  55. ;  (sit-for 2)
  56.  
  57.   (global-set-key "\C-x4" 'shell-command)            ; Pause
  58.   (global-set-key "\C-x9" 'keyboard-quit)            ; PrSc, R2
  59.   (global-set-key "\C-x8" 'keyboard-quit)            ; Scroll Lock Break, R3
  60.  
  61. ;-------------------------------------------------------------------------
  62. ; Numeric righthand keypad
  63. ;-------------------------------------------------------------------------
  64.  
  65. ;  (message "Before righthand keypad keys")
  66. ;  (sit-for 2)
  67.  
  68. ;  (global-set-key "\e[211z"  'ESC-prefix)         ;Define meta key
  69.   (global-set-key "\eh"     'describe-bindings)   ;NP =
  70.   (global-set-key "\C-r" 'find-prev-occur)        ;NP /
  71.   (global-set-key "\C-s" 'find-next-occur)        ;NP *
  72.   (global-set-key "\C-x-"   'delete-entire-line)  ;NP -
  73.   (global-set-key "\C-xE" 'backward-word)         ;NP1
  74.   (global-set-key "\e[218z" 'other-window)        ;NP5
  75. ;  (global-set-key "\e[E" 'other-window)           ;NP5
  76.   (global-set-key "\C-x\C-w" 'copy-above-word)    ;NP7
  77.   (global-set-key "\C-x\C-l" 'copy-above-line)    ;NP9
  78.   (global-set-key "\C-a" 'overwrite-mode)         ;NP0
  79.   (global-set-key "\C-x+" 'kill-word)             ;NP+
  80.   (global-set-key "\C-f" 'forward-to-word)        ;NP3
  81.   (global-set-key "\e." 'set-mark-command)        ;NP.
  82.   (global-set-key "\C-x6" 'enlarge-window)        ;NP Enter
  83.  
  84. ;-------------------------------------------------------------------------
  85. ; Shifted numeric righthand keypad
  86. ;-------------------------------------------------------------------------
  87.  
  88. ;  (message "Before shifted righthand keypad keys")
  89. ;  (sit-for 2)
  90.  
  91.   (global-set-key "\C-\\" 'find-first-occur-backward) ;NP /
  92.   (global-set-key "\es"  'find-first-occur-forward)   ;NP *
  93.   (global-set-key "\C-y" 'yank)                       ;NP -
  94.   (global-set-key "\eL" 'downcase-word)               ;NP1
  95. ;  (global-set-key "\e[218z" 'other-window)            ;NP5
  96.   (global-set-key "\C-xW" 'copy-below-word)           ;NP7
  97.   (global-set-key "\C-xL" 'copy-below-line)           ;NP9
  98.   (global-set-key "\C-o" 'open-line)                  ;NP0
  99. ;  (global-set-key "\C-y" 'yank)                       ;NP+
  100.   (global-set-key "\eU" 'upcase-word)                 ;NP3
  101.   (global-set-key "\C-x." 'delete-to-eol)             ;NP.
  102.   (global-set-key "\C-x7" 'shrink-window)             ;NP Enter
  103.  
  104. ;-------------------------------------------------------------------------
  105. ; Lefthand keypad
  106. ;-------------------------------------------------------------------------
  107. ;  (message "Before lefthand keypad")
  108. ;  (sit-for 2)
  109.  
  110. (global-set-key "\ez" 'save-buffers-kill-emacs)     ;; L1 "STOP"
  111. (global-set-key "\e[193z" 'rerun-prev-command)      ;; L2 "AGAIN"
  112. (global-set-key "\C-xa" 'apropos)                   ;; L3 "PROPS"
  113. ; (global-set-key "\e[195z" 'advertised-undo)         ;; L4 "UNDO" (as C-x u)
  114. ; (global-set-key "\e[196z" 'describe-mode)           ;; L5 "FRONT" (C-h m) 
  115. ; (global-set-key "\e[197z" 'copy-region-as-kill)     ;; L6 "COPY" (as M-w)
  116. ; (global-set-key "\e[198z" 'find-file)               ;; L7 "OPEN" (file dus)
  117. ; (global-set-key "\e[199z" 'yank)                    ;; L8 "PASTE" (as C-y)
  118. (global-set-key "\ea" 'auto-get-file)               ;; L9 "FIND" (as M-s)
  119. ; (global-set-key "\e[201z" 'kill-region-safe)        ;; L10 "CUT" (as C-w)
  120. ; (global-set-key "\e[202z" 'info)                    ;; "HELP" (as C-h i)
  121.  
  122. ;-------------------------------------------------------------------------
  123. ; GOLD (ESC) key definitions
  124. ;-------------------------------------------------------------------------
  125.  
  126. ;  (message "Before gold keys")
  127. ;  (sit-for 2)
  128.  
  129.   (global-set-key "\e!" 'insert-comment-date)
  130.   (global-set-key "\e/" 'call-last-kbd-macro)
  131. ;  (global-set-key "\e." 'set-mark-command)
  132. ;  (global-set-key "\ea" 'apropos)
  133.   (global-set-key "\eA" 'apropos)
  134.   (global-set-key "\eb"  'beginning-of-buffer)
  135.   (global-set-key "\eB"  'beginning-of-buffer)
  136.   (global-set-key "\ec"  'capitalize-word)
  137.   (global-set-key "\eC"  'center-line)
  138. ;  (global-set-key "\ed"  'my-insert-date)
  139. ;  (global-set-key "\eD"  'my-insert-date)
  140.   (global-set-key "\ed"  'kill-word)
  141.   (global-set-key "\eD"  'kill-word)
  142.   (global-set-key "\ee"  'end-of-buffer)
  143.   (global-set-key "\eE"  'end-of-buffer)
  144.   (global-set-key "\ef"  'do-nothing)
  145.   (global-set-key "\eF"  'do-nothing)
  146.   (global-set-key "\eg"  'auto-get-file)
  147.   (global-set-key "\eG"  'auto-get-file)
  148. ;  (global-set-key "\eh"  'describe-function)
  149.   (global-set-key "\eH"  'describe-function)
  150.   (global-set-key "\ei"  'find-file)
  151.   (global-set-key "\eI"  'find-file)
  152.   (global-set-key "\ek"  'call-last-kbd-macro)
  153.   (global-set-key "\eK"  'call-last-kbd-macro)
  154.   (global-set-key "\el"  'start-kbd-macro)
  155. ; (global-set-key "\eL"  'start-kbd-macro)
  156.   (global-set-key "\em"  'toggle-read-only)
  157.   (global-set-key "\eM"  'toggle-read-only)
  158.   (global-set-key "\en"  'next-window)
  159.   (global-set-key "\eN"  'next-window)
  160.   (global-set-key "\eo"  'write-file)
  161.   (global-set-key "\eO"  'write-file)
  162.   (global-set-key "\ep"  'previous-window)
  163.   (global-set-key "\eP"  'previous-window)
  164.   (global-set-key "\eq"  'kill-emacs)
  165.   (global-set-key "\eQ"  'kill-emacs)
  166.   (global-set-key "\er"  'end-kbd-macro)
  167.   (global-set-key "\eR"  'end-kbd-macro)
  168. ;;;  (global-set-key "\es"  'list-directory)
  169. ;;;  (global-set-key "\eS"  'list-directory)
  170. ;  (global-set-key "\es"  'cd)
  171. ;  (global-set-key "\eS"  'cd)
  172. ;;;  (global-set-key "\et"  'do-nothing)
  173. ;;;  (global-set-key "\eT"  'do-nothing)
  174.   (global-set-key "\eu"  'upcase-region)
  175. ;  (global-set-key "\eU"  'upcase-region)
  176.   (global-set-key "\ev"  'do-nothing)
  177.   (global-set-key "\eV"  'do-nothing)
  178.   (global-set-key "\ew"  'copy-region)
  179.   (global-set-key "\eW"  'copy-region)
  180. ;;; \ex is bound to execute-extended-command
  181. ;;; and should not be changed.
  182. ;;;  (global-set-key "\ex"  'insert-file)
  183. ;;;  (global-set-key "\eX"  'insert-file)
  184. ;;;  (global-set-key "\ey"  'do-nothing)
  185. ;;;  (global-set-key "\eY"  'do-nothing)
  186. ;;;  (global-set-key "\ez"  'save-buffers-kill-emacs)
  187. ;;;  (global-set-key "\eZ"  'save-buffers-kill-emacs)
  188.  
  189. ;-------------------------------------------------------------------------
  190. ; Control-key definitions
  191. ;-------------------------------------------------------------------------
  192.  
  193. ;  (message "Before control keys")
  194. ;  (sit-for 2)
  195.  
  196.   (global-set-key "\C-^" 'cursor-to-top)
  197.   (global-set-key "\C-'" 'quoted-insert)
  198. ;  (global-set-key "\C-a" 'overwrite-mode)
  199. ;  (global-set-key "\C-b" 'beginning-of-line) ;standard, left arrow
  200.   (global-set-key "\C-b" 'backward-char) ;standard, left arrow
  201.   (global-set-key "\C-d" 'delete-char)
  202.   (global-set-key "\C-e" 'end-of-line)
  203. ;  (global-set-key "\C-f" 'forward-word)  ;standard, right arrow
  204. ;  (global-set-key "\C-f" 'forward-char)  ;standard, right arrow
  205. ;;; "\C-g" is bound to the "keyboard-quit" function and should not be changed
  206. ;;; (global-set-key "\C-g" 'do-nothing)
  207. ;;; "\C-h" is bound to GNU Emacs help menu and should not be changed
  208. ;;; (global-set-key "\C-h" 'describe-bindings)
  209. ;  (global-set-key "\C-i" 'indent-for-tab-command)
  210.   (global-set-key "\C-j" 'insert-initials-date)
  211.   (global-set-key "\C-k" 'global-set-key)
  212.   (global-set-key "\C-l" 'recenter)
  213. ;;; "\C-m" is RETURN key and should not be changed
  214. ;  (global-set-key "\C-n" 'scroll-up)   ;standard, down arrow
  215.   (global-set-key "\C-n" 'next-line)   ;standard, down arrow
  216. ;  (global-set-key "\C-o" 'open-line)
  217. ;  (global-set-key "\C-p" 'scroll-down) ;standard, up arrow
  218.   (global-set-key "\C-p" 'previous-line) ;standard, up arrow
  219. ; (global-set-key "\C-q" 'keyboard-quit)
  220. ;  (global-set-key "\C-r" 'find-prev-occur)
  221. ;;; "\C-s" is global-setd to be incremental-search-forward;  it also
  222. ;;;    does successive forward searches.
  223.   (global-set-key "\C-s" 'find-next-occur)
  224.   (global-set-key "\C-t" 'display-the-time)
  225.   (global-set-key "\C-u" 'upcase-word)
  226.   (global-set-key "\C-v" 'cursor-to-bottom)
  227.   (global-set-key "\C-w" 'kill-region)
  228.  
  229. ;;; "\C-x" is a prefix character and should not be changed
  230.   (global-set-key "\C-xw" 'copy-above-space)
  231.   (global-set-key "\C-xl" 'copy-below-space)
  232.  
  233. ;  (global-set-key "\C-y" 'yank)
  234.   (global-set-key "\C-z" 'save-buffers-kill-emacs)
  235.   (global-set-key "\C-_" 'find-first-occur-forward)
  236. ;  (global-set-key "\C-\\" 'find-first-occur-backward)
  237.  
  238. ;-------------------------------------------------------------------------
  239. ; Function key definitions
  240. ;-------------------------------------------------------------------------
  241.  
  242. ;  (message "Before function keys")
  243. ;  (sit-for 2)
  244.  
  245.   (global-set-key "\e1" 'delete-other-windows)   ; F1
  246.   (global-set-key "\e2" 'split-window)           ; F2
  247.   (global-set-key "\e3" 'write-file)             ; F3
  248.   (global-set-key "\e4" 'find-file)              ; F4
  249.   (global-set-key "\e5" 'query-replace)          ; F5
  250.   (global-set-key "\e6" 'buffer-menu)            ; F6
  251. ;  (global-set-key "\e6" 'list-buffers)           ; F6
  252.   (global-set-key "\e7" 'scroll-down)            ; F7
  253.   (global-set-key "\e8" 'scroll-up)              ; F8
  254.   (global-set-key "\e9" 'kill-buffer)            ; F9
  255.   (global-set-key "\e0" 'describe-key-briefly)   ; F10
  256.   (global-set-key "\C-x1" 'describe-function)    ; F11
  257.   (global-set-key "\C-x2" 'switch-to-buffer)     ; F12
  258.  
  259. ;-------------------------------------------------------------------------
  260. ; Arrow key definitions
  261. ;-------------------------------------------------------------------------
  262.  
  263. ;  (message "Before arrow keys")
  264. ;  (sit-for 2)
  265.  
  266. ; (global-set-key "\e*\e\C-h" 'previous-line)      ; Up arrow
  267. ; (global-set-key "\e*\e\C-n" 'next-line)      ; down arrow
  268. ; (global-set-key "\e*\e\C-l" 'forward-char)      ; right arrow
  269. ; (global-set-key "\e*\e\C-j" 'backward-char)      ; left arrow
  270.  
  271. ;  (global-set-key  "\e[215z" 'previous-line)        ; R8  (up-arrow)
  272. ;  (global-set-key  "\e[217z" 'backward-char)        ; R10 (lf-arrow)
  273. ;  (global-set-key  "\e[219z" 'forward-char)        ; R12 (rt-arrow)
  274. ;  (global-set-key  "\e[221z" 'next-line)        ; R14 (dn-arrow)
  275.  
  276. ; (global-set-key "\C-h" 'previous-line) ;up-arrow
  277. ; (global-set-key "\C-n" 'next-line)       ;down-arrow
  278. ; (global-set-key "\C-j" 'backward-char)   ;left-arrow
  279. ; (global-set-key "\C-l" 'forward-char)         ;right-arrow
  280.  
  281.   (global-set-key  "\e[A" 'previous-line)    ; R8  (up-arrow)
  282.   (global-set-key  "\e[D" 'backward-char)    ; R10 (lf-arrow)
  283.   (global-set-key  "\e[C" 'forward-char)    ; R12 (rt-arrow)
  284.   (global-set-key  "\e[B" 'next-line)        ; R14 (dn-arrow)
  285.  
  286. ;-------------------------------------------------------------------------
  287. ; Shifted arrow key definitions
  288. ;-------------------------------------------------------------------------
  289.  
  290. ;  (message "Before shifted arrow keys")
  291. ;  (sit-for 2)
  292.  
  293.  (global-set-key "\C-xA" 'beginning-of-buffer) ;up-arrow
  294.  (global-set-key "\C-xB" 'end-of-buffer)       ;down-arrow
  295.  (global-set-key "\C-xD" 'beginning-of-line)   ;left-arrow
  296.  (global-set-key "\C-xC" 'end-of-line)         ;right-arrow
  297.  
  298. ; (global-set-key "\M-\C-h" 'beginning-of-buffer) ;up-arrow
  299. ; (global-set-key "\M-\C-n" 'end-of-buffer)       ;down-arrow
  300. ; (global-set-key "\M-\C-j" 'beginning-of-line)   ;left-arrow
  301. ; (global-set-key "\M-\C-l" 'end-of-line)         ;right-arrow
  302.  
  303. ; (global-set-key "\M-\C-p" 'beginning-of-buffer) ;up-arrow
  304. ; (global-set-key "\M-\C-n" 'end-of-buffer)       ;down-arrow
  305. ; (global-set-key "\M-\C-b" 'beginning-of-line)   ;left-arrow
  306. ; (global-set-key "\M-\C-f" 'end-of-line)         ;right-arrow
  307.  
  308. ; (global-set-key "\M-\C-213z" 'find-first-occur-forward) ;gold-* (keypad)
  309.  
  310. ;  (message "All of my keys are now defined")
  311. ;  (sit-for 2)
  312.  
  313. ;*************************************************************************
  314. ; Define various lisp functions
  315. ;*************************************************************************
  316.  
  317. ;;;
  318. ;;; misc stuff
  319. ;;;                                
  320.  
  321. ;  (message "Before misc stuff")
  322. ;  (sit-for 2)
  323.  
  324. ;-------------------------------------------------------------------------
  325. ; Define some keyboard (kbd) macros as Lisp code.
  326.  
  327. (fset 'auto-get-file
  328.    ".C4D.
  329.  
  330. (fset 'copy-above-space
  331.    "[A.[B")
  332.  
  333. (fset 'copy-below-space
  334.    "[B.[A")
  335.  
  336. ;-------------------------------------------------------------------------
  337. ; Define some honest to goodness Lisp functions.
  338.  
  339. (defun copy-above-word ()
  340.   "Copies the word above the cursor."
  341.   (interactive)
  342.   (previous-line 1)
  343.   (delete-current-word 1)
  344.   (undelete-words)
  345.   (next-line 1)
  346.   (undelete-words)
  347.   (end-of-line)
  348. )
  349.  
  350. (defun copy-above-line ()
  351.   "Copies the line above the cursor."
  352.   (interactive)
  353.   (previous-line 1)
  354.   (delete-to-eol 1)
  355.   (my-undelete-lines)
  356.   (next-line 1)
  357.   (my-undelete-lines)
  358.   (end-of-line)
  359. )
  360.  
  361. (defun copy-below-word ()
  362.   "Copies the word below the cursor."
  363.   (interactive)
  364.   (next-line 1)
  365.   (delete-current-word 1)
  366.   (undelete-words)
  367.   (previous-line 1)
  368.   (undelete-words)
  369.   (end-of-line)
  370. )
  371.  
  372. (defun copy-below-line ()
  373.   "Copies the line below the cursor."
  374.   (interactive)
  375.   (next-line 1)
  376.   (delete-to-eol 1)
  377.   (my-undelete-lines)
  378.   (previous-line 1)
  379.   (my-undelete-lines)
  380.   (end-of-line)
  381. )
  382.  
  383. ;(defun insert-date()
  384. ;  (interactive)
  385. ;  (let ((date (current-time-string)))
  386. ;  (insert (substring date 4 7) "." (substring date 7 10) "," (substring date -5)
  387. ;          )))
  388.  
  389. (defun my-insert-date()
  390.   "Inserts the current date into the text."
  391.   (interactive)
  392.   (let ((mydate (current-time-string)))
  393.     (if (string-equal (substring mydate 8 9) " ")
  394.       (insert "0" (substring mydate 9 10) "-" (substring mydate 4 7) "-" 
  395.               (substring mydate 22 24)
  396.       )
  397.     (progn
  398.       (insert (substring mydate 8 10) "-" (substring mydate 4 7) "-" 
  399.               (substring mydate 22 24)
  400.       )
  401.     )
  402.     )
  403.   )
  404. )
  405.  
  406. (defun insert-initials-date()
  407.   "Inserts my initials and the date into the text."
  408.   (interactive)
  409.   (insert "--jbs ")
  410.   (my-insert-date)
  411. )
  412.  
  413. (defun insert-comment-date()
  414.   "Inserts comment character, my username and the current date into the text."
  415.   (interactive)
  416.   (insert "!*  EXUJSCH  ")
  417.   (my-insert-date)
  418. )
  419.  
  420. (defun skip-to-column ()
  421.   "Moves the cursor to a given column."
  422.   (interactive)
  423.   (setq new-cursor-position nil)
  424.   (setq new-cursor-position (read-string "Skip to which column: "))
  425.   (if (eq new-cursor-position nil)
  426.     (message "No column was entered.")
  427.   (progn
  428.     (setq int-cursor-position (string-to-int new-cursor-position))
  429.     (if (or 
  430.           (< int-cursor-position 1) 
  431.           (> int-cursor-position 80)
  432.         )
  433.       (message "Invalid column - must be between 1 and 80.")
  434.     (progn
  435.       (move-to-column int-cursor-position)
  436.     )
  437.     )
  438.   )
  439.   )
  440. )
  441. ------------- end cut here for use in .emacs file, GNUEmacs V18.57 --------------------
  442. --
  443. ___________________________________________________________________________
  444. Internet....: exujsch@exu.ericsson.se | "Everything I say is the absolute
  445. Real life...: Johnny Schmittou        |  Gospel...  Nah, just kidding."
  446. Virtual life: Q-man   ---<<<I'd rather be drumming.>>>--- Dallas, Texas USA
  447.