X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/feeb94f7cc4e9177a7f2a0406d788623319e6ca7..db95369be096960245dd38678f68464627698678:/lisp/term/x-win.el diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index a3e0d94afb..6be4e4b7a7 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -1,9 +1,9 @@ -;;; x-win.el --- parse switches controlling interface with X window system +;;; x-win.el --- parse relevant switches and set up for X -*-coding: iso-2022-7bit;-*- -;; Copyright (C) 1993, 1994, 2001 Free Software Foundation, Inc. +;; Copyright (C) 1993, 1994, 2001, 2002 Free Software Foundation, Inc. ;; Author: FSF -;; Keywords: terminals +;; Keywords: terminals, i18n ;; This file is part of GNU Emacs. @@ -30,7 +30,7 @@ ;; X display is opened and hooks are set for popping up the initial window. ;; startup.el will then examine startup files, and eventually call the hooks -;; which create the first window (s). +;; which create the first window(s). ;;; Code: @@ -68,15 +68,14 @@ (if (not (eq window-system 'x)) (error "%s: Loading x-win.el but not compiled for X" (invocation-name))) - + (require 'frame) (require 'mouse) (require 'scroll-bar) (require 'faces) (require 'select) (require 'menu-bar) -(if (fboundp 'new-fontset) - (require 'fontset)) +(require 'fontset) (defvar x-invocation-args) @@ -110,6 +109,22 @@ x-invocation-args (cdr x-invocation-args)))))) +;; Handle options that apply to initial frame only +(defun x-handle-initial-switch (switch) + (let ((aelt (assoc switch command-line-x-option-alist))) + (if aelt + (let ((param (nth 3 aelt)) + (value (nth 4 aelt))) + (if value + (setq initial-frame-alist + (cons (cons param value) + initial-frame-alist)) + (setq initial-frame-alist + (cons (cons param + (car x-invocation-args)) + initial-frame-alist) + x-invocation-args (cdr x-invocation-args))))))) + ;; Make -iconic apply only to the initial frame! (defun x-handle-iconic (switch) (setq initial-frame-alist @@ -127,15 +142,29 @@ ;; Handle the geometry option (defun x-handle-geometry (switch) - (let ((geo (x-parse-geometry (car x-invocation-args)))) - (setq initial-frame-alist - (append initial-frame-alist - (if (or (assq 'left geo) (assq 'top geo)) - '((user-position . t))) - (if (or (assq 'height geo) (assq 'width geo)) - '((user-size . t))) - geo) - x-invocation-args (cdr x-invocation-args)))) + (let* ((geo (x-parse-geometry (car x-invocation-args))) + (left (assq 'left geo)) + (top (assq 'top geo)) + (height (assq 'height geo)) + (width (assq 'width geo))) + (if (or height width) + (setq default-frame-alist + (append default-frame-alist + '((user-size . t)) + (if height (list height)) + (if width (list width))) + initial-frame-alist + (append initial-frame-alist + '((user-size . t)) + (if height (list height)) + (if width (list width))))) + (if (or left top) + (setq initial-frame-alist + (append initial-frame-alist + '((user-position . t)) + (if left (list left)) + (if top (list top))))) + (setq x-invocation-args (cdr x-invocation-args)))) ;; Handle the -name option. Set the variable x-resource-name ;; to the option's operand; set the name of @@ -204,6 +233,75 @@ This function returns ARGS minus the arguments that have been processed." (funcall handler this-switch)) (setq args (cons orig-this-switch args))))) (nconc (nreverse args) x-invocation-args)) + +;; Handle the --smid switch. This is used by the session manager +;; to give us back our session id we had on the previous run. +(defun x-handle-smid (switch) + (or (consp x-invocation-args) + (error "%s: missing argument to `%s' option" (invocation-name) switch)) + (setq x-session-previous-id (car x-invocation-args) + x-invocation-args (cdr x-invocation-args))) + +(defvar emacs-save-session-functions nil + "Functions to run when a save-session event occurs. +The functions does not get any argument. +Functions can return non-nil to inform the session manager that the +window system shutdown should be aborted. + +See also `emacs-session-save'.") + +(defun emacs-session-filename (session-id) + "Construct a filename to save the session in based on SESSION-ID. +If the directory ~/.emacs.d exists, we make a filename in there, otherwise +a file in the home directory." + (let ((basename (concat "session." session-id)) + (emacs-dir "~/.emacs.d/")) + (expand-file-name (if (file-directory-p emacs-dir) + (concat emacs-dir basename) + (concat "~/.emacs-" basename))))) + +(defun emacs-session-save () + "This function is called when the window system is shutting down. +If this function returns non-nil, the window system shutdown is cancelled. + +When a session manager tells Emacs that the window system is shutting +down, this function is called. It calls the functions in the hook +`emacs-save-session-functions'. Functions are called with the current +buffer set to a temporary buffer. Functions should use `insert' to insert +lisp code to save the session state. The buffer is saved +in a file in the home directory of the user running Emacs. The file +is evaluated when Emacs is restarted by the session manager. + +If any of the functions returns non-nil, no more functions are called +and this function returns non-nil. This will inform the session manager +that it should abort the window system shutdown." + (let ((filename (emacs-session-filename x-session-id)) + (buf (get-buffer-create (concat " *SES " x-session-id)))) + (when (file-exists-p filename) + (delete-file filename)) + (with-current-buffer buf + (let ((cancel-shutdown (condition-case nil + ;; A return of t means cancel the shutdown. + (run-hook-with-args-until-success + 'emacs-save-session-functions) + (error t)))) + (unless cancel-shutdown + (write-file filename)) + (kill-buffer buf) + cancel-shutdown)))) + +(defun emacs-session-restore (previous-session-id) + "Restore the Emacs session if started by a session manager. +The file saved by `emacs-session-save' is evaluated and deleted if it +exists." + (let ((filename (emacs-session-filename previous-session-id))) + (when (file-exists-p filename) + (load-file filename) + (delete-file filename) + (message "Restored session data")))) + + + ;; ;; Standard X cursor shapes, courtesy of Mr. Fox, who wanted ALL of them. @@ -1088,6 +1186,7 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp") (define-key function-key-map [M-return] [?\M-\C-m]) (define-key function-key-map [M-escape] [?\M-\e]) (define-key function-key-map [iso-lefttab] [backtab]) +(define-key function-key-map [S-iso-lefttab] [backtab]) ;; These tell read-char how to convert ;; these special chars to ASCII. @@ -1099,10 +1198,14 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp") (put 'return 'ascii-character 13) (put 'escape 'ascii-character ?\e) + +;;;; Keysyms + (defun vendor-specific-keysyms (vendor) "Return the appropriate value of system-key-alist for VENDOR. VENDOR is a string containing the name of the X Server's vendor, as returned by (x-server-vendor)." + ;; Fixme: Drop Apollo now? (cond ((string-equal vendor "Apollo Computer Inc.") '((65280 . linedel) (65281 . chardel) @@ -1146,6 +1249,7 @@ as returned by (x-server-vendor)." (65395 . deletechar) (65396 . backtab) (65397 . kp-backtab))) + ;; Fixme: What about non-X11/NeWS sun server? ((or (string-equal vendor "X11/NeWS - Sun Microsystems Inc.") (string-equal vendor "X Consortium")) '((392976 . f36) @@ -1162,13 +1266,844 @@ as returned by (x-server-vendor)." ;; This is used by DEC's X server. '((65280 . remove))))) +(let ((i 160)) + (while (< i 256) + (puthash i (make-char 'latin-iso8859-1 i) x-keysym-table) + (setq i (1+ i)))) + +;; Table from Kuhn's proposed additions to the `KEYSYM Encoding' +;; appendix to the X protocol definition. +(dolist + (pair + '( + ;; Latin-2 + (#x1a1 . ?,B!(B) + (#x1a2 . ?,B"(B) + (#x1a3 . ?,B#(B) + (#x1a5 . ?,B%(B) + (#x1a6 . ?,B&(B) + (#x1a9 . ?,B)(B) + (#x1aa . ?,B*(B) + (#x1ab . ?,B+(B) + (#x1ac . ?,B,(B) + (#x1ae . ?,B.(B) + (#x1af . ?,B/(B) + (#x1b1 . ?,B1(B) + (#x1b2 . ?,B2(B) + (#x1b3 . ?,B3(B) + (#x1b5 . ?,B5(B) + (#x1b6 . ?,B6(B) + (#x1b7 . ?,B7(B) + (#x1b9 . ?,B9(B) + (#x1ba . ?,B:(B) + (#x1bb . ?,B;(B) + (#x1bc . ?,B<(B) + (#x1bd . ?,B=(B) + (#x1be . ?,B>(B) + (#x1bf . ?,B?(B) + (#x1c0 . ?,B@(B) + (#x1c3 . ?,BC(B) + (#x1c5 . ?,BE(B) + (#x1c6 . ?,BF(B) + (#x1c8 . ?,BH(B) + (#x1ca . ?,BJ(B) + (#x1cc . ?,BL(B) + (#x1cf . ?,BO(B) + (#x1d0 . ?,BP(B) + (#x1d1 . ?,BQ(B) + (#x1d2 . ?,BR(B) + (#x1d5 . ?,BU(B) + (#x1d8 . ?,BX(B) + (#x1d9 . ?,BY(B) + (#x1db . ?,B[(B) + (#x1de . ?,B^(B) + (#x1e0 . ?,B`(B) + (#x1e3 . ?,Bc(B) + (#x1e5 . ?,Be(B) + (#x1e6 . ?,Bf(B) + (#x1e8 . ?,Bh(B) + (#x1ea . ?,Bj(B) + (#x1ec . ?,Bl(B) + (#x1ef . ?,Bo(B) + (#x1f0 . ?,Bp(B) + (#x1f1 . ?,Bq(B) + (#x1f2 . ?,Br(B) + (#x1f5 . ?,Bu(B) + (#x1f8 . ?,Bx(B) + (#x1f9 . ?,By(B) + (#x1fb . ?,B{(B) + (#x1fe . ?,B~(B) + (#x1ff . ?,B(B) + ;; Latin-3 + (#x2a1 . ?,C!(B) + (#x2a6 . ?,C&(B) + (#x2a9 . ?,C)(B) + (#x2ab . ?,C+(B) + (#x2ac . ?,C,(B) + (#x2b1 . ?,C1(B) + (#x2b6 . ?,C6(B) + (#x2b9 . ?,C9(B) + (#x2bb . ?,C;(B) + (#x2bc . ?,C<(B) + (#x2c5 . ?,CE(B) + (#x2c6 . ?,CF(B) + (#x2d5 . ?,CU(B) + (#x2d8 . ?,CX(B) + (#x2dd . ?,C](B) + (#x2de . ?,C^(B) + (#x2e5 . ?,Ce(B) + (#x2e6 . ?,Cf(B) + (#x2f5 . ?,Cu(B) + (#x2f8 . ?,Cx(B) + (#x2fd . ?,C}(B) + (#x2fe . ?,C~(B) + ;; Latin-4 + (#x3a2 . ?,D"(B) + (#x3a3 . ?,D#(B) + (#x3a5 . ?,D%(B) + (#x3a6 . ?,D&(B) + (#x3aa . ?,D*(B) + (#x3ab . ?,D+(B) + (#x3ac . ?,D,(B) + (#x3b3 . ?,D3(B) + (#x3b5 . ?,D5(B) + (#x3b6 . ?,D6(B) + (#x3ba . ?,D:(B) + (#x3bb . ?,D;(B) + (#x3bc . ?,D<(B) + (#x3bd . ?,D=(B) + (#x3bf . ?,D?(B) + (#x3c0 . ?,D@(B) + (#x3c7 . ?,DG(B) + (#x3cc . ?,DL(B) + (#x3cf . ?,DO(B) + (#x3d1 . ?,DQ(B) + (#x3d2 . ?,DR(B) + (#x3d3 . ?,DS(B) + (#x3d9 . ?,DY(B) + (#x3dd . ?,D](B) + (#x3de . ?,D^(B) + (#x3e0 . ?,D`(B) + (#x3e7 . ?,Dg(B) + (#x3ec . ?,Dl(B) + (#x3ef . ?,Do(B) + (#x3f1 . ?,Dq(B) + (#x3f2 . ?,Dr(B) + (#x3f3 . ?,Ds(B) + (#x3f9 . ?,Dy(B) + (#x3fd . ?,D}(B) + (#x3fe . ?,D~(B) + ;; Kana: Fixme: needs conversion to Japanese charset -- seems + ;; to require jisx0213, for which the Unicode translation + ;; isn't clear. + (#x47e . ?$,1s>(B) + (#x4a1 . ?$,2=B(B) + (#x4a2 . ?\$,2=L(B) + (#x4a3 . ?\$,2=M(B) + (#x4a4 . ?$,2=A(B) + (#x4a5 . ?$,2?{(B) + (#x4a6 . ?$,2?r(B) + (#x4a7 . ?$,2?!(B) + (#x4a8 . ?$,2?#(B) + (#x4a9 . ?$,2?%(B) + (#x4aa . ?$,2?'(B) + (#x4ab . ?$,2?)(B) + (#x4ac . ?$,2?c(B) + (#x4ad . ?$,2?e(B) + (#x4ae . ?$,2?g(B) + (#x4af . ?$,2?C(B) + (#x4b0 . ?$,2?|(B) + (#x4b1 . ?$,2?"(B) + (#x4b2 . ?$,2?$(B) + (#x4b3 . ?$,2?&(B) + (#x4b4 . ?$,2?((B) + (#x4b5 . ?$,2?*(B) + (#x4b6 . ?$,2?+(B) + (#x4b7 . ?$,2?-(B) + (#x4b8 . ?$,2?/(B) + (#x4b9 . ?$,2?1(B) + (#x4ba . ?$,2?3(B) + (#x4bb . ?$,2?5(B) + (#x4bc . ?$,2?7(B) + (#x4bd . ?$,2?9(B) + (#x4be . ?$,2?;(B) + (#x4bf . ?$,2?=(B) + (#x4c0 . ?$,2??(B) + (#x4c1 . ?$,2?A(B) + (#x4c2 . ?$,2?D(B) + (#x4c3 . ?$,2?F(B) + (#x4c4 . ?$,2?H(B) + (#x4c5 . ?$,2?J(B) + (#x4c6 . ?$,2?K(B) + (#x4c7 . ?$,2?L(B) + (#x4c8 . ?$,2?M(B) + (#x4c9 . ?$,2?N(B) + (#x4ca . ?$,2?O(B) + (#x4cb . ?$,2?R(B) + (#x4cc . ?$,2?U(B) + (#x4cd . ?$,2?X(B) + (#x4ce . ?$,2?[(B) + (#x4cf . ?$,2?^(B) + (#x4d0 . ?$,2?_(B) + (#x4d1 . ?$,2?`(B) + (#x4d2 . ?$,2?a(B) + (#x4d3 . ?$,2?b(B) + (#x4d4 . ?$,2?d(B) + (#x4d5 . ?$,2?f(B) + (#x4d6 . ?$,2?h(B) + (#x4d7 . ?$,2?i(B) + (#x4d8 . ?$,2?j(B) + (#x4d9 . ?$,2?k(B) + (#x4da . ?$,2?l(B) + (#x4db . ?$,2?m(B) + (#x4dc . ?$,2?o(B) + (#x4dd . ?$,2?s(B) + (#x4de . ?$,2>{(B) + (#x4df . ?$,2>|(B) + ;; Arabic + (#x5ac . ?,G,(B) + (#x5bb . ?,G;(B) + (#x5bf . ?,G?(B) + (#x5c1 . ?,GA(B) + (#x5c2 . ?,GB(B) + (#x5c3 . ?,GC(B) + (#x5c4 . ?,GD(B) + (#x5c5 . ?,GE(B) + (#x5c6 . ?,GF(B) + (#x5c7 . ?,GG(B) + (#x5c8 . ?,GH(B) + (#x5c9 . ?,GI(B) + (#x5ca . ?,GJ(B) + (#x5cb . ?,GK(B) + (#x5cc . ?,GL(B) + (#x5cd . ?,GM(B) + (#x5ce . ?,GN(B) + (#x5cf . ?,GO(B) + (#x5d0 . ?,GP(B) + (#x5d1 . ?,GQ(B) + (#x5d2 . ?,GR(B) + (#x5d3 . ?,GS(B) + (#x5d4 . ?,GT(B) + (#x5d5 . ?,GU(B) + (#x5d6 . ?,GV(B) + (#x5d7 . ?,GW(B) + (#x5d8 . ?,GX(B) + (#x5d9 . ?,GY(B) + (#x5da . ?,GZ(B) + (#x5e0 . ?,G`(B) + (#x5e1 . ?,Ga(B) + (#x5e2 . ?,Gb(B) + (#x5e3 . ?,Gc(B) + (#x5e4 . ?,Gd(B) + (#x5e5 . ?,Ge(B) + (#x5e6 . ?,Gf(B) + (#x5e7 . ?,Gg(B) + (#x5e8 . ?,Gh(B) + (#x5e9 . ?,Gi(B) + (#x5ea . ?,Gj(B) + (#x5eb . ?,Gk(B) + (#x5ec . ?,Gl(B) + (#x5ed . ?,Gm(B) + (#x5ee . ?,Gn(B) + (#x5ef . ?,Go(B) + (#x5f0 . ?,Gp(B) + (#x5f1 . ?,Gq(B) + (#x5f2 . ?,Gr(B) + ;; Cyrillic + (#x6a1 . ?,Lr(B) + (#x6a2 . ?,Ls(B) + (#x6a3 . ?,Lq(B) + (#x6a4 . ?,Lt(B) + (#x6a5 . ?,Lu(B) + (#x6a6 . ?,Lv(B) + (#x6a7 . ?,Lw(B) + (#x6a8 . ?,Lx(B) + (#x6a9 . ?,Ly(B) + (#x6aa . ?,Lz(B) + (#x6ab . ?,L{(B) + (#x6ac . ?,L|(B) + (#x6ae . ?,L~(B) + (#x6af . ?,L(B) + (#x6b0 . ?,Lp(B) + (#x6b1 . ?,L"(B) + (#x6b2 . ?,L#(B) + (#x6b3 . ?,L!(B) + (#x6b4 . ?,L$(B) + (#x6b5 . ?,L%(B) + (#x6b6 . ?,L&(B) + (#x6b7 . ?,L'(B) + (#x6b8 . ?,L((B) + (#x6b9 . ?,L)(B) + (#x6ba . ?,L*(B) + (#x6bb . ?,L+(B) + (#x6bc . ?,L,(B) + (#x6be . ?,L.(B) + (#x6bf . ?,L/(B) + (#x6c0 . ?,Ln(B) + (#x6c1 . ?,LP(B) + (#x6c2 . ?,LQ(B) + (#x6c3 . ?,Lf(B) + (#x6c4 . ?,LT(B) + (#x6c5 . ?,LU(B) + (#x6c6 . ?,Ld(B) + (#x6c7 . ?,LS(B) + (#x6c8 . ?,Le(B) + (#x6c9 . ?,LX(B) + (#x6ca . ?,LY(B) + (#x6cb . ?,LZ(B) + (#x6cc . ?,L[(B) + (#x6cd . ?,L\(B) + (#x6ce . ?,L](B) + (#x6cf . ?,L^(B) + (#x6d0 . ?,L_(B) + (#x6d1 . ?,Lo(B) + (#x6d2 . ?,L`(B) + (#x6d3 . ?,La(B) + (#x6d4 . ?,Lb(B) + (#x6d5 . ?,Lc(B) + (#x6d6 . ?,LV(B) + (#x6d7 . ?,LR(B) + (#x6d8 . ?,Ll(B) + (#x6d9 . ?,Lk(B) + (#x6da . ?,LW(B) + (#x6db . ?,Lh(B) + (#x6dc . ?,Lm(B) + (#x6dd . ?,Li(B) + (#x6de . ?,Lg(B) + (#x6df . ?,Lj(B) + (#x6e0 . ?,LN(B) + (#x6e1 . ?,L0(B) + (#x6e2 . ?,L1(B) + (#x6e3 . ?,LF(B) + (#x6e4 . ?,L4(B) + (#x6e5 . ?,L5(B) + (#x6e6 . ?,LD(B) + (#x6e7 . ?,L3(B) + (#x6e8 . ?,LE(B) + (#x6e9 . ?,L8(B) + (#x6ea . ?,L9(B) + (#x6eb . ?,L:(B) + (#x6ec . ?,L;(B) + (#x6ed . ?,L<(B) + (#x6ee . ?,L=(B) + (#x6ef . ?,L>(B) + (#x6f0 . ?,L?(B) + (#x6f1 . ?,LO(B) + (#x6f2 . ?,L@(B) + (#x6f3 . ?,LA(B) + (#x6f4 . ?,LB(B) + (#x6f5 . ?,LC(B) + (#x6f6 . ?,L6(B) + (#x6f7 . ?,L2(B) + (#x6f8 . ?,LL(B) + (#x6f9 . ?,LK(B) + (#x6fa . ?,L7(B) + (#x6fb . ?,LH(B) + (#x6fc . ?,LM(B) + (#x6fd . ?,LI(B) + (#x6fe . ?,LG(B) + (#x6ff . ?,LJ(B) + ;; Greek + (#x7a1 . ?,F6(B) + (#x7a2 . ?,F8(B) + (#x7a3 . ?,F9(B) + (#x7a4 . ?,F:(B) + (#x7a5 . ?,FZ(B) + (#x7a7 . ?,F<(B) + (#x7a8 . ?,F>(B) + (#x7a9 . ?,F[(B) + (#x7ab . ?,F?(B) + (#x7ae . ?,F5(B) + (#x7af . ?,F/(B) + (#x7b1 . ?,F\(B) + (#x7b2 . ?,F](B) + (#x7b3 . ?,F^(B) + (#x7b4 . ?,F_(B) + (#x7b5 . ?,Fz(B) + (#x7b6 . ?,F@(B) + (#x7b7 . ?,F|(B) + (#x7b8 . ?,F}(B) + (#x7b9 . ?,F{(B) + (#x7ba . ?,F`(B) + (#x7bb . ?,F~(B) + (#x7c1 . ?,FA(B) + (#x7c2 . ?,FB(B) + (#x7c3 . ?,FC(B) + (#x7c4 . ?,FD(B) + (#x7c5 . ?,FE(B) + (#x7c6 . ?,FF(B) + (#x7c7 . ?,FG(B) + (#x7c8 . ?,FH(B) + (#x7c9 . ?,FI(B) + (#x7ca . ?,FJ(B) + (#x7cb . ?,FK(B) + (#x7cc . ?,FL(B) + (#x7cd . ?,FM(B) + (#x7ce . ?,FN(B) + (#x7cf . ?,FO(B) + (#x7d0 . ?,FP(B) + (#x7d1 . ?,FQ(B) + (#x7d2 . ?,FS(B) + (#x7d4 . ?,FT(B) + (#x7d5 . ?,FU(B) + (#x7d6 . ?,FV(B) + (#x7d7 . ?,FW(B) + (#x7d8 . ?,FX(B) + (#x7d9 . ?,FY(B) + (#x7e1 . ?,Fa(B) + (#x7e2 . ?,Fb(B) + (#x7e3 . ?,Fc(B) + (#x7e4 . ?,Fd(B) + (#x7e5 . ?,Fe(B) + (#x7e6 . ?,Ff(B) + (#x7e7 . ?,Fg(B) + (#x7e8 . ?,Fh(B) + (#x7e9 . ?,Fi(B) + (#x7ea . ?,Fj(B) + (#x7eb . ?,Fk(B) + (#x7ec . ?,Fl(B) + (#x7ed . ?,Fm(B) + (#x7ee . ?,Fn(B) + (#x7ef . ?,Fo(B) + (#x7f0 . ?,Fp(B) + (#x7f1 . ?,Fq(B) + (#x7f2 . ?,Fs(B) + (#x7f3 . ?,Fr(B) + (#x7f4 . ?,Ft(B) + (#x7f5 . ?,Fu(B) + (#x7f6 . ?,Fv(B) + (#x7f7 . ?,Fw(B) + (#x7f8 . ?,Fx(B) + (#x7f9 . ?,Fy(B) + ;; Technical + (#x8a1 . ?$,1|W(B) + (#x8a2 . ?$,2 ,(B) + (#x8a3 . ?$,2 (B) + (#x8a4 . ?$,1{ (B) + (#x8a5 . ?$,1{!(B) + (#x8a6 . ?$,2 "(B) + (#x8a7 . ?$,1|A(B) + (#x8a8 . ?$,1|C(B) + (#x8a9 . ?$,1|D(B) + (#x8aa . ?$,1|F(B) + (#x8ab . ?$,1|;(B) + (#x8ac . ?$,1|=(B) + (#x8ad . ?$,1|>(B) + (#x8ae . ?$,1|@(B) + (#x8af . ?$,1|H(B) + (#x8b0 . ?$,1|L(B) + (#x8bc . ?$,1y$(B) + (#x8bd . ?$,1y (B) + (#x8be . ?$,1y%(B) + (#x8bf . ?$,1xK(B) + (#x8c0 . ?$,1xT(B) + (#x8c1 . ?$,1x=(B) + (#x8c2 . ?$,1x>(B) + (#x8c5 . ?$,1x'(B) + (#x8c8 . ?$,1x\(B) + (#x8c9 . ?$,1xc(B) + (#x8cd . ?$,1wT(B) + (#x8ce . ?$,1wR(B) + (#x8cf . ?$,1y!(B) + (#x8d6 . ?$,1x:(B) + (#x8da . ?$,1yB(B) + (#x8db . ?$,1yC(B) + (#x8dc . ?$,1xI(B) + (#x8dd . ?$,1xJ(B) + (#x8de . ?$,1xG(B) + (#x8df . ?$,1xH(B) + (#x8ef . ?$,1x"(B) + (#x8f6 . ?$,1!R(B) + (#x8fb . ?$,1vp(B) + (#x8fc . ?$,1vq(B) + (#x8fd . ?$,1vr(B) + (#x8fe . ?$,1vs(B) + ;; Special + (#x9e0 . ?$,2"&(B) + (#x9e1 . ?$,2!R(B) + (#x9e2 . ?$,1}I(B) + (#x9e3 . ?$,1}L(B) + (#x9e4 . ?$,1}M(B) + (#x9e5 . ?$,1}J(B) + (#x9e8 . ?$,1}d(B) + (#x9e9 . ?$,1}K(B) + (#x9ea . ?$,2 8(B) + (#x9eb . ?$,2 0(B) + (#x9ec . ?$,2 ,(B) + (#x9ed . ?$,2 4(B) + (#x9ee . ?$,2 \(B) + (#x9ef . ?$,1|Z(B) + (#x9f0 . ?$,1|[(B) + (#x9f1 . ?$,2 (B) + (#x9f2 . ?$,1|\(B) + (#x9f3 . ?$,1|](B) + (#x9f4 . ?$,2 <(B) + (#x9f5 . ?$,2 D(B) + (#x9f6 . ?$,2 T(B) + (#x9f7 . ?$,2 L(B) + (#x9f8 . ?$,2 "(B) + ;; Publishing + (#xaa1 . ?$,1rc(B) + (#xaa2 . ?$,1rb(B) + (#xaa3 . ?$,1rd(B) + (#xaa4 . ?$,1re(B) + (#xaa5 . ?$,1rg(B) + (#xaa6 . ?$,1rh(B) + (#xaa7 . ?$,1ri(B) + (#xaa8 . ?$,1rj(B) + (#xaa9 . ?$,1rt(B) + (#xaaa . ?$,1rs(B) + (#xaae . ?$,1s&(B) + (#xaaf . ?$,1s%(B) + (#xab0 . ?$,1v3(B) + (#xab1 . ?$,1v4(B) + (#xab2 . ?$,1v5(B) + (#xab3 . ?$,1v6(B) + (#xab4 . ?$,1v7(B) + (#xab5 . ?$,1v8(B) + (#xab6 . ?$,1v9(B) + (#xab7 . ?$,1v:(B) + (#xab8 . ?$,1uE(B) + (#xabb . ?$,1rr(B) + (#xabc . ?$,1{)(B) + (#xabe . ?$,1{*(B) + (#xac3 . ?$,1v;(B) + (#xac4 . ?$,1v<(B) + (#xac5 . ?$,1v=(B) + (#xac6 . ?$,1v>(B) + (#xac9 . ?$,1ub(B) + (#xaca . ?$,2"s(B) + (#xacc . ?$,2"!(B) + (#xacd . ?$,2!w(B) + (#xace . ?$,2"+(B) + (#xacf . ?$,2!o(B) + (#xad0 . ?$,1rx(B) + (#xad1 . ?$,1ry(B) + (#xad2 . ?$,1r|(B) + (#xad3 . ?$,1r}(B) + (#xad4 . ?$,1u^(B) + (#xad6 . ?$,1s2(B) + (#xad7 . ?$,1s3(B) + (#xad9 . ?$,2%](B) + (#xadb . ?$,2!l(B) + (#xadc . ?$,2" (B) + (#xadd . ?$,2!v(B) + (#xade . ?$,2"/(B) + (#xadf . ?$,2!n(B) + (#xae0 . ?$,2"F(B) + (#xae1 . ?$,2!k(B) + (#xae2 . ?$,2!m(B) + (#xae3 . ?$,2!s(B) + (#xae4 . ?$,2!}(B) + (#xae5 . ?$,2"f(B) + (#xae6 . ?$,1s"(B) + (#xae7 . ?$,2!j(B) + (#xae8 . ?$,2!r(B) + (#xae9 . ?$,2!|(B) + (#xaea . ?$,2"|(B) + (#xaeb . ?$,2"~(B) + (#xaec . ?$,2#c(B) + (#xaed . ?$,2#f(B) + (#xaee . ?$,2#e(B) + (#xaf0 . ?$,2%`(B) + (#xaf1 . ?$,1s (B) + (#xaf2 . ?$,1s!(B) + (#xaf3 . ?$,2%S(B) + (#xaf4 . ?$,2%W(B) + (#xaf5 . ?$,2#o(B) + (#xaf6 . ?$,2#m(B) + (#xaf7 . ?$,2#B(B) + (#xaf8 . ?$,2#@(B) + (#xaf9 . ?$,2"n(B) + (#xafa . ?$,1zu(B) + (#xafb . ?$,1uW(B) + (#xafc . ?$,1s8(B) + (#xafd . ?$,1rz(B) + (#xafe . ?$,1r~(B) + ;; APL + (#xba3 . ?<) + (#xba6 . ?>) + (#xba8 . ?$,1xH(B) + (#xba9 . ?$,1xG(B) + (#xbc0 . ?,A/(B) + (#xbc2 . ?$,1ye(B) + (#xbc3 . ?$,1xI(B) + (#xbc4 . ?$,1zj(B) + (#xbc6 . ?_) + (#xbca . ?$,1x8(B) + (#xbcc . ?$,1|5(B) + (#xbce . ?$,1yd(B) + (#xbcf . ?$,2"+(B) + (#xbd3 . ?$,1zh(B) + (#xbd6 . ?$,1xJ(B) + (#xbd8 . ?$,1yC(B) + (#xbda . ?$,1yB(B) + (#xbdc . ?$,1yb(B) + (#xbfc . ?$,1yc(B) + ;; Hebrew + (#xcdf . ?,H_(B) + (#xce0 . ?,H`(B) + (#xce1 . ?,Ha(B) + (#xce2 . ?,Hb(B) + (#xce3 . ?,Hc(B) + (#xce4 . ?,Hd(B) + (#xce5 . ?,He(B) + (#xce6 . ?,Hf(B) + (#xce7 . ?,Hg(B) + (#xce8 . ?,Hh(B) + (#xce9 . ?,Hi(B) + (#xcea . ?,Hj(B) + (#xceb . ?,Hk(B) + (#xcec . ?,Hl(B) + (#xced . ?,Hm(B) + (#xcee . ?,Hn(B) + (#xcef . ?,Ho(B) + (#xcf0 . ?,Hp(B) + (#xcf1 . ?,Hq(B) + (#xcf2 . ?,Hr(B) + (#xcf3 . ?,Hs(B) + (#xcf4 . ?,Ht(B) + (#xcf5 . ?,Hu(B) + (#xcf6 . ?,Hv(B) + (#xcf7 . ?,Hw(B) + (#xcf8 . ?,Hx(B) + (#xcf9 . ?,Hy(B) + (#xcfa . ?,Hz(B) + ;; Thai + (#xda1 . ?,T!(B) + (#xda2 . ?,T"(B) + (#xda3 . ?,T#(B) + (#xda4 . ?,T$(B) + (#xda5 . ?,T%(B) + (#xda6 . ?,T&(B) + (#xda7 . ?,T'(B) + (#xda8 . ?,T((B) + (#xda9 . ?,T)(B) + (#xdaa . ?,T*(B) + (#xdab . ?,T+(B) + (#xdac . ?,T,(B) + (#xdad . ?,T-(B) + (#xdae . ?,T.(B) + (#xdaf . ?,T/(B) + (#xdb0 . ?,T0(B) + (#xdb1 . ?,T1(B) + (#xdb2 . ?,T2(B) + (#xdb3 . ?,T3(B) + (#xdb4 . ?,T4(B) + (#xdb5 . ?,T5(B) + (#xdb6 . ?,T6(B) + (#xdb7 . ?,T7(B) + (#xdb8 . ?,T8(B) + (#xdb9 . ?,T9(B) + (#xdba . ?,T:(B) + (#xdbb . ?,T;(B) + (#xdbc . ?,T<(B) + (#xdbd . ?,T=(B) + (#xdbe . ?,T>(B) + (#xdbf . ?,T?(B) + (#xdc0 . ?,T@(B) + (#xdc1 . ?,TA(B) + (#xdc2 . ?,TB(B) + (#xdc3 . ?,TC(B) + (#xdc4 . ?,TD(B) + (#xdc5 . ?,TE(B) + (#xdc6 . ?,TF(B) + (#xdc7 . ?,TG(B) + (#xdc8 . ?,TH(B) + (#xdc9 . ?,TI(B) + (#xdca . ?,TJ(B) + (#xdcb . ?,TK(B) + (#xdcc . ?,TL(B) + (#xdcd . ?,TM(B) + (#xdce . ?,TN(B) + (#xdcf . ?,TO(B) + (#xdd0 . ?,TP(B) + (#xdd1 . ?,TQ(B) + (#xdd2 . ?,TR(B) + (#xdd3 . ?,TS(B) + (#xdd4 . ?,TT(B) + (#xdd5 . ?,TU(B) + (#xdd6 . ?,TV(B) + (#xdd7 . ?,TW(B) + (#xdd8 . ?,TX(B) + (#xdd9 . ?,TY(B) + (#xdda . ?,TZ(B) + (#xddf . ?,T_(B) + (#xde0 . ?,T`(B) + (#xde1 . ?,Ta(B) + (#xde2 . ?,Tb(B) + (#xde3 . ?,Tc(B) + (#xde4 . ?,Td(B) + (#xde5 . ?,Te(B) + (#xde6 . ?,Tf(B) + (#xde7 . ?,Tg(B) + (#xde8 . ?,Th(B) + (#xde9 . ?,Ti(B) + (#xdea . ?,Tj(B) + (#xdeb . ?,Tk(B) + (#xdec . ?,Tl(B) + (#xded . ?,Tm(B) + (#xdf0 . ?,Tp(B) + (#xdf1 . ?,Tq(B) + (#xdf2 . ?,Tr(B) + (#xdf3 . ?,Ts(B) + (#xdf4 . ?,Tt(B) + (#xdf5 . ?,Tu(B) + (#xdf6 . ?,Tv(B) + (#xdf7 . ?,Tw(B) + (#xdf8 . ?,Tx(B) + (#xdf9 . ?,Ty(B) + ;; Korean + (#xea1 . ?$(C$!(B) + (#xea2 . ?$(C$"(B) + (#xea3 . ?$(C$#(B) + (#xea4 . ?$(C$$(B) + (#xea5 . ?$(C$%(B) + (#xea6 . ?$(C$&(B) + (#xea7 . ?$(C$'(B) + (#xea8 . ?$(C$((B) + (#xea9 . ?$(C$)(B) + (#xeaa . ?$(C$*(B) + (#xeab . ?$(C$+(B) + (#xeac . ?$(C$,(B) + (#xead . ?$(C$-(B) + (#xeae . ?$(C$.(B) + (#xeaf . ?$(C$/(B) + (#xeb0 . ?$(C$0(B) + (#xeb1 . ?$(C$1(B) + (#xeb2 . ?$(C$2(B) + (#xeb3 . ?$(C$3(B) + (#xeb4 . ?$(C$4(B) + (#xeb5 . ?$(C$5(B) + (#xeb6 . ?$(C$6(B) + (#xeb7 . ?$(C$7(B) + (#xeb8 . ?$(C$8(B) + (#xeb9 . ?$(C$9(B) + (#xeba . ?$(C$:(B) + (#xebb . ?$(C$;(B) + (#xebc . ?$(C$<(B) + (#xebd . ?$(C$=(B) + (#xebe . ?$(C$>(B) + (#xebf . ?$(C$?(B) + (#xec0 . ?$(C$@(B) + (#xec1 . ?$(C$A(B) + (#xec2 . ?$(C$B(B) + (#xec3 . ?$(C$C(B) + (#xec4 . ?$(C$D(B) + (#xec5 . ?$(C$E(B) + (#xec6 . ?$(C$F(B) + (#xec7 . ?$(C$G(B) + (#xec8 . ?$(C$H(B) + (#xec9 . ?$(C$I(B) + (#xeca . ?$(C$J(B) + (#xecb . ?$(C$K(B) + (#xecc . ?$(C$L(B) + (#xecd . ?$(C$M(B) + (#xece . ?$(C$N(B) + (#xecf . ?$(C$O(B) + (#xed0 . ?$(C$P(B) + (#xed1 . ?$(C$Q(B) + (#xed2 . ?$(C$R(B) + (#xed3 . ?$(C$S(B) + (#xed4 . ?$,1LH(B) + (#xed5 . ?$,1LI(B) + (#xed6 . ?$,1LJ(B) + (#xed7 . ?$,1LK(B) + (#xed8 . ?$,1LL(B) + (#xed9 . ?$,1LM(B) + (#xeda . ?$,1LN(B) + (#xedb . ?$,1LO(B) + (#xedc . ?$,1LP(B) + (#xedd . ?$,1LQ(B) + (#xede . ?$,1LR(B) + (#xedf . ?$,1LS(B) + (#xee0 . ?$,1LT(B) + (#xee1 . ?$,1LU(B) + (#xee2 . ?$,1LV(B) + (#xee3 . ?$,1LW(B) + (#xee4 . ?$,1LX(B) + (#xee5 . ?$,1LY(B) + (#xee6 . ?$,1LZ(B) + (#xee7 . ?$,1L[(B) + (#xee8 . ?$,1L\(B) + (#xee9 . ?$,1L](B) + (#xeea . ?$,1L^(B) + (#xeeb . ?$,1L_(B) + (#xeec . ?$,1L`(B) + (#xeed . ?$,1La(B) + (#xeee . ?$,1Lb(B) + (#xeef . ?$(C$](B) + (#xef0 . ?$(C$a(B) + (#xef1 . ?$(C$h(B) + (#xef2 . ?$(C$o(B) + (#xef3 . ?$(C$q(B) + (#xef4 . ?$(C$t(B) + (#xef5 . ?$(C$v(B) + (#xef6 . ?$(C$}(B) + (#xef7 . ?$(C$~(B) + (#xef8 . ?$,1M+(B) + (#xef9 . ?$,1M0(B) + (#xefa . ?$,1M9(B) + (#xeff . ?$,1tI(B) + ;; Latin-5 + ;; Latin-6 + ;; Latin-7 + ;; Latin-8 + ;; Latin-9 + (#x13bc . ?,b<(B) + (#x13bd . ?,b=(B) + (#x13be . ?,b>(B) + ;; Currency + (#x20a0 . ?$,1t@(B) + (#x20a1 . ?$,1tA(B) + (#x20a2 . ?$,1tB(B) + (#x20a3 . ?$,1tC(B) + (#x20a4 . ?$,1tD(B) + (#x20a5 . ?$,1tE(B) + (#x20a6 . ?$,1tF(B) + (#x20a7 . ?$,1tG(B) + (#x20a8 . ?$,1tH(B) + (#x20aa . ?$,1tJ(B) + (#x20ab . ?$,1tK(B) + (#x20ac . ?,b$(B))) + (puthash (car pair) (cdr pair) x-keysym-table)) + +;; The following keysym codes for graphics are listed in the document +;; as not having unicodes available: + +;; #x08b1 TOP LEFT SUMMATION Technical +;; #x08b2 BOTTOM LEFT SUMMATION Technical +;; #x08b3 TOP VERTICAL SUMMATION CONNECTOR Technical +;; #x08b4 BOTTOM VERTICAL SUMMATION CONNECTOR Technical +;; #x08b5 TOP RIGHT SUMMATION Technical +;; #x08b6 BOTTOM RIGHT SUMMATION Technical +;; #x08b7 RIGHT MIDDLE SUMMATION Technical +;; #x0aac SIGNIFICANT BLANK SYMBOL Publish +;; #x0abd DECIMAL POINT Publish +;; #x0abf MARKER Publish +;; #x0acb TRADEMARK SIGN IN CIRCLE Publish +;; #x0ada HEXAGRAM Publish +;; #x0aff CURSOR Publish +;; #x0dde THAI MAIHANAKAT Thai + ;;;; Selections and cut buffers ;;; We keep track of the last text selected here, so we can check the ;;; current selection against it, and avoid passing back our own text -;;; from x-cut-buffer-or-selection-value. -(defvar x-last-selected-text nil) +;;; from x-cut-buffer-or-selection-value. We track all three +;;; seperately in case another X application only sets one of them +;;; (say the cut buffer) we aren't fooled by the PRIMARY or +;;; CLIPBOARD selection staying the same. +(defvar x-last-selected-text-clipboard nil + "The value of the CLIPBOARD X selection last time we selected or +pasted text.") +(defvar x-last-selected-text-primary nil + "The value of the PRIMARY X selection last time we selected or +pasted text.") +(defvar x-last-selected-text-cut nil + "The vaue of the X cut buffer last time we selected or +pasted text.") ;;; It is said that overlarge strings are slow to put into the cut buffer. ;;; Note this value is overridden below. @@ -1189,56 +2124,121 @@ This is in addition to, but in preference to, the primary selection." (defun x-select-text (text &optional push) ;; Don't send the cut buffer too much text. ;; It becomes slow, and if really big it causes errors. - (if (< (length text) x-cut-buffer-max) + (cond ((>= (length text) x-cut-buffer-max) + (x-set-cut-buffer "" push) + (setq x-last-selected-text-cut "")) + (t (x-set-cut-buffer text push) - (x-set-cut-buffer "" push)) + (setq x-last-selected-text-cut text))) (x-set-selection 'PRIMARY text) - (if x-select-enable-clipboard - (x-set-selection 'CLIPBOARD text)) - (setq x-last-selected-text text)) + (setq x-last-selected-text-primary text) + (when x-select-enable-clipboard + (x-set-selection 'CLIPBOARD text) + (setq x-last-selected-text-clipboard text)) + ) ;;; Return the value of the current X selection. -;;; Consult the selection, then the cut buffer. Treat empty strings +;;; Consult the selection, and the cut buffer. Treat empty strings ;;; as if they were unset. ;;; If this function is called twice and finds the same text, ;;; it returns nil the second time. This is so that a single ;;; selection won't be added to the kill ring over and over. (defun x-cut-buffer-or-selection-value () - (let (text) + (let (clip-text primary-text cut-text) (when x-select-enable-clipboard - (if (null text) + ;; Don't die if x-get-selection signals an error. + (if (null clip-text) (condition-case c - (setq text (x-get-selection 'CLIPBOARD 'COMPOUND_TEXT)) + (setq clip-text (x-get-selection 'CLIPBOARD 'COMPOUND_TEXT)) (error nil))) - (if (null text) + (if (null clip-text) (condition-case c - (setq text (x-get-selection 'CLIPBOARD 'STRING)) + (setq clip-text (x-get-selection 'CLIPBOARD 'STRING)) (error nil))) - (if (string= text "") (setq text nil))) + (if (string= clip-text "") (setq clip-text nil)) + + ;; Check the CLIPBOARD selection for 'newness', is it different + ;; from what we remebered them to be last time we did a + ;; cut/paste operation. + (setq clip-text + (cond;; check clipboard + ((or (not clip-text) (string= clip-text "")) + (setq x-last-selected-text-clipboard nil)) + ((eq clip-text x-last-selected-text-clipboard) nil) + ((string= clip-text x-last-selected-text-clipboard) + ;; Record the newer string, + ;; so subsequent calls can use the `eq' test. + (setq x-last-selected-text-clipboard clip-text) + nil) + (t + (setq x-last-selected-text-clipboard clip-text)))) + ) ;; Don't die if x-get-selection signals an error. - (if (null text) + (if (null primary-text) (condition-case c - (setq text (x-get-selection 'PRIMARY 'COMPOUND_TEXT)) + (setq primary-text (x-get-selection 'PRIMARY 'COMPOUND_TEXT)) (error nil))) - (if (null text) + (if (null primary-text) (condition-case c - (setq text (x-get-selection 'PRIMARY 'STRING)) + (setq primary-text (x-get-selection 'PRIMARY 'STRING)) (error nil))) - (if (string= text "") (setq text nil)) + ;; Check the PRIMARY selection for 'newness', is it different + ;; from what we remebered them to be last time we did a + ;; cut/paste operation. + (setq primary-text + (cond;; check primary selection + ((or (not primary-text) (string= primary-text "")) + (setq x-last-selected-text-primary nil)) + ((eq primary-text x-last-selected-text-primary) nil) + ((string= primary-text x-last-selected-text-primary) + ;; Record the newer string, + ;; so subsequent calls can use the `eq' test. + (setq x-last-selected-text-primary primary-text) + nil) + (t + (setq x-last-selected-text-primary primary-text)))) - (or text (setq text (x-get-cut-buffer 0))) - (if (string= text "") (setq text nil)) + (setq cut-text (x-get-cut-buffer 0)) - (cond - ((not text) nil) - ((eq text x-last-selected-text) nil) - ((string= text x-last-selected-text) - ;; Record the newer string, so subsequent calls can use the `eq' test. - (setq x-last-selected-text text) + ;; Check the x cut buffer for 'newness', is it different + ;; from what we remebered them to be last time we did a + ;; cut/paste operation. + (setq cut-text + (cond;; check primary selection + ((or (not cut-text) (string= cut-text "")) + (setq x-last-selected-text-cut nil)) + ((eq cut-text x-last-selected-text-cut) nil) + ((string= cut-text x-last-selected-text-cut) + ;; Record the newer string, + ;; so subsequent calls can use the `eq' test. + (setq x-last-selected-text-cut cut-text) nil) (t - (setq x-last-selected-text text))))) + (setq x-last-selected-text-cut cut-text)))) + + ;; At this point we have recorded the current values for the + ;; selection from clipboard (if we are supposed to) primary, + ;; and cut buffer. So return the first one that has changed + ;; (which is the first non-null one). + ;; + ;; NOTE: There will be cases where more than one of these has + ;; changed and the new values differ. This indicates that + ;; something like the following has happened since the last time + ;; we looked at the selections: Application X set all the + ;; selections, then Application Y set only one or two of them (say + ;; just the cut-buffer). In this case since we don't have + ;; timestamps there is no way to know what the 'correct' value to + ;; return is. The nice thing to do would be to tell the user we + ;; saw multiple possible selections and ask the user which was the + ;; one they wanted. + ;; This code is still a big improvement because now the user can + ;; futz with the current selection and get emacs to pay attention + ;; to the cut buffer again (previously as soon as clipboard or + ;; primary had been set the cut buffer would essentially never be + ;; checked again). + (or clip-text primary-text cut-text) + )) ;;; Do the actual X Windows setup here; the above code just defines @@ -1256,55 +2256,47 @@ This is in addition to, but in preference to, the primary selection." (while (setq i (string-match "[.*]" x-resource-name)) (aset x-resource-name i ?-)))) -;; For the benefit of older Emacses (19.27 and earlier) that are sharing -;; the same lisp directory, don't pass the third argument unless we seem -;; to have the multi-display support. -(if (fboundp 'x-close-connection) - (x-open-connection (or x-display-name - (setq x-display-name (getenv "DISPLAY"))) - x-command-line-resources - ;; Exit Emacs with fatal error if this fails. - t) - (x-open-connection (or x-display-name - (setq x-display-name (getenv "DISPLAY"))) - x-command-line-resources)) +(x-open-connection (or x-display-name + (setq x-display-name (getenv "DISPLAY"))) + x-command-line-resources + ;; Exit Emacs with fatal error if this fails. + t) (setq frame-creation-function 'x-create-frame-with-faces) (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100) x-cut-buffer-max)) -(if (fboundp 'new-fontset) - (progn - ;; Create the standard fontset. - (create-fontset-from-fontset-spec standard-fontset-spec t) - - ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...). - (create-fontset-from-x-resource) - - ;; Try to create a fontset from a font specification which comes - ;; from initial-frame-alist, default-frame-alist, or X resource. - ;; A font specification in command line argument (i.e. -fn XXXX) - ;; should be already in default-frame-alist as a `font' - ;; parameter. However, any font specifications in site-start - ;; library, user's init file (.emacs), and default.el are not - ;; yet handled here. - - (let ((font (or (cdr (assq 'font initial-frame-alist)) - (cdr (assq 'font default-frame-alist)) - (x-get-resource "font" "Font"))) - xlfd-fields resolved-name) - (if (and font - (not (query-fontset font)) - (setq resolved-name (x-resolve-font-name font)) - (setq xlfd-fields (x-decompose-font-name font))) - (if (string= "fontset" - (aref xlfd-fields xlfd-regexp-registry-subnum)) - (new-fontset font (x-complement-fontset-spec xlfd-fields nil)) - ;; Create a fontset from FONT. The fontset name is - ;; generated from FONT. - (create-fontset-from-ascii-font font - resolved-name "startup")))))) +;; Setup the default fontset. +(setup-default-fontset) + +;; Create the standard fontset. +(create-fontset-from-fontset-spec standard-fontset-spec t) + +;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...). +(create-fontset-from-x-resource) + +;; Try to create a fontset from a font specification which comes +;; from initial-frame-alist, default-frame-alist, or X resource. +;; A font specification in command line argument (i.e. -fn XXXX) +;; should be already in default-frame-alist as a `font' +;; parameter. However, any font specifications in site-start +;; library, user's init file (.emacs), and default.el are not +;; yet handled here. + +(let ((font (or (cdr (assq 'font initial-frame-alist)) + (cdr (assq 'font default-frame-alist)) + (x-get-resource "font" "Font"))) + xlfd-fields resolved-name) + (if (and font + (not (query-fontset font)) + (setq resolved-name (x-resolve-font-name font)) + (setq xlfd-fields (x-decompose-font-name font))) + (if (string= "fontset" (aref xlfd-fields xlfd-regexp-registry-subnum)) + (new-fontset font (x-complement-fontset-spec xlfd-fields nil)) + ;; Create a fontset from FONT. The fontset name is + ;; generated from FONT. + (create-fontset-from-ascii-font font resolved-name "startup")))) ;; Sun expects the menu bar cut and paste commands to use the clipboard. ;; This has ,? to match both on Sunos and on Solaris.