annotate lisp/x-init.el @ 5634:2014ff433daf

Support hash COLLECTIONs, #'{all,try}-completion{s,}; add #'test-completion src/ChangeLog addition: 2012-01-01 Aidan Kehoe <kehoea@parhasard.net> Add #'test-completion, API from GNU. Accept hash table COLLECTIONs in it and in the other completion-oriented functions, #'try-completion, #'all-completions, and those Lisp functions implemented in terms of them. * lisp.h: Update the prototype of map_obarray(), making FN compatible with the FUNCTION argument of elisp_maphash(); * abbrev.c (abbrev_match_mapper): * abbrev.c (record_symbol): * doc.c (verify_doc_mapper): * symbols.c (mapatoms_1): * symbols.c (apropos_mapper): Update these mapper functions to reflect the new argument to map_obarray(). * symbols.c (map_obarray): Call FN with two arguments, the string name of the symbol, and the symbol itself, for API (mapper) compatibility with elisp_maphash(). * minibuf.c (map_completion): New. Map a maphash_function_t across a non function COLLECTION, as appropriate for #'try-completion and friends. * minibuf.c (map_completion_list): New. Map a maphash_function_t across a pseudo-alist, as appropriate for the completion functions. * minibuf.c (ignore_completion_p): PRED needs to be called with two args if and only if the collection is a hash table. Implement this. * minibuf.c (try_completion_mapper): New. The loop body of #'try-completion, refactored out. * minibuf.c (Ftry_completion): Use try_completion_mapper(), map_completion(). * minibuf.c (all_completions_mapper): New. The loop body of #'all-completions, refactored out. * minibuf.c (Fall_completions): Use all_completions_mapper(), map_completion(). * minibuf.c (test_completion_mapper): New. The loop body of #'test-completion. * minibuf.c (Ftest_completion): New, API from GNU. * minibuf.c (syms_of_minibuf): Make Ftest_completion available. tests/ChangeLog addition: 2012-01-01 Aidan Kehoe <kehoea@parhasard.net> * automated/completion-tests.el: New. Test #'try-completion, #'all-completion and #'test-completion with list, vector and hash-table COLLECTION arguments.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 01 Jan 2012 15:18:52 +0000
parents 3d1f8f0e690f
children 1d1f385c9149
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;;; x-init.el --- initialization code for X windows
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Copyright (C) 1990, 1993, 1994, 1997 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 ;; Copyright (C) 1995 Board of Trustees, University of Illinois.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 ;; Copyright (C) 1995, 1996 Ben Wing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 ;; Maintainer: XEmacs Development Team
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; Keywords: terminals, dumped
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5260
diff changeset
12 ;; XEmacs is free software: you can redistribute it and/or modify it
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5260
diff changeset
13 ;; under the terms of the GNU General Public License as published by the
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5260
diff changeset
14 ;; Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5260
diff changeset
15 ;; option) any later version.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5260
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5260
diff changeset
18 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5260
diff changeset
19 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5260
diff changeset
20 ;; for more details.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5260
diff changeset
23 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 ;;; Synched up with: Not synched.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 ;;; Commentary:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 ;; This file is dumped with XEmacs (when X support is compiled in).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 ;;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
33 (globally-declare-fboundp
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
34 '(x-keysym-on-keyboard-p
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
35 x-server-vendor x-init-specifier-from-resources init-mule-x-win))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
36
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
37 (globally-declare-boundp
4477
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
38 '(x-initial-argv-list x-app-defaults-directory))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
39
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 ;; If you want to change this variable, this is the place you must do it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 ;; Do not set it to a string containing periods. X doesn't like that.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 ;(setq x-emacs-application-class "Emacs")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 (defgroup x nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 "The X Window system."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 :group 'environment)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 ;; OpenWindows-like "find" processing. These functions are really Sunisms,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 ;; but we put them here instead of in x-win-sun.el in case someone wants
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 ;; to use them when not running on a Sun console (presumably after binding
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 ;; them to different keys, or putting them on menus.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 (defvar ow-find-last-string nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 (defvar ow-find-last-clipboard nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 (defun ow-find (&optional backward-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 "Search forward the next occurrence of the text of the selection."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 (interactive)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
59 (let ((sel (ignore-errors (get-selection)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
60 (clip (ignore-errors (get-clipboard)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 text)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 (setq text (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 (sel)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 ((not (equal clip ow-find-last-clipboard))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 (setq ow-find-last-clipboard clip))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 (ow-find-last-string)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 (t (error "No selection available"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 (setq ow-find-last-string text)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 (cond (backward-p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 (search-backward text)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 (set-mark (+ (point) (length text))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 (search-forward text)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 (set-mark (- (point) (length text)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 (zmacs-activate-region)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 (defun ow-find-backward ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 "Search backward for the previous occurrence of the text of the selection."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 (ow-find t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 (eval-when-compile
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 (load "x-win-sun" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 (load "x-win-xfree86" nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85
4477
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
86 (defun x-initialize-keyboard (device)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 "Perform X-Server-specific initializations. Don't call this."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 ;; This is some heuristic junk that tries to guess whether this is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 ;; a Sun keyboard.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 ;; One way of implementing this (which would require C support) would
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 ;; be to examine the X keymap itself and see if the layout looks even
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 ;; remotely like a Sun - check for the Find key on a particular
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 ;; keycode, for example. It'd be nice to have a table of this to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 ;; recognize various keyboards; see also xkeycaps.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 ;; Note that we cannot use most vendor-provided proprietary keyboard
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 ;; APIs to identify the keyboard - those only work on the console.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 ;; xkeycaps has the same problem when running `remotely'.
4477
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
100 (let ((vendor (x-server-vendor device)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 (cond ((or (string-match "Sun Microsystems" vendor)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 ;; MIT losingly fails to tell us what hardware the X server
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 ;; is managing, so assume all MIT displays are Suns... HA HA!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 (string-equal "MIT X Consortium" vendor)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 (string-equal "X Consortium" vendor))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 ;; Ok, we think this could be a Sun keyboard. Run the Sun code.
4477
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
107 (x-win-init-sun device))
4062
aa22980554d9 [xemacs-hg @ 2007-07-16 12:26:00 by aidan]
aidan
parents: 3475
diff changeset
108 ((string-match #r"XFree86\|Cygwin/X\|The X\.Org Foundation" vendor)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 ;; Those XFree86 people do some weird keysym stuff, too.
4477
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
110 (x-win-init-xfree86 device)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111
3360
316fddbf58e2 [xemacs-hg @ 2006-04-25 14:01:52 by stephent]
stephent
parents: 2828
diff changeset
112 ;; Moved from x-toolbar.el, since InfoDock doesn't dump x-toolbar.el.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 (defun x-init-toolbar-from-resources (locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 (loop for (specifier . resname) in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 `(( ,top-toolbar-height . "topToolBarHeight")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 (,bottom-toolbar-height . "bottomToolBarHeight")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 ( ,left-toolbar-width . "leftToolBarWidth")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 ( ,right-toolbar-width . "rightToolBarWidth")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 ( ,top-toolbar-border-width . "topToolBarBorderWidth")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 (,bottom-toolbar-border-width . "bottomToolBarBorderWidth")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 ( ,left-toolbar-border-width . "leftToolBarBorderWidth")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 ( ,right-toolbar-border-width . "rightToolBarBorderWidth"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 do
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 (x-init-specifier-from-resources
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 specifier 'natnum locale (cons resname (upcase-initials resname)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127
4477
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
128 (defvar make-device-early-x-entry-point-called-p nil
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
129 "Whether `make-device-early-x-entry-point' has been called, at least once.
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
130
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
131 Much of the X11-specific Lisp init code should only be called the first time
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
132 an X11 device is created; this variable allows for that.")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133
4477
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
134 (defvar make-device-late-x-entry-point-called-p nil
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
135 "Whether `make-device-late-x-entry-point' has been called, at least once.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136
4477
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
137 Much of the X11-specific Lisp init code should only be called the first time
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
138 an X11 device is created; this variable allows for that.")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139
4477
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
140 (defun make-device-early-x-entry-point ()
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
141 "Entry point to set up the Lisp environment for X device creation."
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
142 (unless make-device-early-x-entry-point-called-p
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
143 (setq initial-frame-plist
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
144 (and initial-frame-unmapped-p '(initially-unmapped t))
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
145 ;; Save the argv value.
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
146 x-initial-argv-list
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
147 (cons (car command-line-args) command-line-args-left)
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
148 ;; Locate the app-defaults directory
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
149 x-app-defaults-directory
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
150 (or x-app-defaults-directory (locate-data-directory "app-defaults"))
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
151 make-device-early-x-entry-point-called-p t)))
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
152
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
153 (defun make-device-late-x-entry-point (device)
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
154 "Entry point to do any Lisp-level X device-specific initialization."
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
155 ;; General code, called on every X device created:
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
156 (x-initialize-keyboard device)
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
157 ;; And the following code is to be called once, the first time an X11
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
158 ;; device is created:
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
159 (unless make-device-late-x-entry-point-called-p
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 (setq command-line-args-left (cdr x-initial-argv-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 ;; Motif-ish bindings
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 (define-key global-map '(shift insert) 'yank-clipboard-selection)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 (define-key global-map '(control insert) 'copy-primary-selection)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 ;; These are Sun-isms.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 (define-key global-map 'copy 'copy-primary-selection)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 (define-key global-map 'paste 'yank-clipboard-selection)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 (define-key global-map 'cut 'kill-primary-selection)
4477
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4451
diff changeset
168 (setq make-device-late-x-entry-point-called-p t)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 (defun make-frame-on-display (display &optional props)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 "Create a frame on the X display named DISPLAY.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 DISPLAY should be a standard display string such as \"unix:0\",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 or nil for the display specified on the command line or in the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 DISPLAY environment variable.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 PROPS should be a plist of properties, as in the call to `make-frame'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 This function opens a connection to the display or reuses an existing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 connection.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 This function is a trivial wrapper around `make-frame-on-device'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 (interactive "sMake frame on display: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 (if (equal display "") (setq display nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 (make-frame-on-device 'x display props))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 ;;; x-init.el ends here