annotate lisp/term/w32-win.el @ 15863:f11b2bfc1275

new version from Torbj?Einarsson.
author Erik Naggum <erik@naggum.no>
date Wed, 14 Aug 1996 01:59:41 +0000
parents 658224992372
children 481b7874a1e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1 ;;; win32-win.el --- parse switches controlling interface with win32
14170
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
2
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3 ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5 ;; Author: Kevin Gallo
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6 ;; Keywords: terminals
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7
14170
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
8 ;; This file is part of GNU Emacs.
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
9
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
13 ;; any later version.
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
14
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
18 ;; GNU General Public License for more details.
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
19
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
20 ;; You should have received a copy of the GNU General Public License
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 13831
diff changeset
23 ;; Boston, MA 02111-1307, USA.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
24
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
25 ;;; Commentary:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
26
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
27 ;; win32-win.el: this file is loaded from ../lisp/startup.el when it recognizes
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
28 ;; that win32 windows are to be used. Command line switches are parsed and those
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
29 ;; pertaining to win32 are processed and removed from the command line. The
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
30 ;; win32 display is opened and hooks are set for popping up the initial window.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
31
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
32 ;; startup.el will then examine startup files, and eventually call the hooks
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
33 ;; which create the first window (s).
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
34
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
35 ;;; Code:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
36
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
37
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
38 ;; These are the standard X switches from the Xt Initialize.c file of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
39 ;; Release 4.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
40
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
41 ;; Command line Resource Manager string
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
42
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
43 ;; +rv *reverseVideo
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
44 ;; +synchronous *synchronous
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
45 ;; -background *background
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
46 ;; -bd *borderColor
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
47 ;; -bg *background
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
48 ;; -bordercolor *borderColor
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
49 ;; -borderwidth .borderWidth
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
50 ;; -bw .borderWidth
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
51 ;; -display .display
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
52 ;; -fg *foreground
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
53 ;; -fn *font
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
54 ;; -font *font
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
55 ;; -foreground *foreground
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
56 ;; -geometry .geometry
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
57 ;; -i .iconType
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
58 ;; -itype .iconType
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
59 ;; -iconic .iconic
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
60 ;; -name .name
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
61 ;; -reverse *reverseVideo
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
62 ;; -rv *reverseVideo
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
63 ;; -selectionTimeout .selectionTimeout
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
64 ;; -synchronous *synchronous
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
65 ;; -xrm
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
66
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
67 ;; An alist of X options and the function which handles them. See
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
68 ;; ../startup.el.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
69
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
70 (if (not (eq window-system 'win32))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
71 (error "%s: Loading win32-win.el but not compiled for win32" (invocation-name)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
72
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
73 (require 'frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
74 (require 'mouse)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
75 (require 'scroll-bar)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
76 (require 'faces)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
77 (require 'select)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
78 (require 'menu-bar)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
79
15136
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
80 ;; Because Windows scrollbars look and act quite differently compared
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
81 ;; with the standard X scroll-bars, we don't try to use the normal
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
82 ;; scroll bar routines.
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
83
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
84 (defun win32-handle-scroll-bar-event (event)
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
85 "Handle Win32 scroll bar events to do normal Window style scrolling."
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
86 (interactive "e")
15265
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
87 (let ((old-window (selected-window)))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
88 (unwind-protect
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
89 (let* ((position (event-start event))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
90 (window (nth 0 position))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
91 (portion-whole (nth 2 position))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
92 (bar-part (nth 4 position)))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
93 (save-excursion
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
94 (select-window window)
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
95 (cond
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
96 ((eq bar-part 'up)
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
97 (scroll-down 1))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
98 ((eq bar-part 'above-handle)
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
99 (scroll-down))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
100 ((eq bar-part 'handle)
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
101 (scroll-bar-maybe-set-window-start event))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
102 ((eq bar-part 'below-handle)
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
103 (scroll-up))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
104 ((eq bar-part 'down)
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
105 (scroll-up 1))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
106 )))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
107 (select-window old-window))))
15136
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
108
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
109 ;; The following definition is used for debugging.
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
110 ;(defun win32-handle-scroll-bar-event (event) (interactive "e") (princ event))
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
111
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
112 (global-set-key [vertical-scroll-bar mouse-1] 'win32-handle-scroll-bar-event)
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
113
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
114 ;; (scroll-bar-mode nil)
13831
2b90a48bb3db Disable scrollbars until fully functional.
Geoff Voelker <voelker@cs.washington.edu>
parents: 13434
diff changeset
115
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
116 (defvar x-invocation-args)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
117
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
118 (defvar x-command-line-resources nil)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
119
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
120 (defconst x-option-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
121 '(("-bw" . x-handle-numeric-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
122 ("-d" . x-handle-display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
123 ("-display" . x-handle-display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
124 ("-name" . x-handle-name-rn-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
125 ("-rn" . x-handle-name-rn-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
126 ("-T" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
127 ("-r" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
128 ("-rv" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
129 ("-reverse" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
130 ("-fn" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
131 ("-font" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
132 ("-ib" . x-handle-numeric-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
133 ("-g" . x-handle-geometry)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
134 ("-geometry" . x-handle-geometry)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
135 ("-fg" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
136 ("-foreground". x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
137 ("-bg" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
138 ("-background". x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
139 ("-ms" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
140 ("-itype" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
141 ("-i" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
142 ("-iconic" . x-handle-iconic)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
143 ("-xrm" . x-handle-xrm-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
144 ("-cr" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
145 ("-vb" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
146 ("-hb" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
147 ("-bd" . x-handle-switch)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
148
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
149 (defconst x-long-option-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
150 '(("--border-width" . "-bw")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
151 ("--display" . "-d")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
152 ("--name" . "-name")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
153 ("--title" . "-T")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
154 ("--reverse-video" . "-reverse")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
155 ("--font" . "-font")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
156 ("--internal-border" . "-ib")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
157 ("--geometry" . "-geometry")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
158 ("--foreground-color" . "-fg")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
159 ("--background-color" . "-bg")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
160 ("--mouse-color" . "-ms")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
161 ("--icon-type" . "-itype")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
162 ("--iconic" . "-iconic")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
163 ("--xrm" . "-xrm")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
164 ("--cursor-color" . "-cr")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
165 ("--vertical-scroll-bars" . "-vb")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
166 ("--border-color" . "-bd")))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
167
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
168 (defconst x-switch-definitions
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
169 '(("-name" name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
170 ("-T" name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
171 ("-r" reverse t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
172 ("-rv" reverse t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
173 ("-reverse" reverse t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
174 ("-fn" font)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
175 ("-font" font)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
176 ("-ib" internal-border-width)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
177 ("-fg" foreground-color)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
178 ("-foreground" foreground-color)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
179 ("-bg" background-color)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
180 ("-background" background-color)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
181 ("-ms" mouse-color)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
182 ("-cr" cursor-color)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
183 ("-itype" icon-type t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
184 ("-i" icon-type t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
185 ("-vb" vertical-scroll-bars t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
186 ("-hb" horizontal-scroll-bars t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
187 ("-bd" border-color)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
188 ("-bw" border-width)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
189
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
190 ;; Handler for switches of the form "-switch value" or "-switch".
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
191 (defun x-handle-switch (switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
192 (let ((aelt (assoc switch x-switch-definitions)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
193 (if aelt
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
194 (if (nth 2 aelt)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
195 (setq default-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
196 (cons (cons (nth 1 aelt) (nth 2 aelt))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
197 default-frame-alist))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
198 (setq default-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
199 (cons (cons (nth 1 aelt)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
200 (car x-invocation-args))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
201 default-frame-alist)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
202 x-invocation-args (cdr x-invocation-args))))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
203
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
204 ;; Make -iconic apply only to the initial frame!
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
205 (defun x-handle-iconic (switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
206 (setq initial-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
207 (cons '(visibility . icon) initial-frame-alist)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
208
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
209 ;; Handler for switches of the form "-switch n"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
210 (defun x-handle-numeric-switch (switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
211 (let ((aelt (assoc switch x-switch-definitions)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
212 (if aelt
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
213 (setq default-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
214 (cons (cons (nth 1 aelt)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
215 (string-to-int (car x-invocation-args)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
216 default-frame-alist)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
217 x-invocation-args
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
218 (cdr x-invocation-args)))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
219
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
220 ;; Handle the -xrm option.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
221 (defun x-handle-xrm-switch (switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
222 (or (consp x-invocation-args)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
223 (error "%s: missing argument to `%s' option" (invocation-name) switch))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
224 (setq x-command-line-resources (car x-invocation-args))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
225 (setq x-invocation-args (cdr x-invocation-args)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
226
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
227 ;; Handle the geometry option
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
228 (defun x-handle-geometry (switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
229 (let ((geo (x-parse-geometry (car x-invocation-args))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
230 (setq initial-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
231 (append initial-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
232 (if (or (assq 'left geo) (assq 'top geo))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
233 '((user-position . t)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
234 (if (or (assq 'height geo) (assq 'width geo))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
235 '((user-size . t)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
236 geo)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
237 x-invocation-args (cdr x-invocation-args))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
238
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
239 ;; Handle the -name and -rn options. Set the variable x-resource-name
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
240 ;; to the option's operand; if the switch was `-name', set the name of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
241 ;; the initial frame, too.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
242 (defun x-handle-name-rn-switch (switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
243 (or (consp x-invocation-args)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
244 (error "%s: missing argument to `%s' option" (invocation-name) switch))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
245 (setq x-resource-name (car x-invocation-args)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
246 x-invocation-args (cdr x-invocation-args))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
247 (if (string= switch "-name")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
248 (setq initial-frame-alist (cons (cons 'name x-resource-name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
249 initial-frame-alist))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
250
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
251 (defvar x-display-name nil
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
252 "The display name specifying server and frame.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
253
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
254 (defun x-handle-display (switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
255 (setq x-display-name (car x-invocation-args)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
256 x-invocation-args (cdr x-invocation-args)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
257
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
258 (defvar x-invocation-args nil)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
259
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
260 (defun x-handle-args (args)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
261 "Process the X-related command line options in ARGS.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
262 This is done before the user's startup file is loaded. They are copied to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
263 x-invocation args from which the X-related things are extracted, first
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
264 the switch (e.g., \"-fg\") in the following code, and possible values
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
265 \(e.g., \"black\") in the option handler code (e.g., x-handle-switch).
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
266 This returns ARGS with the arguments that have been processed removed."
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
267 (message "%s" args)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
268 (setq x-invocation-args args
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
269 args nil)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
270 (while x-invocation-args
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
271 (let* ((this-switch (car x-invocation-args))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
272 (orig-this-switch this-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
273 completion argval aelt)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
274 (setq x-invocation-args (cdr x-invocation-args))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
275 ;; Check for long options with attached arguments
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
276 ;; and separate out the attached option argument into argval.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
277 (if (string-match "^--[^=]*=" this-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
278 (setq argval (substring this-switch (match-end 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
279 this-switch (substring this-switch 0 (1- (match-end 0)))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
280 (setq completion (try-completion this-switch x-long-option-alist))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
281 (if (eq completion t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
282 ;; Exact match for long option.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
283 (setq this-switch (cdr (assoc this-switch x-long-option-alist)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
284 (if (stringp completion)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
285 (let ((elt (assoc completion x-long-option-alist)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
286 ;; Check for abbreviated long option.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
287 (or elt
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
288 (error "Option `%s' is ambiguous" this-switch))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
289 (setq this-switch (cdr elt)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
290 ;; Check for a short option.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
291 (setq argval nil this-switch orig-this-switch)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
292 (setq aelt (assoc this-switch x-option-alist))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
293 (if aelt
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
294 (if argval
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
295 (let ((x-invocation-args
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
296 (cons argval x-invocation-args)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
297 (funcall (cdr aelt) this-switch))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
298 (funcall (cdr aelt) this-switch))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
299 (setq args (cons this-switch args)))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
300 (setq args (nreverse args)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
301
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
302
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
303
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
304 ;;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
305 ;; Available colors
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
306 ;;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
307
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
308 (defvar x-colors '("aquamarine"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
309 "Aquamarine"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
310 "medium aquamarine"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
311 "MediumAquamarine"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
312 "black"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
313 "Black"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
314 "blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
315 "Blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
316 "cadet blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
317 "CadetBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
318 "cornflower blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
319 "CornflowerBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
320 "dark slate blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
321 "DarkSlateBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
322 "light blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
323 "LightBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
324 "light steel blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
325 "LightSteelBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
326 "medium blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
327 "MediumBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
328 "medium slate blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
329 "MediumSlateBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
330 "midnight blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
331 "MidnightBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
332 "navy blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
333 "NavyBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
334 "navy"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
335 "Navy"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
336 "sky blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
337 "SkyBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
338 "slate blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
339 "SlateBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
340 "steel blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
341 "SteelBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
342 "coral"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
343 "Coral"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
344 "cyan"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
345 "Cyan"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
346 "firebrick"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
347 "Firebrick"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
348 "brown"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
349 "Brown"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
350 "gold"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
351 "Gold"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
352 "goldenrod"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
353 "Goldenrod"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
354 "green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
355 "Green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
356 "dark green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
357 "DarkGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
358 "dark olive green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
359 "DarkOliveGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
360 "forest green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
361 "ForestGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
362 "lime green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
363 "LimeGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
364 "medium sea green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
365 "MediumSeaGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
366 "medium spring green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
367 "MediumSpringGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
368 "pale green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
369 "PaleGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
370 "sea green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
371 "SeaGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
372 "spring green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
373 "SpringGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
374 "yellow green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
375 "YellowGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
376 "dark slate grey"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
377 "DarkSlateGrey"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
378 "dark slate gray"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
379 "DarkSlateGray"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
380 "dim grey"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
381 "DimGrey"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
382 "dim gray"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
383 "DimGray"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
384 "light grey"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
385 "LightGrey"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
386 "light gray"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
387 "LightGray"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
388 "gray"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
389 "grey"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
390 "Gray"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
391 "Grey"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
392 "khaki"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
393 "Khaki"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
394 "magenta"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
395 "Magenta"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
396 "maroon"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
397 "Maroon"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
398 "orange"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
399 "Orange"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
400 "orchid"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
401 "Orchid"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
402 "dark orchid"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
403 "DarkOrchid"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
404 "medium orchid"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
405 "MediumOrchid"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
406 "pink"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
407 "Pink"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
408 "plum"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
409 "Plum"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
410 "red"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
411 "Red"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
412 "indian red"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
413 "IndianRed"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
414 "medium violet red"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
415 "MediumVioletRed"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
416 "orange red"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
417 "OrangeRed"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
418 "violet red"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
419 "VioletRed"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
420 "salmon"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
421 "Salmon"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
422 "sienna"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
423 "Sienna"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
424 "tan"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
425 "Tan"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
426 "thistle"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
427 "Thistle"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
428 "turquoise"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
429 "Turquoise"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
430 "dark turquoise"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
431 "DarkTurquoise"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
432 "medium turquoise"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
433 "MediumTurquoise"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
434 "violet"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
435 "Violet"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
436 "blue violet"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
437 "BlueViolet"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
438 "wheat"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
439 "Wheat"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
440 "white"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
441 "White"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
442 "yellow"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
443 "Yellow"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
444 "green yellow"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
445 "GreenYellow")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
446 "The full list of X colors from the `rgb.text' file.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
447
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
448 (defun x-defined-colors (&optional frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
449 "Return a list of colors supported for a particular frame.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
450 The argument FRAME specifies which frame to try.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
451 The value may be different for frames on different X displays."
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
452 (or frame (setq frame (selected-frame)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
453 (let ((all-colors x-colors)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
454 (this-color nil)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
455 (defined-colors nil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
456 (while all-colors
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
457 (setq this-color (car all-colors)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
458 all-colors (cdr all-colors))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
459 (and (face-color-supported-p frame this-color t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
460 (setq defined-colors (cons this-color defined-colors))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
461 defined-colors))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
462
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
463 ;;;; Function keys
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
464
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
465 (defun iconify-or-deiconify-frame ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
466 "Iconify the selected frame, or deiconify if it's currently an icon."
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
467 (interactive)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
468 (if (eq (cdr (assq 'visibility (frame-parameters))) t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
469 (iconify-frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
470 (make-frame-visible)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
471
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
472 (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
473 global-map)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
474
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
475 ;; Map certain keypad keys into ASCII characters
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
476 ;; that people usually expect.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
477 (define-key function-key-map [tab] [?\t])
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
478 (define-key function-key-map [linefeed] [?\n])
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
479 (define-key function-key-map [clear] [11])
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
480 (define-key function-key-map [return] [13])
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
481 (define-key function-key-map [escape] [?\e])
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
482 (define-key function-key-map [M-tab] [?\M-\t])
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
483 (define-key function-key-map [M-linefeed] [?\M-\n])
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
484 (define-key function-key-map [M-clear] [?\M-\013])
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
485 (define-key function-key-map [M-return] [?\M-\015])
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
486 (define-key function-key-map [M-escape] [?\M-\e])
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
487
14811
b876a8e1ab92 Don't define backspace, M-backspace, delete,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14170
diff changeset
488 ;; These don't do the right thing (voelker)
b876a8e1ab92 Don't define backspace, M-backspace, delete,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14170
diff changeset
489 ;(define-key function-key-map [backspace] [127])
b876a8e1ab92 Don't define backspace, M-backspace, delete,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14170
diff changeset
490 ;(define-key function-key-map [delete] [127])
b876a8e1ab92 Don't define backspace, M-backspace, delete,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14170
diff changeset
491 ;(define-key function-key-map [M-backspace] [?\M-\d])
b876a8e1ab92 Don't define backspace, M-backspace, delete,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14170
diff changeset
492 ;(define-key function-key-map [M-delete] [?\M-\d])
b876a8e1ab92 Don't define backspace, M-backspace, delete,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14170
diff changeset
493
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
494 ;; These tell read-char how to convert
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
495 ;; these special chars to ASCII.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
496 (put 'tab 'ascii-character ?\t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
497 (put 'linefeed 'ascii-character ?\n)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
498 (put 'clear 'ascii-character 12)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
499 (put 'return 'ascii-character 13)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
500 (put 'escape 'ascii-character ?\e)
14811
b876a8e1ab92 Don't define backspace, M-backspace, delete,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14170
diff changeset
501 ;; These don't seem to be necessary (voelker)
b876a8e1ab92 Don't define backspace, M-backspace, delete,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14170
diff changeset
502 ;(put 'backspace 'ascii-character 127)
b876a8e1ab92 Don't define backspace, M-backspace, delete,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14170
diff changeset
503 ;(put 'delete 'ascii-character 127)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
504
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
505
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
506 ;;;; Selections and cut buffers
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
507
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
508 ;;; We keep track of the last text selected here, so we can check the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
509 ;;; current selection against it, and avoid passing back our own text
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
510 ;;; from x-cut-buffer-or-selection-value.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
511 (defvar x-last-selected-text nil)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
512
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
513 ;;; It is said that overlarge strings are slow to put into the cut buffer.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
514 ;;; Note this value is overridden below.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
515 (defvar x-cut-buffer-max 20000
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
516 "Max number of characters to put in the cut buffer.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
517
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
518 (defvar x-select-enable-clipboard t
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
519 "Non-nil means cutting and pasting uses the clipboard.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
520 This is in addition to the primary selection.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
521
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
522 (defun x-select-text (text &optional push)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
523 (if x-select-enable-clipboard
15048
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
524 (win32-set-clipboard-data text))
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
525 (setq x-last-selected-text text))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
526
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
527 ;;; Return the value of the current selection.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
528 ;;; Consult the selection, then the cut buffer. Treat empty strings
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
529 ;;; as if they were unset.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
530 (defun x-get-selection-value ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
531 (if x-select-enable-clipboard
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
532 (let (text)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
533 ;; Don't die if x-get-selection signals an error.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
534 (condition-case c
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
535 (setq text (win32-get-clipboard-data))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
536 (error (message "win32-get-clipboard-data:%s" c)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
537 (if (string= text "") (setq text nil))
15048
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
538 (cond
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
539 ((not text) nil)
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
540 ((eq text x-last-selected-text) nil)
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
541 ((string= text x-last-selected-text)
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
542 ;; Record the newer string, so subsequent calls can use the 'eq' test.
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
543 (setq x-last-selected-text text)
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
544 nil)
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
545 (t
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
546 (setq x-last-selected-text text))))))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
547
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
548 ;;; Do the actual Windows setup here; the above code just defines
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
549 ;;; functions and variables that we use now.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
550
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
551 (setq command-line-args (x-handle-args command-line-args))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
552
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
553 ;;; Make sure we have a valid resource name.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
554 (or (stringp x-resource-name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
555 (let (i)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
556 (setq x-resource-name (invocation-name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
557
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
558 ;; Change any . or * characters in x-resource-name to hyphens,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
559 ;; so as not to choke when we use it in X resource queries.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
560 (while (setq i (string-match "[.*]" x-resource-name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
561 (aset x-resource-name i ?-))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
562
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
563 ;; For the benefit of older Emacses (19.27 and earlier) that are sharing
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
564 ;; the same lisp directory, don't pass the third argument unless we seem
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
565 ;; to have the multi-display support.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
566 (if (fboundp 'x-close-connection)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
567 (x-open-connection ""
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
568 x-command-line-resources
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
569 ;; Exit Emacs with fatal error if this fails.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
570 t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
571 (x-open-connection ""
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
572 x-command-line-resources))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
573
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
574 (setq frame-creation-function 'x-create-frame-with-faces)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
575
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
576 (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
577 x-cut-buffer-max))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
578
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
579 ;; Win32 expects the menu bar cut and paste commands to use the clipboard.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
580 ;; This has ,? to match both on Sunos and on Solaris.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
581 (menu-bar-enable-clipboard)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
582
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
583 ;; Apply a geometry resource to the initial frame. Put it at the end
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
584 ;; of the alist, so that anything specified on the command line takes
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
585 ;; precedence.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
586 (let* ((res-geometry (x-get-resource "geometry" "Geometry"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
587 parsed)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
588 (if res-geometry
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
589 (progn
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
590 (setq parsed (x-parse-geometry res-geometry))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
591 ;; If the resource specifies a position,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
592 ;; call the position and size "user-specified".
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
593 (if (or (assq 'top parsed) (assq 'left parsed))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
594 (setq parsed (cons '(user-position . t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
595 (cons '(user-size . t) parsed))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
596 ;; All geometry parms apply to the initial frame.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
597 (setq initial-frame-alist (append initial-frame-alist parsed))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
598 ;; The size parms apply to all frames.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
599 (if (assq 'height parsed)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
600 (setq default-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
601 (cons (cons 'height (cdr (assq 'height parsed)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
602 default-frame-alist)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
603 (if (assq 'width parsed)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
604 (setq default-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
605 (cons (cons 'width (cdr (assq 'width parsed)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
606 default-frame-alist))))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
607
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
608 ;; Check the reverseVideo resource.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
609 (let ((case-fold-search t))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
610 (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
611 (if (and rv
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
612 (string-match "^\\(true\\|yes\\|on\\)$" rv))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
613 (setq default-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
614 (cons '(reverse . t) default-frame-alist)))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
615
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
616 ;; Set x-selection-timeout, measured in milliseconds.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
617 (let ((res-selection-timeout
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
618 (x-get-resource "selectionTimeout" "SelectionTimeout")))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
619 (setq x-selection-timeout 20000)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
620 (if res-selection-timeout
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
621 (setq x-selection-timeout (string-to-number res-selection-timeout))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
622
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
623 (defun x-win-suspend-error ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
624 (error "Suspending an emacs running under Win32 makes no sense"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
625 (add-hook 'suspend-hook 'x-win-suspend-error)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
626
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
627 ;;; Arrange for the kill and yank functions to set and check the clipboard.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
628 (setq interprogram-cut-function 'x-select-text)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
629 (setq interprogram-paste-function 'x-get-selection-value)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
630
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
631 ;;; Turn off window-splitting optimization; win32 is usually fast enough
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
632 ;;; that this is only annoying.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
633 (setq split-window-keep-point t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
634
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
635 ;; Don't show the frame name; that's redundant.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
636 (setq-default mode-line-buffer-identification '("Emacs: %12b"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
637
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
638 ;;; Set to a system sound if you want a fancy bell.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
639 (set-message-beep 'ok)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
640
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
641 ;; Remap some functions to call win32 common dialogs
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
642
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
643 (defun internal-face-interactive (what &optional bool)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
644 (let* ((fn (intern (concat "face-" what)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
645 (prompt (concat "Set " what " of face"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
646 (face (read-face-name (concat prompt ": ")))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
647 (default (if (fboundp fn)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
648 (or (funcall fn face (selected-frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
649 (funcall fn 'default (selected-frame)))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
650 (fn-win (intern (concat (symbol-name window-system) "-select-" what)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
651 (value
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
652 (if (fboundp fn-win)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
653 (funcall fn-win)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
654 (if bool
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
655 (y-or-n-p (concat "Should face " (symbol-name face)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
656 " be " bool "? "))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
657 (read-string (concat prompt " " (symbol-name face) " to: ")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
658 default)))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
659 (list face (if (equal value "") nil value))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
660
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
661 ;; Redefine the font selection to use the Win32 dialog
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
662
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
663 (defun mouse-set-font (&rest fonts)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
664 (interactive)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
665 (set-default-font (win32-select-font)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
666
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
667 ;;; win32-win.el ends here