home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / lucid / lemacs-19.6 / lisp / term / x-win.el < prev    next >
Encoding:
Text File  |  1992-12-19  |  5.0 KB  |  135 lines

  1. ;; Parse switches controlling how Emacs interfaces with X window system.
  2. ;; Copyright (C) 1990 Free Software Foundation, Inc.
  3.  
  4. ;; This file is part of GNU Emacs.
  5.  
  6. ;; GNU Emacs is distributed in the hope that it will be useful,
  7. ;; but WITHOUT ANY WARRANTY.  No author or distributor
  8. ;; accepts responsibility to anyone for the consequences of using it
  9. ;; or for whether it serves any particular purpose or works at all,
  10. ;; unless he says so in writing.  Refer to the GNU Emacs General Public
  11. ;; License for full details.
  12.  
  13. ;; Everyone is granted permission to copy, modify and redistribute
  14. ;; GNU Emacs, but only under the conditions described in the
  15. ;; GNU Emacs General Public License.   A copy of this license is
  16. ;; supposed to have been given to you along with GNU Emacs so you
  17. ;; can know your rights and responsibilities.  It should be in a
  18. ;; file named COPYING.  Among other things, the copyright notice
  19. ;; and this notice must be preserved on all copies.
  20.  
  21.  
  22. ;; X-win.el: this file is loaded from ../lisp/startup.el when it
  23. ;; recognizes that X windows are to be used.  The X display is opened
  24. ;; and hooks are set for popping up the initial window.
  25.  
  26. ;; startup.el will then examine startup files, and eventually call the hooks
  27. ;; which create the first window (s).
  28.  
  29.  
  30. ;;; If you want to change this variable, this is the place you must do it.
  31. ;;; Do not set it to a string containing periods.  X doesn't like that.
  32. ;(setq x-emacs-application-class "Emacs")
  33.  
  34.  
  35. ;; The daemon stuff isn't really useful at the moment.
  36. (defvar x-daemon-mode nil
  37.   "When set, means initially create just a minibuffer.")
  38.       
  39. (defun x-establish-daemon-mode (switch)
  40.   (setq x-daemon-mode t))
  41.  
  42. (if (eq window-system 'x)
  43.     (progn
  44.       (setq window-setup-hook (cons 'x-pop-initial-window window-setup-hook))
  45.       (setq screen-creation-func 'x-create-screen)
  46.       (require 'screen)
  47.       (require 'x-faces)
  48.       (require 'x-iso8859-1)
  49.       (setq suspend-hook
  50.         '(lambda ()
  51.            (error "Suspending an emacs running under X makes no sense")))
  52.       (setq command-line-args-left (cdr (x-open-connection command-line-args)))
  53.       )
  54.   (error "Loading x-win.el but not compiled for X"))
  55.  
  56.  
  57. ;;; selections and active regions
  58.  
  59. ;;; When something is placed on the kill-ring, we assert it as the
  60. ;;; Clipboard selection.
  61. ;;;
  62. ;;; If and only if zmacs-regions is true:
  63. ;;;
  64. ;;; When a mark is pushed and the region goes into the "active" state, we
  65. ;;; assert it as the Primary selection.  This causes it to be hilighted.
  66. ;;; When the region goes into the "inactive" state, we disown the Primary
  67. ;;; selection, causing the region to be dehilighted.
  68. ;;;
  69. ;;; Note that it is possible for the region to be in the "active" state
  70. ;;; and not be hilighted, if it is in the active state and then some other
  71. ;;; application asserts the selection.  This is probably not a big deal.
  72.  
  73. (defun x-activate-region-as-selection ()
  74.   (if (marker-buffer (mark-marker t))
  75.       (x-own-selection (cons (point-marker t) (mark-marker t)))))
  76.  
  77. ;(setq kill-hooks 'x-own-clipboard)
  78. (setq kill-hooks '(x-own-clipboard x-store-cutbuffer))
  79.  
  80. ;;; these are only ever called if zmacs-regions is true.
  81. (setq zmacs-deactivate-region-hook 'x-disown-selection)
  82. (setq zmacs-activate-region-hook 'x-activate-region-as-selection)
  83. (setq zmacs-update-region-hook 'x-activate-region-as-selection)
  84.  
  85. ;; This is the function which creates the first X window.  It is called
  86. ;; from startup.el after the user's init file is processed.
  87.  
  88. (defun x-pop-initial-window ()
  89.   ;; xterm.c depends on using interrupt-driven input.
  90.   (set-input-mode t nil t)
  91.   (require 'x-mouse)
  92.   (require 'xselect)
  93.   (setq mouse-motion-handler 'x-track-pointer)
  94.   (setq character-set-property 'x-iso8859/1) ; see x-iso8859-1.el
  95.   ;; see screen.el for this function
  96.   (pop-initial-screen ())
  97.   (delete-screen terminal-screen)
  98.   )
  99.  
  100.  
  101. ;; Keypad type things
  102.  
  103. (define-key global-map 'home        "\C-a")
  104. (define-key global-map 'left        "\C-b")
  105. (define-key global-map 'up        "\C-p")
  106. (define-key global-map 'right        "\C-f")
  107. (define-key global-map 'down        "\C-n")
  108. (define-key global-map 'prior        "\C-p")
  109. (define-key global-map 'next        "\C-n")
  110. (define-key global-map 'end        "\C-e")
  111. (define-key global-map 'begin        "\C-a")
  112.  
  113. (define-key global-map 'kp_enter    [return])
  114. (define-key global-map 'kp_tab        [tab])
  115.  
  116. ;; if we define these this way (instead of leaving them bound to
  117. ;; self-insert-command), then the ^Hb display is hidiously cluttered.
  118. ;(define-key global-map 'kp_space    " ")
  119. ;(define-key global-map 'kp_equal    "=")
  120. ;(define-key global-map 'kp_multiply    "*")
  121. ;(define-key global-map 'kp_add        "+")
  122. ;(define-key global-map 'kp_separator    ",")
  123. ;(define-key global-map 'kp_subtract    "-")
  124. ;(define-key global-map 'kp_decimal    ".")
  125. ;(define-key global-map 'kp_divide    "/")
  126.  
  127. (define-key global-map 'undo        'undo)
  128. (define-key global-map 'help        'help-for-help)
  129. (define-key help-map 'help        'help-for-help)
  130.  
  131.  
  132. ;; Horizontal split window do not work in this emacs
  133. (substitute-key-definition 'split-window-horizontally 'x-new-screen global-map)
  134. (substitute-key-definition 'split-window-horizontally 'x-new-screen ctl-x-map)
  135.