annotate lisp/term/w32-win.el @ 25889:75e266ee9b9c

*** empty log message ***
author Gerd Moellmann <gerd@gnu.org>
date Thu, 07 Oct 1999 00:36:36 +0000
parents 22d526660026
children e219195abf40
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16889
8de32e992e4d Change uses of win32 to w32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16596
diff changeset
1 ;;; w32-win.el --- parse switches controlling interface with W32 window system.
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
16889
8de32e992e4d Change uses of win32 to w32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16596
diff changeset
27 ;; w32-win.el: this file is loaded from ../lisp/startup.el when it recognizes
8de32e992e4d Change uses of win32 to w32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16596
diff changeset
28 ;; that W32 windows are to be used. Command line switches are parsed and those
8de32e992e4d Change uses of win32 to w32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16596
diff changeset
29 ;; pertaining to W32 are processed and removed from the command line. The
8de32e992e4d Change uses of win32 to w32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16596
diff changeset
30 ;; W32 display is opened and hooks are set for popping up the initial window.
13434
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
16889
8de32e992e4d Change uses of win32 to w32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16596
diff changeset
70 (if (not (eq window-system 'w32))
8de32e992e4d Change uses of win32 to w32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16596
diff changeset
71 (error "%s: Loading w32-win.el but not compiled for w32" (invocation-name)))
13434
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)
23625
f91f7d21d4ec Require fontset.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23560
diff changeset
79 (if (fboundp 'new-fontset)
f91f7d21d4ec Require fontset.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23560
diff changeset
80 (require 'fontset))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
81
15136
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
82 ;; 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
83 ;; 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
84 ;; scroll bar routines.
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
85
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15265
diff changeset
86 (defun w32-handle-scroll-bar-event (event)
16889
8de32e992e4d Change uses of win32 to w32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16596
diff changeset
87 "Handle W32 scroll bar events to do normal Window style scrolling."
15136
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
88 (interactive "e")
15265
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
89 (let ((old-window (selected-window)))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
90 (unwind-protect
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
91 (let* ((position (event-start event))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
92 (window (nth 0 position))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
93 (portion-whole (nth 2 position))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
94 (bar-part (nth 4 position)))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
95 (save-excursion
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
96 (select-window window)
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
97 (cond
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
98 ((eq bar-part 'up)
19691
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
99 (goto-char (window-start window))
15265
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
100 (scroll-down 1))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
101 ((eq bar-part 'above-handle)
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
102 (scroll-down))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
103 ((eq bar-part 'handle)
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
104 (scroll-bar-maybe-set-window-start event))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
105 ((eq bar-part 'below-handle)
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
106 (scroll-up))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
107 ((eq bar-part 'down)
19691
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
108 (goto-char (window-start window))
15265
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
109 (scroll-up 1))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
110 )))
658224992372 (win32-handle-scroll-bar-event): Restore
Karl Heuer <kwzh@gnu.org>
parents: 15217
diff changeset
111 (select-window old-window))))
15136
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
112
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
113 ;; The following definition is used for debugging.
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15265
diff changeset
114 ;(defun w32-handle-scroll-bar-event (event) (interactive "e") (princ event))
15136
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
115
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15265
diff changeset
116 (global-set-key [vertical-scroll-bar mouse-1] 'w32-handle-scroll-bar-event)
15136
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
117
6a1b4fcbb216 (win32-handle-scroll-bar-event): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15048
diff changeset
118 ;; (scroll-bar-mode nil)
13831
2b90a48bb3db Disable scrollbars until fully functional.
Geoff Voelker <voelker@cs.washington.edu>
parents: 13434
diff changeset
119
19691
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
120 (defvar mouse-wheel-scroll-amount 4
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
121 "*Number of lines to scroll per click of the mouse wheel.")
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
122
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
123 (defun mouse-wheel-scroll-line (event)
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
124 "Scroll the current buffer by `mouse-wheel-scroll-amount'."
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
125 (interactive "e")
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
126 (condition-case nil
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
127 (if (< (car (cdr (cdr event))) 0)
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
128 (scroll-up mouse-wheel-scroll-amount)
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
129 (scroll-down mouse-wheel-scroll-amount))
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
130 (error nil)))
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
131
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
132 ;; for scroll-in-place.el, this way the -scroll-line and -scroll-screen
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
133 ;; commands won't interact
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
134 (setq scroll-command-groups (list '(mouse-wheel-scroll-line)))
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
135
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
136 (defun mouse-wheel-scroll-screen (event)
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
137 "Scroll the current buffer by `mouse-wheel-scroll-amount'."
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
138 (interactive "e")
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
139 (condition-case nil
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
140 (if (< (car (cdr (cdr event))) 0)
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
141 (scroll-up)
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
142 (scroll-down))
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
143 (error nil)))
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
144
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
145 ;; Bind the mouse-wheel event:
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
146 (global-set-key [mouse-wheel] 'mouse-wheel-scroll-line)
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
147 (global-set-key [C-mouse-wheel] 'mouse-wheel-scroll-screen)
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
148
21883
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
149 (defun w32-drag-n-drop-debug (event)
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
150 "Print the drag-n-drop event in a readable form."
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
151 (interactive "e")
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
152 (princ event))
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
153
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
154 (defun w32-drag-n-drop (event)
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
155 "Edit the files listed in the drag-n-drop event.
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
156 Switch to a buffer editing the last file dropped."
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
157 (interactive "e")
24664
ce51d492b1ab (w32-drag-n-drop): Select file in window where
Andrew Innes <andrewi@gnu.org>
parents: 24246
diff changeset
158 (save-excursion
ce51d492b1ab (w32-drag-n-drop): Select file in window where
Andrew Innes <andrewi@gnu.org>
parents: 24246
diff changeset
159 (set-frame-selected-window nil (posn-window (event-start event)))
ce51d492b1ab (w32-drag-n-drop): Select file in window where
Andrew Innes <andrewi@gnu.org>
parents: 24246
diff changeset
160 (mapcar 'find-file (car (cdr (cdr event)))))
21883
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
161 (raise-frame))
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
162
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
163 (defun w32-drag-n-drop-other-frame (event)
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
164 "Edit the files listed in the drag-n-drop event, in other frames.
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
165 May create new frames, or reuse existing ones. The frame editing
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
166 the last file dropped is selected."
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
167 (interactive "e")
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
168 (mapcar 'find-file-other-frame (car (cdr (cdr event)))))
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
169
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
170 ;; Bind the drag-n-drop event.
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
171 (global-set-key [drag-n-drop] 'w32-drag-n-drop)
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
172 (global-set-key [C-drag-n-drop] 'w32-drag-n-drop-other-frame)
93c99b3a57f1 (w32-drag-n-drop-debug, w32-drag-n-drop)
Richard M. Stallman <rms@gnu.org>
parents: 19691
diff changeset
173
23675
8dcfae475b98 ([language-change]): For now ignore
Geoff Voelker <voelker@cs.washington.edu>
parents: 23636
diff changeset
174 ;; Keyboard layout/language change events
8dcfae475b98 ([language-change]): For now ignore
Geoff Voelker <voelker@cs.washington.edu>
parents: 23636
diff changeset
175 ;; For now ignore language-change events; in the future
8dcfae475b98 ([language-change]): For now ignore
Geoff Voelker <voelker@cs.washington.edu>
parents: 23636
diff changeset
176 ;; we should switch the Emacs Input Method to match the
8dcfae475b98 ([language-change]): For now ignore
Geoff Voelker <voelker@cs.washington.edu>
parents: 23636
diff changeset
177 ;; new layout/language selected by the user.
8dcfae475b98 ([language-change]): For now ignore
Geoff Voelker <voelker@cs.washington.edu>
parents: 23636
diff changeset
178 (global-set-key [language-change] 'ignore)
8dcfae475b98 ([language-change]): For now ignore
Geoff Voelker <voelker@cs.washington.edu>
parents: 23636
diff changeset
179
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
180 (defvar x-invocation-args)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
181
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
182 (defvar x-command-line-resources nil)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
183
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
184 (defconst x-option-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
185 '(("-bw" . x-handle-numeric-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
186 ("-d" . x-handle-display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
187 ("-display" . x-handle-display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
188 ("-name" . x-handle-name-rn-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
189 ("-rn" . x-handle-name-rn-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
190 ("-T" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
191 ("-r" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
192 ("-rv" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
193 ("-reverse" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
194 ("-fn" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
195 ("-font" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
196 ("-ib" . x-handle-numeric-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
197 ("-g" . x-handle-geometry)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
198 ("-geometry" . x-handle-geometry)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
199 ("-fg" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
200 ("-foreground". x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
201 ("-bg" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
202 ("-background". x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
203 ("-ms" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
204 ("-itype" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
205 ("-i" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
206 ("-iconic" . x-handle-iconic)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
207 ("-xrm" . x-handle-xrm-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
208 ("-cr" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
209 ("-vb" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
210 ("-hb" . x-handle-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
211 ("-bd" . x-handle-switch)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
212
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
213 (defconst x-long-option-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
214 '(("--border-width" . "-bw")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
215 ("--display" . "-d")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
216 ("--name" . "-name")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
217 ("--title" . "-T")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
218 ("--reverse-video" . "-reverse")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
219 ("--font" . "-font")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
220 ("--internal-border" . "-ib")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
221 ("--geometry" . "-geometry")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
222 ("--foreground-color" . "-fg")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
223 ("--background-color" . "-bg")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
224 ("--mouse-color" . "-ms")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
225 ("--icon-type" . "-itype")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
226 ("--iconic" . "-iconic")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
227 ("--xrm" . "-xrm")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
228 ("--cursor-color" . "-cr")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
229 ("--vertical-scroll-bars" . "-vb")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
230 ("--border-color" . "-bd")))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
231
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
232 (defconst x-switch-definitions
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
233 '(("-name" name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
234 ("-T" name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
235 ("-r" reverse t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
236 ("-rv" reverse t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
237 ("-reverse" reverse t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
238 ("-fn" font)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
239 ("-font" font)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
240 ("-ib" internal-border-width)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
241 ("-fg" foreground-color)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
242 ("-foreground" foreground-color)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
243 ("-bg" background-color)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
244 ("-background" background-color)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
245 ("-ms" mouse-color)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
246 ("-cr" cursor-color)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
247 ("-itype" icon-type t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
248 ("-i" icon-type t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
249 ("-vb" vertical-scroll-bars t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
250 ("-hb" horizontal-scroll-bars t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
251 ("-bd" border-color)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
252 ("-bw" border-width)))
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 ;; Handler for switches of the form "-switch value" or "-switch".
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
255 (defun x-handle-switch (switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
256 (let ((aelt (assoc switch x-switch-definitions)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
257 (if aelt
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
258 (if (nth 2 aelt)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
259 (setq default-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
260 (cons (cons (nth 1 aelt) (nth 2 aelt))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
261 default-frame-alist))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
262 (setq default-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
263 (cons (cons (nth 1 aelt)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
264 (car x-invocation-args))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
265 default-frame-alist)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
266 x-invocation-args (cdr x-invocation-args))))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
267
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
268 ;; Make -iconic apply only to the initial frame!
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
269 (defun x-handle-iconic (switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
270 (setq initial-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
271 (cons '(visibility . icon) initial-frame-alist)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
272
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
273 ;; Handler for switches of the form "-switch n"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
274 (defun x-handle-numeric-switch (switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
275 (let ((aelt (assoc switch x-switch-definitions)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
276 (if aelt
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
277 (setq default-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
278 (cons (cons (nth 1 aelt)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
279 (string-to-int (car x-invocation-args)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
280 default-frame-alist)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
281 x-invocation-args
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
282 (cdr x-invocation-args)))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
283
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
284 ;; Handle the -xrm option.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
285 (defun x-handle-xrm-switch (switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
286 (or (consp x-invocation-args)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
287 (error "%s: missing argument to `%s' option" (invocation-name) switch))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
288 (setq x-command-line-resources (car x-invocation-args))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
289 (setq x-invocation-args (cdr x-invocation-args)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
290
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
291 ;; Handle the geometry option
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
292 (defun x-handle-geometry (switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
293 (let ((geo (x-parse-geometry (car x-invocation-args))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
294 (setq initial-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
295 (append initial-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
296 (if (or (assq 'left geo) (assq 'top geo))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
297 '((user-position . t)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
298 (if (or (assq 'height geo) (assq 'width geo))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
299 '((user-size . t)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
300 geo)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
301 x-invocation-args (cdr x-invocation-args))))
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 ;; Handle the -name and -rn options. Set the variable x-resource-name
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
304 ;; 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
305 ;; the initial frame, too.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
306 (defun x-handle-name-rn-switch (switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
307 (or (consp x-invocation-args)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
308 (error "%s: missing argument to `%s' option" (invocation-name) switch))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
309 (setq x-resource-name (car x-invocation-args)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
310 x-invocation-args (cdr x-invocation-args))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
311 (if (string= switch "-name")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
312 (setq initial-frame-alist (cons (cons 'name x-resource-name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
313 initial-frame-alist))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
314
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
315 (defvar x-display-name nil
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
316 "The display name specifying server and frame.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
317
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
318 (defun x-handle-display (switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
319 (setq x-display-name (car x-invocation-args)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
320 x-invocation-args (cdr x-invocation-args)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
321
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
322 (defvar x-invocation-args nil)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
323
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
324 (defun x-handle-args (args)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
325 "Process the X-related command line options in ARGS.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
326 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
327 x-invocation args from which the X-related things are extracted, first
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
328 the switch (e.g., \"-fg\") in the following code, and possible values
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
329 \(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
330 This returns ARGS with the arguments that have been processed removed."
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
331 (message "%s" args)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
332 (setq x-invocation-args args
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
333 args nil)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
334 (while x-invocation-args
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
335 (let* ((this-switch (car x-invocation-args))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
336 (orig-this-switch this-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
337 completion argval aelt)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
338 (setq x-invocation-args (cdr x-invocation-args))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
339 ;; Check for long options with attached arguments
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
340 ;; and separate out the attached option argument into argval.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
341 (if (string-match "^--[^=]*=" this-switch)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
342 (setq argval (substring this-switch (match-end 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
343 this-switch (substring this-switch 0 (1- (match-end 0)))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
344 (setq completion (try-completion this-switch x-long-option-alist))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
345 (if (eq completion t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
346 ;; Exact match for long option.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
347 (setq this-switch (cdr (assoc this-switch x-long-option-alist)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
348 (if (stringp completion)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
349 (let ((elt (assoc completion x-long-option-alist)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
350 ;; Check for abbreviated long option.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
351 (or elt
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
352 (error "Option `%s' is ambiguous" this-switch))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
353 (setq this-switch (cdr elt)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
354 ;; Check for a short option.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
355 (setq argval nil this-switch orig-this-switch)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
356 (setq aelt (assoc this-switch x-option-alist))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
357 (if aelt
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
358 (if argval
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
359 (let ((x-invocation-args
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
360 (cons argval x-invocation-args)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
361 (funcall (cdr aelt) this-switch))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
362 (funcall (cdr aelt) this-switch))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
363 (setq args (cons this-switch args)))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
364 (setq args (nreverse args)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
365
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
366
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
367
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
368 ;;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
369 ;; Available colors
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
370 ;;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
371
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
372 (defvar x-colors '("aquamarine"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
373 "Aquamarine"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
374 "medium aquamarine"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
375 "MediumAquamarine"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
376 "black"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
377 "Black"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
378 "blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
379 "Blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
380 "cadet blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
381 "CadetBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
382 "cornflower blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
383 "CornflowerBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
384 "dark slate blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
385 "DarkSlateBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
386 "light blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
387 "LightBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
388 "light steel blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
389 "LightSteelBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
390 "medium blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
391 "MediumBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
392 "medium slate blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
393 "MediumSlateBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
394 "midnight blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
395 "MidnightBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
396 "navy blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
397 "NavyBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
398 "navy"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
399 "Navy"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
400 "sky blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
401 "SkyBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
402 "slate blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
403 "SlateBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
404 "steel blue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
405 "SteelBlue"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
406 "coral"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
407 "Coral"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
408 "cyan"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
409 "Cyan"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
410 "firebrick"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
411 "Firebrick"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
412 "brown"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
413 "Brown"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
414 "gold"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
415 "Gold"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
416 "goldenrod"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
417 "Goldenrod"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
418 "green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
419 "Green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
420 "dark green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
421 "DarkGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
422 "dark olive green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
423 "DarkOliveGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
424 "forest green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
425 "ForestGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
426 "lime green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
427 "LimeGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
428 "medium sea green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
429 "MediumSeaGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
430 "medium spring green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
431 "MediumSpringGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
432 "pale green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
433 "PaleGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
434 "sea green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
435 "SeaGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
436 "spring green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
437 "SpringGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
438 "yellow green"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
439 "YellowGreen"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
440 "dark slate grey"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
441 "DarkSlateGrey"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
442 "dark slate gray"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
443 "DarkSlateGray"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
444 "dim grey"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
445 "DimGrey"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
446 "dim gray"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
447 "DimGray"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
448 "light grey"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
449 "LightGrey"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
450 "light gray"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
451 "LightGray"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
452 "gray"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
453 "grey"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
454 "Gray"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
455 "Grey"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
456 "khaki"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
457 "Khaki"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
458 "magenta"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
459 "Magenta"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
460 "maroon"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
461 "Maroon"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
462 "orange"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
463 "Orange"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
464 "orchid"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
465 "Orchid"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
466 "dark orchid"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
467 "DarkOrchid"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
468 "medium orchid"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
469 "MediumOrchid"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
470 "pink"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
471 "Pink"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
472 "plum"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
473 "Plum"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
474 "red"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
475 "Red"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
476 "indian red"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
477 "IndianRed"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
478 "medium violet red"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
479 "MediumVioletRed"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
480 "orange red"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
481 "OrangeRed"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
482 "violet red"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
483 "VioletRed"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
484 "salmon"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
485 "Salmon"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
486 "sienna"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
487 "Sienna"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
488 "tan"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
489 "Tan"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
490 "thistle"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
491 "Thistle"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
492 "turquoise"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
493 "Turquoise"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
494 "dark turquoise"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
495 "DarkTurquoise"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
496 "medium turquoise"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
497 "MediumTurquoise"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
498 "violet"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
499 "Violet"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
500 "blue violet"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
501 "BlueViolet"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
502 "wheat"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
503 "Wheat"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
504 "white"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
505 "White"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
506 "yellow"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
507 "Yellow"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
508 "green yellow"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
509 "GreenYellow")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
510 "The full list of X colors from the `rgb.text' file.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
511
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
512 (defun x-defined-colors (&optional frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
513 "Return a list of colors supported for a particular frame.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
514 The argument FRAME specifies which frame to try.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
515 The value may be different for frames on different X displays."
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
516 (or frame (setq frame (selected-frame)))
16596
0f917c0edc53 (x-defined-colors): Use color names from w32-color-map.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
517 (let* ((color-map-colors (mapcar (lambda (clr) (car clr)) w32-color-map))
0f917c0edc53 (x-defined-colors): Use color names from w32-color-map.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
518 (all-colors (or color-map-colors x-colors))
0f917c0edc53 (x-defined-colors): Use color names from w32-color-map.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
519 (this-color nil)
0f917c0edc53 (x-defined-colors): Use color names from w32-color-map.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
520 (defined-colors nil))
0f917c0edc53 (x-defined-colors): Use color names from w32-color-map.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
521 (message "Defining colors...")
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
522 (while all-colors
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
523 (setq this-color (car all-colors)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
524 all-colors (cdr all-colors))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
525 (and (face-color-supported-p frame this-color t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
526 (setq defined-colors (cons this-color defined-colors))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
527 defined-colors))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
528
19691
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
529
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
530 ;;;; Function keys
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
531
19691
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
532 ;;; make f10 activate the real menubar rather than the mini-buffer menu
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
533 ;;; navigation feature.
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
534 (global-set-key [f10] (lambda ()
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
535 (interactive) (w32-send-sys-command ?\xf100)))
a96c6fa10e92 (w32-handle-scroll-bar-event): On up and
Geoff Voelker <voelker@cs.washington.edu>
parents: 19167
diff changeset
536
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
537 (defun iconify-or-deiconify-frame ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
538 "Iconify the selected frame, or deiconify if it's currently an icon."
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
539 (interactive)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
540 (if (eq (cdr (assq 'visibility (frame-parameters))) t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
541 (iconify-frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
542 (make-frame-visible)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
543
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
544 (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
545 global-map)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
546
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 ;;;; Selections and cut buffers
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
549
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
550 ;;; 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
551 ;;; current selection against it, and avoid passing back our own text
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
552 ;;; from x-cut-buffer-or-selection-value.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
553 (defvar x-last-selected-text nil)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
554
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
555 ;;; 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
556 ;;; Note this value is overridden below.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
557 (defvar x-cut-buffer-max 20000
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
558 "Max number of characters to put in the cut buffer.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
559
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
560 (defvar x-select-enable-clipboard t
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
561 "Non-nil means cutting and pasting uses the clipboard.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
562 This is in addition to the primary selection.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
563
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
564 (defun x-select-text (text &optional push)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
565 (if x-select-enable-clipboard
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15265
diff changeset
566 (w32-set-clipboard-data text))
15048
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
567 (setq x-last-selected-text text))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
568
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
569 ;;; Return the value of the current selection.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
570 ;;; Consult the selection, then the cut buffer. Treat empty strings
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
571 ;;; as if they were unset.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
572 (defun x-get-selection-value ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
573 (if x-select-enable-clipboard
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
574 (let (text)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
575 ;; Don't die if x-get-selection signals an error.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
576 (condition-case c
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15265
diff changeset
577 (setq text (w32-get-clipboard-data))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15265
diff changeset
578 (error (message "w32-get-clipboard-data:%s" c)))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
579 (if (string= text "") (setq text nil))
15048
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
580 (cond
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
581 ((not text) nil)
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
582 ((eq text x-last-selected-text) nil)
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
583 ((string= text x-last-selected-text)
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
584 ;; 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
585 (setq x-last-selected-text text)
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
586 nil)
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
587 (t
1f316fa0e840 (x-select-text): Remember selected text.
Richard M. Stallman <rms@gnu.org>
parents: 14811
diff changeset
588 (setq x-last-selected-text text))))))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
589
23636
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
590 (defalias 'x-cut-buffer-or-selection-value 'x-get-selection-value)
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
591
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
592
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
593 ;;; Do the actual Windows setup here; the above code just defines
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
594 ;;; functions and variables that we use now.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
595
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
596 (setq command-line-args (x-handle-args command-line-args))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
597
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
598 ;;; Make sure we have a valid resource name.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
599 (or (stringp x-resource-name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
600 (let (i)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
601 (setq x-resource-name (invocation-name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
602
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
603 ;; Change any . or * characters in x-resource-name to hyphens,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
604 ;; 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
605 (while (setq i (string-match "[.*]" x-resource-name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
606 (aset x-resource-name i ?-))))
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 ;; 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
609 ;; 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
610 ;; to have the multi-display support.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
611 (if (fboundp 'x-close-connection)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
612 (x-open-connection ""
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
613 x-command-line-resources
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
614 ;; Exit Emacs with fatal error if this fails.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
615 t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
616 (x-open-connection ""
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
617 x-command-line-resources))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
618
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
619 (setq frame-creation-function 'x-create-frame-with-faces)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
620
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
621 (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
622 x-cut-buffer-max))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
623
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15265
diff changeset
624 ;; W32 expects the menu bar cut and paste commands to use the clipboard.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
625 ;; This has ,? to match both on Sunos and on Solaris.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
626 (menu-bar-enable-clipboard)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
627
23636
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
628 ;; W32 systems have different fonts than commonly found on X, so
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
629 ;; we define our own standard fontset here.
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
630 (defvar w32-standard-fontset-spec
24212
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
631 "-*-Courier New-normal-r-*-*-13-*-*-*-c-*-fontset-standard"
23636
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
632 "String of fontset spec of the standard fontset. This defines a
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
633 fontset consisting of the Courier New variations for European
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
634 languages which are distributed with Windows as \"Multilanguage Support\".
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
635
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
636 See the documentation of `create-fontset-from-fontset-spec for the format.")
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
637
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
638 (if (fboundp 'new-fontset)
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
639 (progn
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
640 (defun w32-create-initial-fontsets ()
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
641 "Create fontset-startup, fontset-standard and any fontsets
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
642 specified in X resources."
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
643 ;; Create the standard fontset.
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
644 (create-fontset-from-fontset-spec w32-standard-fontset-spec t)
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
645
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
646 ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1,...).
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
647 (create-fontset-from-x-resource)
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
648
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
649 ;; Try to create a fontset from a font specification which comes
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
650 ;; from initial-frame-alist, default-frame-alist, or X resource.
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
651 ;; A font specification in command line argument (i.e. -fn XXXX)
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
652 ;; should be already in default-frame-alist as a `font'
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
653 ;; parameter. However, any font specifications in site-start
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
654 ;; library, user's init file (.emacs), and default.el are not
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
655 ;; yet handled here.
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
656
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
657 (let ((font (or (cdr (assq 'font initial-frame-alist))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
658 (cdr (assq 'font default-frame-alist))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
659 (x-get-resource "font" "Font")))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
660 xlfd-fields resolved-name)
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
661 (if (and font
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
662 (not (query-fontset font))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
663 (setq resolved-name (x-resolve-font-name font))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
664 (setq xlfd-fields (x-decompose-font-name font)))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
665 (if (string= "fontset"
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
666 (aref xlfd-fields xlfd-regexp-registry-subnum))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
667 (new-fontset font
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
668 (x-complement-fontset-spec xlfd-fields nil))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
669 ;; Create a fontset from FONT. The fontset name is
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
670 ;; generated from FONT. Create style variants of the
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
671 ;; fontset too. Font names in the variants are
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
672 ;; generated automatially unless X resources
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
673 ;; XXX.attribyteFont explicitly specify them.
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
674 (let ((styles (mapcar 'car x-style-funcs-alist))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
675 (faces '(bold italic bold-italic))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
676 face face-font fontset fontset-spec)
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
677 (while faces
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
678 (setq face (car faces))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
679 (setq face-font (x-get-resource (concat (symbol-name face)
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
680 ".attributeFont")
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
681 "Face.AttributeFont"))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
682 (if face-font
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
683 (setq styles (cons (cons face face-font)
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
684 (delq face styles))))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
685 (setq faces (cdr faces)))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
686 (aset xlfd-fields xlfd-regexp-foundry-subnum nil)
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
687 (aset xlfd-fields xlfd-regexp-family-subnum nil)
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
688 (aset xlfd-fields xlfd-regexp-registry-subnum "fontset")
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
689 (aset xlfd-fields xlfd-regexp-encoding-subnum "startup")
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
690 ;; The fontset name should have concrete values in
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
691 ;; weight and slant field.
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
692 (let ((weight (aref xlfd-fields xlfd-regexp-weight-subnum))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
693 (slant (aref xlfd-fields xlfd-regexp-slant-subnum))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
694 xlfd-temp)
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
695 (if (or (not weight) (string-match "[*?]*" weight))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
696 (progn
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
697 (setq xlfd-temp
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
698 (x-decompose-font-name resolved-name))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
699 (aset xlfd-fields xlfd-regexp-weight-subnum
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
700 (aref xlfd-temp xlfd-regexp-weight-subnum))))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
701 (if (or (not slant) (string-match "[*?]*" slant))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
702 (progn
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
703 (or xlfd-temp
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
704 (setq xlfd-temp
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
705 (x-decompose-font-name resolved-name)))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
706 (aset xlfd-fields xlfd-regexp-slant-subnum
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
707 (aref xlfd-temp xlfd-regexp-slant-subnum)))))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
708 (setq fontset (x-compose-font-name xlfd-fields))
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
709 (create-fontset-from-fontset-spec
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
710 (concat fontset ", ascii:" font) styles)
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
711 )))))
24246
f67cc15ab138 term/w32-win.el (w32-create-initial-fontsets): Back out previous
Geoff Voelker <voelker@cs.washington.edu>
parents: 24212
diff changeset
712 ;; This cannot be run yet, as creating fontsets requires a
f67cc15ab138 term/w32-win.el (w32-create-initial-fontsets): Back out previous
Geoff Voelker <voelker@cs.washington.edu>
parents: 24212
diff changeset
713 ;; Window to be initialised so the fonts can be listed.
f67cc15ab138 term/w32-win.el (w32-create-initial-fontsets): Back out previous
Geoff Voelker <voelker@cs.washington.edu>
parents: 24212
diff changeset
714 ;; Add it to a hook so it gets run later.
f67cc15ab138 term/w32-win.el (w32-create-initial-fontsets): Back out previous
Geoff Voelker <voelker@cs.washington.edu>
parents: 24212
diff changeset
715 (add-hook 'before-init-hook 'w32-create-initial-fontsets)
f67cc15ab138 term/w32-win.el (w32-create-initial-fontsets): Back out previous
Geoff Voelker <voelker@cs.washington.edu>
parents: 24212
diff changeset
716 ))
23636
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
717
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
718 ;; 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
719 ;; of the alist, so that anything specified on the command line takes
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
720 ;; precedence.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
721 (let* ((res-geometry (x-get-resource "geometry" "Geometry"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
722 parsed)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
723 (if res-geometry
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
724 (progn
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
725 (setq parsed (x-parse-geometry res-geometry))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
726 ;; If the resource specifies a position,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
727 ;; call the position and size "user-specified".
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
728 (if (or (assq 'top parsed) (assq 'left parsed))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
729 (setq parsed (cons '(user-position . t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
730 (cons '(user-size . t) parsed))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
731 ;; All geometry parms apply to the initial frame.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
732 (setq initial-frame-alist (append initial-frame-alist parsed))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
733 ;; The size parms apply to all frames.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
734 (if (assq 'height parsed)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
735 (setq default-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
736 (cons (cons 'height (cdr (assq 'height parsed)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
737 default-frame-alist)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
738 (if (assq 'width parsed)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
739 (setq default-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
740 (cons (cons 'width (cdr (assq 'width parsed)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
741 default-frame-alist))))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
742
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
743 ;; Check the reverseVideo resource.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
744 (let ((case-fold-search t))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
745 (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
746 (if (and rv
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
747 (string-match "^\\(true\\|yes\\|on\\)$" rv))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
748 (setq default-frame-alist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
749 (cons '(reverse . t) default-frame-alist)))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
750
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
751 ;; Set x-selection-timeout, measured in milliseconds.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
752 (let ((res-selection-timeout
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
753 (x-get-resource "selectionTimeout" "SelectionTimeout")))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
754 (setq x-selection-timeout 20000)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
755 (if res-selection-timeout
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
756 (setq x-selection-timeout (string-to-number res-selection-timeout))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
757
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
758 (defun x-win-suspend-error ()
16889
8de32e992e4d Change uses of win32 to w32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16596
diff changeset
759 (error "Suspending an emacs running under W32 makes no sense"))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
760 (add-hook 'suspend-hook 'x-win-suspend-error)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
761
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
762 ;;; 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
763 (setq interprogram-cut-function 'x-select-text)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
764 (setq interprogram-paste-function 'x-get-selection-value)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
765
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15265
diff changeset
766 ;;; Turn off window-splitting optimization; w32 is usually fast enough
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
767 ;;; that this is only annoying.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
768 (setq split-window-keep-point t)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
769
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
770 ;; Don't show the frame name; that's redundant.
19167
337f5643498e Set mode-line-frame-identification
Geoff Voelker <voelker@cs.washington.edu>
parents: 16889
diff changeset
771 (setq-default mode-line-frame-identification " ")
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
772
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
773 ;;; Set to a system sound if you want a fancy bell.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
774 (set-message-beep 'ok)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
775
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15265
diff changeset
776 ;; Remap some functions to call w32 common dialogs
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
777
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
778 (defun internal-face-interactive (what &optional bool)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
779 (let* ((fn (intern (concat "face-" what)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
780 (prompt (concat "Set " what " of face"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
781 (face (read-face-name (concat prompt ": ")))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
782 (default (if (fboundp fn)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
783 (or (funcall fn face (selected-frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
784 (funcall fn 'default (selected-frame)))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
785 (fn-win (intern (concat (symbol-name window-system) "-select-" what)))
22539
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
786 value)
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
787 (setq value
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
788 (cond ((fboundp fn-win)
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
789 (funcall fn-win))
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
790 ((eq bool 'color)
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
791 (completing-read (concat prompt " " (symbol-name face) " to: ")
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
792 (mapcar (function (lambda (color)
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
793 (cons color color)))
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
794 x-colors)
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
795 nil nil nil nil default))
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
796 (bool
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
797 (y-or-n-p (concat "Should face " (symbol-name face)
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
798 " be " bool "? ")))
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
799 (t
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
800 (read-string (concat prompt " " (symbol-name face) " to: ")
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
801 nil nil default))))
45ccce07729d (internal-face-interactive): Handle case where BOOL is `color'.
Andrew Innes <andrewi@gnu.org>
parents: 21883
diff changeset
802 (list face (if (equal value "") nil value))))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
803
16889
8de32e992e4d Change uses of win32 to w32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16596
diff changeset
804 ;; Redefine the font selection to use the standard W32 dialog
23560
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
805 (defvar w32-use-w32-font-dialog t
23636
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
806 "*Use the standard font dialog if 't' - otherwise pop up a menu of
23560
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
807 some standard fonts like X does - including fontsets")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
808
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
809 (defvar w32-fixed-font-alist
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
810 '("Font menu"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
811 ("Misc"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
812 ;; For these, we specify the pixel height and width.
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
813 ("fixed" "Fixedsys")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
814 ("")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
815 ("Terminal 5x4"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
816 "-*-Terminal-normal-r-*-*-*-45-*-*-c-40-*-oem")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
817 ("Terminal 6x8"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
818 "-*-Terminal-normal-r-*-*-*-60-*-*-c-80-*-oem")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
819 ("Terminal 9x5"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
820 "-*-Terminal-normal-r-*-*-*-90-*-*-c-50-*-oem")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
821 ("Terminal 9x7"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
822 "-*-Terminal-normal-r-*-*-*-90-*-*-c-70-*-oem")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
823 ("Terminal 9x8"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
824 "-*-Terminal-normal-r-*-*-*-90-*-*-c-80-*-oem")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
825 ("Terminal 12x12"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
826 "-*-Terminal-normal-r-*-*-*-120-*-*-c-120-*-oem")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
827 ("Terminal 14x10"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
828 "-*-Terminal-normal-r-*-*-*-135-*-*-c-100-*-oem")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
829 ("Terminal 6x6 Bold"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
830 "-*-Terminal-bold-r-*-*-*-60-*-*-c-60-*-oem")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
831 ("")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
832 ("Lucida Sans Typewriter.8"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
833 "-*-Lucida Sans Typewriter-normal-r-*-*-11-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
834 ("Lucida Sans Typewriter.9"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
835 "-*-Lucida Sans Typewriter-normal-r-*-*-12-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
836 ("Lucida Sans Typewriter.10"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
837 "-*-Lucida Sans Typewriter-normal-r-*-*-13-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
838 ("Lucida Sans Typewriter.11"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
839 "-*-Lucida Sans Typewriter-normal-r-*-*-15-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
840 ("Lucida Sans Typewriter.12"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
841 "-*-Lucida Sans Typewriter-normal-r-*-*-16-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
842 ("Lucida Sans Typewriter.8 Bold"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
843 "-*-Lucida Sans Typewriter-semibold-r-*-*-11-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
844 ("Lucida Sans Typewriter.9 Bold"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
845 "-*-Lucida Sans Typewriter-semibold-r-*-*-12-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
846 ("Lucida Sans Typewriter.10 Bold"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
847 "-*-Lucida Sans Typewriter-semibold-r-*-*-13-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
848 ("Lucida Sans Typewriter.11 Bold"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
849 "-*-Lucida Sans Typewriter-semibold-r-*-*-15-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
850 ("Lucida Sans Typewriter.12 Bold"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
851 "-*-Lucida Sans Typewriter-semibold-r-*-*-16-*-*-*-c-*-iso8859-1"))
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
852 ("Courier"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
853 ("Courier 10x8"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
854 "-*-Courier-*normal-r-*-*-*-97-*-*-c-80-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
855 ("Courier 12x9"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
856 "-*-Courier-*normal-r-*-*-*-120-*-*-c-90-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
857 ("Courier 15x12"
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
858 "-*-Courier-*normal-r-*-*-*-150-*-*-c-120-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
859 ;; For these, we specify the point height.
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
860 ("")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
861 ("8" "-*-Courier New-normal-r-*-*-11-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
862 ("9" "-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
863 ("10" "-*-Courier New-normal-r-*-*-13-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
864 ("11" "-*-Courier New-normal-r-*-*-15-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
865 ("12" "-*-Courier New-normal-r-*-*-16-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
866 ("8 bold" "-*-Courier New-bold-r-*-*-11-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
867 ("9 bold" "-*-Courier New-bold-r-*-*-12-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
868 ("10 bold" "-*-Courier New-bold-r-*-*-13-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
869 ("11 bold" "-*-Courier New-bold-r-*-*-15-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
870 ("12 bold" "-*-Courier New-bold-r-*-*-16-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
871 ("8 italic" "-*-Courier New-normal-i-*-*-11-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
872 ("9 italic" "-*-Courier New-normal-i-*-*-12-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
873 ("10 italic" "-*-Courier New-normal-i-*-*-13-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
874 ("11 italic" "-*-Courier New-normal-i-*-*-15-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
875 ("12 italic" "-*-Courier New-normal-i-*-*-16-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
876 ("8 bold italic" "-*-Courier New-bold-i-*-*-11-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
877 ("9 bold italic" "-*-Courier New-bold-i-*-*-12-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
878 ("10 bold italic" "-*-Courier New-bold-i-*-*-13-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
879 ("11 bold italic" "-*-Courier New-bold-i-*-*-15-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
880 ("12 bold italic" "-*-Courier New-bold-i-*-*-16-*-*-*-c-*-iso8859-1")
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
881 ))
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
882 "Fonts suitable for use in Emacs. Initially this is a list of some
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
883 fixed width fonts that most people will have like Terminal and
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
884 Courier. These fonts are used in the font menu if the variable
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
885 `w32-use-w32-font-dialog' is nil.")
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
886
24686
f2ecc3b6a45f Change the x-charset-registry property for the
Andrew Innes <andrewi@gnu.org>
parents: 24683
diff changeset
887 ;;; Enable Japanese fonts on Windows to be used by default.
f2ecc3b6a45f Change the x-charset-registry property for the
Andrew Innes <andrewi@gnu.org>
parents: 24683
diff changeset
888 (put-charset-property 'katakana-jisx0201 'x-charset-registry "JISX0208-SJIS")
f2ecc3b6a45f Change the x-charset-registry property for the
Andrew Innes <andrewi@gnu.org>
parents: 24683
diff changeset
889 (put-charset-property 'latin-jisx0201 'x-charset-registry "JISX0208-SJIS")
f2ecc3b6a45f Change the x-charset-registry property for the
Andrew Innes <andrewi@gnu.org>
parents: 24683
diff changeset
890 (put-charset-property 'japanese-jisx0208 'x-charset-registry "JISX0208-SJIS")
f2ecc3b6a45f Change the x-charset-registry property for the
Andrew Innes <andrewi@gnu.org>
parents: 24683
diff changeset
891 (put-charset-property 'japanese-jisx0208-1978 'x-charset-registry
f2ecc3b6a45f Change the x-charset-registry property for the
Andrew Innes <andrewi@gnu.org>
parents: 24683
diff changeset
892 "JISX0208-SJIS")
f2ecc3b6a45f Change the x-charset-registry property for the
Andrew Innes <andrewi@gnu.org>
parents: 24683
diff changeset
893
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
894 (defun mouse-set-font (&rest fonts)
24212
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
895 "Select a font. If `w32-use-w32-font-dialog' is non-nil (the default),
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
896 use the Windows font dialog. Otherwise use a pop-up menu (like Emacs
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
897 on other platforms) initialized with the fonts in
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
898 `w32-fixed-font-alist'. Emacs will attempt to create a fontset from
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
899 the font chosen, covering all the charsets that can be fully represented
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
900 with the font."
23560
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
901 (interactive
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
902 (if w32-use-w32-font-dialog
24964
22d526660026 (mouse-set-font): If user uses w32 dialog but
Karl Heuer <kwzh@gnu.org>
parents: 24686
diff changeset
903 (let ((chosen-font (w32-select-font)))
22d526660026 (mouse-set-font): If user uses w32 dialog but
Karl Heuer <kwzh@gnu.org>
parents: 24686
diff changeset
904 (and chosen-font (list chosen-font)))
23560
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
905 (x-popup-menu
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
906 last-nonmenu-event
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
907 ;; Append list of fontsets currently defined.
23636
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
908 (if (fboundp 'new-fontset)
3246160c5469 (x-get-selection-value): Alias to
Geoff Voelker <voelker@cs.washington.edu>
parents: 23625
diff changeset
909 (append w32-fixed-font-alist (list (generate-fontset-menu)))))))
23560
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
910 (if fonts
24683
4ff280f1f201 (mouse-set-font): Ensure constructed fontset
Andrew Innes <andrewi@gnu.org>
parents: 24664
diff changeset
911 (let (font fontset xlfd resolved-font)
23560
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
912 (while fonts
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
913 (condition-case nil
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
914 (progn
24212
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
915 (setq font (car fonts))
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
916 (if (fontset-name-p font)
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
917 (setq fontset font)
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
918 (condition-case nil
24683
4ff280f1f201 (mouse-set-font): Ensure constructed fontset
Andrew Innes <andrewi@gnu.org>
parents: 24664
diff changeset
919 (setq resolved-font (x-resolve-font-name font)
4ff280f1f201 (mouse-set-font): Ensure constructed fontset
Andrew Innes <andrewi@gnu.org>
parents: 24664
diff changeset
920 xlfd (x-decompose-font-name resolved-font)
4ff280f1f201 (mouse-set-font): Ensure constructed fontset
Andrew Innes <andrewi@gnu.org>
parents: 24664
diff changeset
921 fontset
4ff280f1f201 (mouse-set-font): Ensure constructed fontset
Andrew Innes <andrewi@gnu.org>
parents: 24664
diff changeset
922 (create-fontset-from-ascii-font
4ff280f1f201 (mouse-set-font): Ensure constructed fontset
Andrew Innes <andrewi@gnu.org>
parents: 24664
diff changeset
923 font resolved-font
4ff280f1f201 (mouse-set-font): Ensure constructed fontset
Andrew Innes <andrewi@gnu.org>
parents: 24664
diff changeset
924 (format "%s_%s_%s_%s"
4ff280f1f201 (mouse-set-font): Ensure constructed fontset
Andrew Innes <andrewi@gnu.org>
parents: 24664
diff changeset
925 (aref xlfd xlfd-regexp-family-subnum)
4ff280f1f201 (mouse-set-font): Ensure constructed fontset
Andrew Innes <andrewi@gnu.org>
parents: 24664
diff changeset
926 (aref xlfd xlfd-regexp-registry-subnum)
4ff280f1f201 (mouse-set-font): Ensure constructed fontset
Andrew Innes <andrewi@gnu.org>
parents: 24664
diff changeset
927 (aref xlfd xlfd-regexp-encoding-subnum)
4ff280f1f201 (mouse-set-font): Ensure constructed fontset
Andrew Innes <andrewi@gnu.org>
parents: 24664
diff changeset
928 (aref xlfd
4ff280f1f201 (mouse-set-font): Ensure constructed fontset
Andrew Innes <andrewi@gnu.org>
parents: 24664
diff changeset
929 xlfd-regexp-pixelsize-subnum))))
24212
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
930 (error nil)))
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
931 (if fontset
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
932 (set-default-font fontset)
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
933 (set-default-font font))
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
934 (setq fonts nil))
36652d90b38f (w32-standard-fontset-spec): Remove wildcard
Geoff Voelker <voelker@cs.washington.edu>
parents: 24142
diff changeset
935 (error (setq fonts (cdr fonts)))))
23560
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
936 (if (null font)
6414b7085648 (w32-use-w32-font-dialog, w32-fixed-font-alist):
Geoff Voelker <voelker@cs.washington.edu>
parents: 22539
diff changeset
937 (error "Font not found")))))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
938
16889
8de32e992e4d Change uses of win32 to w32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16596
diff changeset
939 ;;; w32-win.el ends here