1 ;;; mac-win.el --- parse switches controlling interface with Mac window system -*-coding: utf-8
3 ;; Copyright (C) 1999, 2000, 2002, 2003, 2004,
4 ;; 2005 Free Software Foundation, Inc.
6 ;; Author: Andrew Choi <akochoi@mac.com>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
28 ;; Mac-win.el: this file is loaded from ../lisp/startup.el when it recognizes
29 ;; that Mac windows are to be used. Command line switches are parsed and those
30 ;; pertaining to Mac are processed and removed from the command line. The
31 ;; Mac display is opened and hooks are set for popping up the initial window.
33 ;; startup.el will then examine startup files, and eventually call the hooks
34 ;; which create the first window(s).
38 ;; These are the standard X switches from the Xt Initialize.c file of
41 ;; Command line Resource Manager string
44 ;; +synchronous *synchronous
45 ;; -background *background
48 ;; -bordercolor *borderColor
49 ;; -borderwidth .borderWidth
55 ;; -foreground *foreground
56 ;; -geometry .geometry
59 ;; -reverse *reverseVideo
61 ;; -selectionTimeout .selectionTimeout
62 ;; -synchronous *synchronous
65 ;; An alist of X options and the function which handles them. See
68 (if (not (eq window-system
'mac
))
69 (error "%s: Loading mac-win.el but not compiled for Mac" (invocation-name)))
80 (defvar mac-charset-info-alist
)
81 (defvar mac-services-selection
)
82 (defvar mac-system-script-code
)
83 (defvar x-invocation-args
)
85 (defvar x-command-line-resources nil
)
87 ;; Handler for switches of the form "-switch value" or "-switch".
88 (defun x-handle-switch (switch)
89 (let ((aelt (assoc switch command-line-x-option-alist
)))
91 (let ((param (nth 3 aelt
))
94 (setq default-frame-alist
95 (cons (cons param value
)
97 (setq default-frame-alist
99 (car x-invocation-args
))
101 x-invocation-args
(cdr x-invocation-args
)))))))
103 ;; Handler for switches of the form "-switch n"
104 (defun x-handle-numeric-switch (switch)
105 (let ((aelt (assoc switch command-line-x-option-alist
)))
107 (let ((param (nth 3 aelt
)))
108 (setq default-frame-alist
110 (string-to-number (car x-invocation-args
)))
113 (cdr x-invocation-args
))))))
115 ;; Handle options that apply to initial frame only
116 (defun x-handle-initial-switch (switch)
117 (let ((aelt (assoc switch command-line-x-option-alist
)))
119 (let ((param (nth 3 aelt
))
120 (value (nth 4 aelt
)))
122 (setq initial-frame-alist
123 (cons (cons param value
)
124 initial-frame-alist
))
125 (setq initial-frame-alist
127 (car x-invocation-args
))
129 x-invocation-args
(cdr x-invocation-args
)))))))
131 ;; Make -iconic apply only to the initial frame!
132 (defun x-handle-iconic (switch)
133 (setq initial-frame-alist
134 (cons '(visibility . icon
) initial-frame-alist
)))
136 ;; Handle the -xrm option.
137 (defun x-handle-xrm-switch (switch)
138 (unless (consp x-invocation-args
)
139 (error "%s: missing argument to `%s' option" (invocation-name) switch
))
140 (setq x-command-line-resources
141 (if (null x-command-line-resources
)
142 (car x-invocation-args
)
143 (concat x-command-line-resources
"\n" (car x-invocation-args
))))
144 (setq x-invocation-args
(cdr x-invocation-args
)))
146 ;; Handle the geometry option
147 (defun x-handle-geometry (switch)
148 (let* ((geo (x-parse-geometry (car x-invocation-args
)))
149 (left (assq 'left geo
))
150 (top (assq 'top geo
))
151 (height (assq 'height geo
))
152 (width (assq 'width geo
)))
153 (if (or height width
)
154 (setq default-frame-alist
155 (append default-frame-alist
157 (if height
(list height
))
158 (if width
(list width
)))
160 (append initial-frame-alist
162 (if height
(list height
))
163 (if width
(list width
)))))
165 (setq initial-frame-alist
166 (append initial-frame-alist
167 '((user-position . t
))
168 (if left
(list left
))
169 (if top
(list top
)))))
170 (setq x-invocation-args
(cdr x-invocation-args
))))
172 ;; Handle the -name option. Set the variable x-resource-name
173 ;; to the option's operand; set the name of
174 ;; the initial frame, too.
175 (defun x-handle-name-switch (switch)
176 (or (consp x-invocation-args
)
177 (error "%s: missing argument to `%s' option" (invocation-name) switch
))
178 (setq x-resource-name
(car x-invocation-args
)
179 x-invocation-args
(cdr x-invocation-args
))
180 (setq initial-frame-alist
(cons (cons 'name x-resource-name
)
181 initial-frame-alist
)))
183 (defvar x-display-name nil
184 "The display name specifying server and frame.")
186 (defun x-handle-display (switch)
187 (setq x-display-name
(car x-invocation-args
)
188 x-invocation-args
(cdr x-invocation-args
)))
190 (defun x-handle-args (args)
191 "Process the X-related command line options in ARGS.
192 This is done before the user's startup file is loaded. They are copied to
193 `x-invocation-args', from which the X-related things are extracted, first
194 the switch (e.g., \"-fg\") in the following code, and possible values
195 \(e.g., \"black\") in the option handler code (e.g., x-handle-switch).
196 This function returns ARGS minus the arguments that have been processed."
197 ;; We use ARGS to accumulate the args that we don't handle here, to return.
198 (setq x-invocation-args args
200 (while (and x-invocation-args
201 (not (equal (car x-invocation-args
) "--")))
202 (let* ((this-switch (car x-invocation-args
))
203 (orig-this-switch this-switch
)
204 completion argval aelt handler
)
205 (setq x-invocation-args
(cdr x-invocation-args
))
206 ;; Check for long options with attached arguments
207 ;; and separate out the attached option argument into argval.
208 (if (string-match "^--[^=]*=" this-switch
)
209 (setq argval
(substring this-switch
(match-end 0))
210 this-switch
(substring this-switch
0 (1- (match-end 0)))))
211 ;; Complete names of long options.
212 (if (string-match "^--" this-switch
)
214 (setq completion
(try-completion this-switch command-line-x-option-alist
))
215 (if (eq completion t
)
216 ;; Exact match for long option.
218 (if (stringp completion
)
219 (let ((elt (assoc completion command-line-x-option-alist
)))
220 ;; Check for abbreviated long option.
222 (error "Option `%s' is ambiguous" this-switch
))
223 (setq this-switch completion
))))))
224 (setq aelt
(assoc this-switch command-line-x-option-alist
))
225 (if aelt
(setq handler
(nth 2 aelt
)))
228 (let ((x-invocation-args
229 (cons argval x-invocation-args
)))
230 (funcall handler this-switch
))
231 (funcall handler this-switch
))
232 (setq args
(cons orig-this-switch args
)))))
233 (nconc (nreverse args
) x-invocation-args
))
237 ;; Standard Mac cursor shapes
240 (defconst mac-pointer-arrow
0)
241 (defconst mac-pointer-copy-arrow
1)
242 (defconst mac-pointer-alias-arrow
2)
243 (defconst mac-pointer-contextual-menu-arrow
3)
244 (defconst mac-pointer-I-beam
4)
245 (defconst mac-pointer-cross
5)
246 (defconst mac-pointer-plus
6)
247 (defconst mac-pointer-watch
7)
248 (defconst mac-pointer-closed-hand
8)
249 (defconst mac-pointer-open-hand
9)
250 (defconst mac-pointer-pointing-hand
10)
251 (defconst mac-pointer-counting-up-hand
11)
252 (defconst mac-pointer-counting-down-hand
12)
253 (defconst mac-pointer-counting-up-and-down-hand
13)
254 (defconst mac-pointer-spinning
14)
255 (defconst mac-pointer-resize-left
15)
256 (defconst mac-pointer-resize-right
16)
257 (defconst mac-pointer-resize-left-right
17)
258 ;; Mac OS X 10.2 and later
259 (defconst mac-pointer-not-allowed
18)
260 ;; Mac OS X 10.3 and later
261 (defconst mac-pointer-resize-up
19)
262 (defconst mac-pointer-resize-down
20)
263 (defconst mac-pointer-resize-up-down
21)
264 (defconst mac-pointer-poof
22)
267 ;; Standard X cursor shapes that have Mac counterparts
270 (defconst x-pointer-left-ptr mac-pointer-arrow
)
271 (defconst x-pointer-xterm mac-pointer-I-beam
)
272 (defconst x-pointer-crosshair mac-pointer-cross
)
273 (defconst x-pointer-plus mac-pointer-plus
)
274 (defconst x-pointer-watch mac-pointer-watch
)
275 (defconst x-pointer-hand2 mac-pointer-pointing-hand
)
276 (defconst x-pointer-left-side mac-pointer-resize-left
)
277 (defconst x-pointer-right-side mac-pointer-resize-right
)
278 (defconst x-pointer-sb-h-double-arrow mac-pointer-resize-left-right
)
279 (defconst x-pointer-top-side mac-pointer-resize-up
)
280 (defconst x-pointer-bottom-side mac-pointer-resize-down
)
281 (defconst x-pointer-sb-v-double-arrow mac-pointer-resize-up-down
)
288 (defvar x-colors
'("LightGreen"
887 "LightGoldenrodYellow"
888 "light goldenrod yellow"
905 "medium spring green"
1040 "The list of X colors from the `rgb.txt' file.
1041 XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
1043 (defun xw-defined-colors (&optional frame
)
1044 "Internal function called by `defined-colors', which see."
1045 (or frame
(setq frame
(selected-frame)))
1046 (let ((all-colors x-colors
)
1048 (defined-colors nil
))
1050 (setq this-color
(car all-colors
)
1051 all-colors
(cdr all-colors
))
1052 (and (color-supported-p this-color frame t
)
1053 (setq defined-colors
(cons this-color defined-colors
))))
1058 (substitute-key-definition 'suspend-emacs
'iconify-or-deiconify-frame
1061 ;; Map certain keypad keys into ASCII characters
1062 ;; that people usually expect.
1063 (define-key function-key-map
[backspace] [?\d])
1064 (define-key function-key-map [delete] [?\d])
1065 (define-key function-key-map [tab] [?\t])
1066 (define-key function-key-map [linefeed] [?\n])
1067 (define-key function-key-map [clear] [?\C-l])
1068 (define-key function-key-map [return] [?\C-m])
1069 (define-key function-key-map [escape] [?\e])
1070 (define-key function-key-map [M-backspace] [?\M-\d])
1071 (define-key function-key-map [M-delete] [?\M-\d])
1072 (define-key function-key-map [M-tab] [?\M-\t])
1073 (define-key function-key-map [M-linefeed] [?\M-\n])
1074 (define-key function-key-map [M-clear] [?\M-\C-l])
1075 (define-key function-key-map [M-return] [?\M-\C-m])
1076 (define-key function-key-map [M-escape] [?\M-\e])
1078 ;; These tell read-char how to convert
1079 ;; these special chars to ASCII.
1080 (put 'backspace 'ascii-character ?\d)
1081 (put 'delete 'ascii-character ?\d)
1082 (put 'tab 'ascii-character ?\t)
1083 (put 'linefeed 'ascii-character ?\n)
1084 (put 'clear 'ascii-character ?\C-l)
1085 (put 'return 'ascii-character ?\C-m)
1086 (put 'escape 'ascii-character ?\e)
1089 ;;;; Script codes and coding systems
1090 (defconst mac-script-code-coding-systems
1091 '((0 . mac-roman) ; smRoman
1092 (1 . japanese-shift-jis) ; smJapanese
1093 (2 . chinese-big5) ; smTradChinese
1094 (3 . korean-iso-8bit) ; smKorean
1095 (7 . mac-cyrillic) ; smCyrillic
1096 (25 . chinese-iso-8bit) ; smSimpChinese
1097 (29 . mac-centraleurroman) ; smCentralEuroRoman
1099 "Alist of Mac script codes vs Emacs coding systems.")
1101 (defconst mac-system-coding-system
1102 (let ((base (or (cdr (assq mac-system-script-code
1103 mac-script-code-coding-systems))
1105 (if (eq system-type 'darwin)
1107 (coding-system-change-eol-conversion base 'mac)))
1108 "Coding system derived from the system script code.")
1110 (defun mac-add-charset-info (xlfd-charset mac-text-encoding)
1111 "Add a character set to display with Mac fonts.
1112 Create an entry in `mac-charset-info-alist'.
1113 XLFD-CHARSET is a string which will appear in the XLFD font name
1114 to identify the character set. MAC-TEXT-ENCODING is the
1115 correspoinding TextEncodingBase value."
1116 (add-to-list 'mac-charset-info-alist
1117 (list xlfd-charset mac-text-encoding
1118 (cdr (assq mac-text-encoding
1119 mac-script-code-coding-systems)))))
1121 (setq mac-charset-info-alist nil)
1122 (mac-add-charset-info "mac-roman" 0)
1123 (mac-add-charset-info "jisx0208.1983-sjis" 1)
1124 (mac-add-charset-info "jisx0201.1976-0" 1)
1125 (mac-add-charset-info "big5-0" 2)
1126 (mac-add-charset-info "ksc5601.1989-0" 3)
1127 (mac-add-charset-info "mac-cyrillic" 7)
1128 (mac-add-charset-info "gb2312.1980-0" 25)
1129 (mac-add-charset-info "mac-centraleurroman" 29)
1130 (mac-add-charset-info "mac-symbol" 33)
1131 (mac-add-charset-info "adobe-fontspecific" 33) ; for X-Symbol
1132 (mac-add-charset-info "mac-dingbats" 34)
1133 (mac-add-charset-info "iso10646-1" 126) ; for ATSUI
1136 ;;;; Keyboard layout/language change events
1137 (defun mac-handle-language-change (event)
1139 (let ((coding-system
1140 (cdr (assq (car (cadr event)) mac-script-code-coding-systems))))
1141 (set-keyboard-coding-system (or coding-system 'mac-roman))
1142 ;; MacJapanese maps reverse solidus to ?\x80.
1143 (if (eq coding-system 'japanese-shift-jis)
1144 (define-key key-translation-map [?\x80] "\\"))))
1146 (define-key special-event-map [language-change] 'mac-handle-language-change)
1148 ;;;; Selections and Services menu
1150 ;; Setup to use the Mac clipboard.
1151 (set-selection-coding-system mac-system-coding-system)
1153 ;;; We keep track of the last text selected here, so we can check the
1154 ;;; current selection against it, and avoid passing back our own text
1155 ;;; from x-get-selection-value.
1156 (defvar x-last-selected-text-clipboard nil
1157 "The value of the CLIPBOARD selection last time we selected or
1159 (defvar x-last-selected-text-primary nil
1160 "The value of the PRIMARY X selection last time we selected or
1163 (defcustom x-select-enable-clipboard t
1164 "*Non-nil means cutting and pasting uses the clipboard.
1165 This is in addition to the primary selection."
1169 ;;; Make TEXT, a string, the primary X selection.
1170 (defun x-select-text (text &optional push)
1171 (x-set-selection 'PRIMARY text)
1172 (setq x-last-selected-text-primary text)
1173 (if (not x-select-enable-clipboard)
1174 (setq x-last-selected-text-clipboard nil)
1175 (x-set-selection 'CLIPBOARD text)
1176 (setq x-last-selected-text-clipboard text))
1179 (defun x-get-selection (&optional type data-type)
1180 "Return the value of a selection.
1181 The argument TYPE (default `PRIMARY') says which selection,
1182 and the argument DATA-TYPE (default `STRING') says
1183 how to convert the data.
1185 TYPE may be any symbol \(but nil stands for `PRIMARY'). However,
1186 only a few symbols are commonly used. They conventionally have
1187 all upper-case names. The most often used ones, in addition to
1188 `PRIMARY', are `SECONDARY' and `CLIPBOARD'.
1190 DATA-TYPE is usually `STRING', but can also be one of the symbols
1191 in `selection-converter-alist', which see."
1192 (let ((data (x-get-selection-internal (or type 'PRIMARY)
1193 (or data-type 'STRING)))
1194 (coding (or next-selection-coding-system
1195 selection-coding-system)))
1196 (when (and (stringp data)
1197 (setq data-type (get-text-property 0 'foreign-selection data)))
1198 (cond ((eq data-type 'public.utf16-plain-text)
1199 (if (fboundp 'mac-code-convert-string)
1200 (let ((s (mac-code-convert-string data nil coding)))
1202 (setq data (decode-coding-string s coding))
1204 ;; (decode-coding-string data 'utf-16) is
1205 ;; not correct because
1206 ;; public.utf16-plain-text is defined as
1207 ;; native byte order, no BOM.
1208 (decode-coding-string
1209 (mac-code-convert-string data nil 'utf-8)
1211 ;; No `mac-code-convert-string' means non-Carbon, which
1212 ;; implies big endian.
1213 (setq data (decode-coding-string data 'utf-16be))))
1214 ((eq data-type 'com.apple.traditional-mac-plain-text)
1215 (setq data (decode-coding-string data coding)))
1216 ((eq data-type 'public.file-url)
1217 (setq data (decode-coding-string data 'utf-8))
1218 ;; Remove a trailing nul character.
1219 (let ((len (length data)))
1220 (if (and (> len 0) (= (aref data (1- len)) ?\0))
1221 (setq data (substring data 0 (1- len)))))))
1222 (put-text-property 0 (length data) 'foreign-selection data-type data))
1225 (defun x-selection-value (type)
1226 (let ((data-types '(public.utf16-plain-text
1227 com.apple.traditional-mac-plain-text
1230 (while (and (null text) data-types)
1231 (setq text (condition-case nil
1232 (x-get-selection type (car data-types))
1234 (setq data-types (cdr data-types)))
1236 (remove-text-properties 0 (length text) '(foreign-selection nil) text))
1237 (setq tiff-image (condition-case nil
1238 (x-get-selection type 'public.tiff)
1241 (remove-text-properties 0 (length tiff-image)
1242 '(foreign-selection nil) tiff-image)
1243 (setq tiff-image (create-image tiff-image 'tiff t))
1244 (or text (setq text " "))
1245 (put-text-property 0 (length text) 'display tiff-image text))
1248 ;;; Return the value of the current selection.
1249 ;;; Treat empty strings as if they were unset.
1250 ;;; If this function is called twice and finds the same text,
1251 ;;; it returns nil the second time. This is so that a single
1252 ;;; selection won't be added to the kill ring over and over.
1253 (defun x-get-selection-value ()
1254 (let (clip-text primary-text)
1255 (if (not x-select-enable-clipboard)
1256 (setq x-last-selected-text-clipboard nil)
1257 (setq clip-text (x-selection-value 'CLIPBOARD))
1258 (if (string= clip-text "") (setq clip-text nil))
1260 ;; Check the CLIPBOARD selection for 'newness', is it different
1261 ;; from what we remebered them to be last time we did a
1262 ;; cut/paste operation.
1264 (cond;; check clipboard
1265 ((or (not clip-text) (string= clip-text ""))
1266 (setq x-last-selected-text-clipboard nil))
1267 ((eq clip-text x-last-selected-text-clipboard) nil)
1268 ((string= clip-text x-last-selected-text-clipboard)
1269 ;; Record the newer string,
1270 ;; so subsequent calls can use the `eq' test.
1271 (setq x-last-selected-text-clipboard clip-text)
1274 (setq x-last-selected-text-clipboard clip-text))))
1277 (setq primary-text (x-selection-value 'PRIMARY))
1278 ;; Check the PRIMARY selection for 'newness', is it different
1279 ;; from what we remebered them to be last time we did a
1280 ;; cut/paste operation.
1282 (cond;; check primary selection
1283 ((or (not primary-text) (string= primary-text ""))
1284 (setq x-last-selected-text-primary nil))
1285 ((eq primary-text x-last-selected-text-primary) nil)
1286 ((string= primary-text x-last-selected-text-primary)
1287 ;; Record the newer string,
1288 ;; so subsequent calls can use the `eq' test.
1289 (setq x-last-selected-text-primary primary-text)
1292 (setq x-last-selected-text-primary primary-text))))
1294 ;; As we have done one selection, clear this now.
1295 (setq next-selection-coding-system nil)
1297 ;; At this point we have recorded the current values for the
1298 ;; selection from clipboard (if we are supposed to) and primary,
1299 ;; So return the first one that has changed (which is the first
1301 (or clip-text primary-text)
1304 (put 'CLIPBOARD 'mac-scrap-name "com.apple.scrap.clipboard")
1305 (when (eq system-type 'darwin)
1306 (put 'FIND 'mac-scrap-name "com.apple.scrap.find")
1307 (put 'PRIMARY 'mac-scrap-name
1308 (format "org.gnu.Emacs.%d.selection.PRIMARY" (emacs-pid))))
1309 (put 'com.apple.traditional-mac-plain-text 'mac-ostype "TEXT")
1310 (put 'public.utf16-plain-text 'mac-ostype "utxt")
1311 (put 'public.tiff 'mac-ostype "TIFF")
1312 (put 'public.file-url 'mac-ostype "furl")
1314 (defun mac-select-convert-to-string (selection type value)
1315 (let ((str (cdr (xselect-convert-to-string selection nil value)))
1317 (setq coding (or next-selection-coding-system selection-coding-system))
1319 (setq coding (coding-system-base coding))
1320 (setq coding 'raw-text))
1322 ;; If TYPE is nil, this is a local request, thus return STR as
1323 ;; is. Otherwise, encode STR.
1326 (let ((inhibit-read-only t))
1327 (remove-text-properties 0 (length str) '(composition nil) str)
1329 ((eq type 'public.utf16-plain-text)
1330 (if (fboundp 'mac-code-convert-string)
1332 (when (memq coding (find-coding-systems-string str))
1334 (coding-system-change-eol-conversion coding 'mac))
1335 (setq s (mac-code-convert-string
1336 (encode-coding-string str coding)
1339 ;; (encode-coding-string str
1340 ;; 'utf-16-mac) is not correct because
1341 ;; public.utf16-plain-text is defined
1342 ;; as native byte order, no BOM.
1343 (mac-code-convert-string
1344 (encode-coding-string str 'utf-8-mac)
1346 ;; No `mac-code-convert-string' means non-Carbon, which
1347 ;; implies big endian.
1348 (setq str (encode-coding-string str 'utf-16be-mac))))
1349 ((eq type 'com.apple.traditional-mac-plain-text)
1350 (let ((encodables (find-coding-systems-string str))
1351 (rest mac-script-code-coding-systems))
1352 (unless (memq coding encodables)
1353 (while (and rest (not (memq (cdar rest) encodables)))
1354 (setq rest (cdr rest)))
1356 (setq coding (cdar rest)))))
1357 (setq coding (coding-system-change-eol-conversion coding 'mac))
1358 (setq str (encode-coding-string str coding)))
1360 (error "Unknown selection type: %S" type))
1363 (setq next-selection-coding-system nil)
1366 (defun mac-select-convert-to-file-url (selection type value)
1367 (let ((filename (xselect-convert-to-filename selection type value))
1368 (coding (or file-name-coding-system default-file-name-coding-system)))
1369 (if (and filename coding)
1370 (setq filename (encode-coding-string filename coding)))
1372 (concat "file://localhost"
1373 (mapconcat 'url-hexify-string
1374 (split-string filename "/") "/")))))
1376 (setq selection-converter-alist
1378 '((public.utf16-plain-text . mac-select-convert-to-string)
1379 (com.apple.traditional-mac-plain-text . mac-select-convert-to-string)
1380 ;; This is not enabled by default because the `Import Image'
1381 ;; menu makes Emacs crash or hang for unknown reasons.
1382 ;; (public.tiff . nil)
1383 (public.file-url . mac-select-convert-to-file-url)
1385 selection-converter-alist))
1387 (defun mac-services-open-file ()
1389 (find-file-existing (x-selection-value mac-services-selection)))
1391 (defun mac-services-open-selection ()
1393 (switch-to-buffer (generate-new-buffer "*untitled*"))
1394 (insert (x-selection-value mac-services-selection))
1396 (save-buffer) ; It pops up the save dialog.
1399 (defun mac-services-mail-selection ()
1404 (insert (x-selection-value mac-services-selection) "\n"))
1406 (defun mac-services-mail-to ()
1408 (compose-mail (x-selection-value mac-services-selection)))
1410 (defun mac-services-insert-text ()
1412 (let ((text (x-selection-value mac-services-selection)))
1413 (if (not buffer-read-only)
1417 (substitute-command-keys
1418 "The text from the Services menu can be accessed with \\[yank]")))))
1420 (defvar mac-application-menu-map (make-sparse-keymap))
1421 (define-key mac-application-menu-map [quit] 'save-buffers-kill-emacs)
1422 (define-key mac-application-menu-map [services perform open-file]
1423 'mac-services-open-file)
1424 (define-key mac-application-menu-map [services perform open-selection]
1425 'mac-services-open-selection)
1426 (define-key mac-application-menu-map [services perform mail-selection]
1427 'mac-services-mail-selection)
1428 (define-key mac-application-menu-map [services perform mail-to]
1429 'mac-services-mail-to)
1430 (define-key mac-application-menu-map [services paste]
1431 'mac-services-insert-text)
1432 (define-key mac-application-menu-map [preferences] 'customize)
1433 (define-key mac-application-menu-map [about] 'display-splash-screen)
1434 (global-set-key [menu-bar application] mac-application-menu-map)
1436 ;;; Do the actual Windows setup here; the above code just defines
1437 ;;; functions and variables that we use now.
1439 (setq command-line-args (x-handle-args command-line-args))
1441 ;;; Make sure we have a valid resource name.
1442 (or (stringp x-resource-name)
1444 (setq x-resource-name (invocation-name))
1446 ;; Change any . or * characters in x-resource-name to hyphens,
1447 ;; so as not to choke when we use it in X resource queries.
1448 (while (setq i (string-match "[.*]" x-resource-name))
1449 (aset x-resource-name i ?-))))
1451 (if (x-display-list)
1452 ;; On Mac OS 8/9, Most coding systems used in code conversion for
1453 ;; font names are not ready at the time when the terminal frame is
1454 ;; created. So we reconstruct font name table for the initial
1456 (mac-clear-font-name-table)
1457 (x-open-connection "Mac"
1458 x-command-line-resources
1459 ;; Exit Emacs with fatal error if this fails.
1462 (setq frame-creation-function 'x-create-frame-with-faces)
1464 (define-charset 'mac-centraleurroman
1465 "Mac Central European Roman"
1466 :short-name "Mac CE"
1467 :ascii-compatible-p t
1471 [?\Ä ?\Ā ?\ā ?\É ?\Ą ?\Ö ?\Ü ?\á ?\ą ?\Č ?\ä ?\č ?\Ć ?\ć ?\é ?\Ź
1472 ?\ź ?\Ď ?\í ?\ď ?\Ē ?\ē ?\Ė ?\ó ?\ė ?\ô ?\ö ?\õ ?\ú ?\Ě ?\ě ?\ü
1473 ?\† ?\° ?\Ę ?\£ ?\§ ?\• ?\¶ ?\ß ?\® ?\© ?\™ ?\ę ?\¨ ?\≠ ?\ģ ?\Į
1474 ?\į ?\Ī ?\≤ ?\≥ ?\ī ?\Ķ ?\∂ ?\∑ ?\ł ?\Ļ ?\ļ ?\Ľ ?\ľ ?\Ĺ ?\ĺ ?\Ņ
1475 ?\ņ ?\Ń ?\¬ ?\√ ?\ń ?\Ň ?\∆ ?\« ?\» ?\… ?\ ?\ň ?\Ő ?\Õ ?\ő ?\Ō
1476 ?\– ?\— ?\“ ?\” ?\‘ ?\’ ?\÷ ?\◊ ?\ō ?\Ŕ ?\ŕ ?\Ř ?\‹ ?\› ?\ř ?\Ŗ
1477 ?\ŗ ?\Š ?\‚ ?\„ ?\š ?\Ś ?\ś ?\Á ?\Ť ?\ť ?\Í ?\Ž ?\ž ?\Ū ?\Ó ?\Ô
1478 ?\ū ?\Ů ?\Ú ?\ů ?\Ű ?\ű ?\Ų ?\ų ?\Ý ?\ý ?\ķ ?\Ż ?\Ł ?\ż ?\Ģ ?\ˇ])
1479 (map (make-vector 512 nil)))
1480 (or (= (length tbl) 128)
1481 (error "Invalid vector length: %d" (length tbl)))
1483 (aset map (* i 2) i)
1484 (aset map (1+ (* i 2)) i))
1486 (aset map (+ 256 (* i 2)) (+ 128 i))
1487 (aset map (+ 256 (1+ (* i 2))) (aref tbl i)))
1490 (define-coding-system 'mac-centraleurroman
1491 "Mac Central European Roman Encoding (MIME:x-mac-centraleurroman)."
1492 :coding-type 'charset
1494 :charset-list '(mac-centraleurroman)
1495 :mime-charset 'x-mac-centraleurroman)
1497 (define-charset 'mac-cyrillic
1499 :short-name "Mac CYRILLIC"
1500 :ascii-compatible-p t
1504 [?\А ?\Б ?\В ?\Г ?\Д ?\Е ?\Ж ?\З ?\И ?\Й ?\К ?\Л ?\М ?\Н ?\О ?\П
1505 ?\Р ?\С ?\Т ?\У ?\Ф ?\Х ?\Ц ?\Ч ?\Ш ?\Щ ?\Ъ ?\Ы ?\Ь ?\Э ?\Ю ?\Я
1506 ?\† ?\° ?\Ґ ?\£ ?\§ ?\• ?\¶ ?\І ?\® ?\© ?\™ ?\Ђ ?\ђ ?\≠ ?\Ѓ ?\ѓ
1507 ?\∞ ?\± ?\≤ ?\≥ ?\і ?\µ ?\ґ ?\Ј ?\Є ?\є ?\Ї ?\ї ?\Љ ?\љ ?\Њ ?\њ
1508 ?\ј ?\Ѕ ?\¬ ?\√ ?\ƒ ?\≈ ?\∆ ?\« ?\» ?\… ?\ ?\Ћ ?\ћ ?\Ќ ?\ќ ?\ѕ
1509 ?\– ?\— ?\“ ?\” ?\‘ ?\’ ?\÷ ?\„ ?\Ў ?\ў ?\Џ ?\џ ?\№ ?\Ё ?\ё ?\я
1510 ?\а ?\б ?\в ?\г ?\д ?\е ?\ж ?\з ?\и ?\й ?\к ?\л ?\м ?\н ?\о ?\п
1511 ?\р ?\с ?\т ?\у ?\ф ?\х ?\ц ?\ч ?\ш ?\щ ?\ъ ?\ы ?\ь ?\э ?\ю ?\€])
1512 (map (make-vector 512 nil)))
1513 (or (= (length tbl) 128)
1514 (error "Invalid vector length: %d" (length tbl)))
1516 (aset map (* i 2) i)
1517 (aset map (1+ (* i 2)) i))
1519 (aset map (+ 256 (* i 2)) (+ 128 i))
1520 (aset map (+ 256 (1+ (* i 2))) (aref tbl i)))
1523 (define-coding-system 'mac-cyrillic
1524 "Mac Cyrillic Encoding (MIME:x-mac-cyrillic)."
1525 :coding-type 'charset
1527 :charset-list '(mac-cyrillic)
1528 :mime-charset 'x-mac-cyrillic)
1530 (define-charset 'mac-symbol
1532 :short-name "Mac SYMBOL"
1533 :code-space [32 254]
1536 [?\ ?\! ?\∀ ?\# ?\∃ ?\% ?\& ?\∍ ?\( ?\) ?\∗ ?\+ ?\, ?\− ?\. ?\/
1537 ?\0 ?\1 ?\2 ?\3 ?\4 ?\5 ?\6 ?\7 ?\8 ?\9 ?\: ?\; ?\< ?\= ?\> ?\?
1538 ?\≅ ?\Α ?\Β ?\Χ ?\Δ ?\Ε ?\Φ ?\Γ ?\Η ?\Ι ?\ϑ ?\Κ ?\Λ ?\Μ ?\Ν ?\Ο
1539 ?\Π ?\Θ ?\Ρ ?\Σ ?\Τ ?\Υ ?\ς ?\Ω ?\Ξ ?\Ψ ?\Ζ ?\[ ?\∴ ?\] ?\⊥ ?\_
1540 ?\ ?\α ?\β ?\χ ?\δ ?\ε ?\φ ?\γ ?\η ?\ι ?\ϕ ?\κ ?\λ ?\μ ?\ν ?\ο
1541 ?\π ?\θ ?\ρ ?\σ ?\τ ?\υ ?\ϖ ?\ω ?\ξ ?\ψ ?\ζ ?\{ ?\| ?\} ?\∼])
1542 (map-32-126 (make-vector (* (1+ (- 126 32)) 2) nil))
1544 ;; Mapping of the following characters are changed from the
1546 ;; 0xE2 0x00AE+0xF87F->0x00AE # REGISTERED SIGN, alternate: sans serif
1547 ;; 0xE3 0x00A9+0xF87F->0x00A9 # COPYRIGHT SIGN, alternate: sans serif
1548 ;; 0xE4 0x2122+0xF87F->0x2122 # TRADE MARK SIGN, alternate: sans serif
1549 [?\€ ?\ϒ ?\′ ?\≤ ?\⁄ ?\∞ ?\ƒ ?\♣ ?\♦ ?\♥ ?\♠ ?\↔ ?\← ?\↑ ?\→ ?\↓
1550 ?\° ?\± ?\″ ?\≥ ?\× ?\∝ ?\∂ ?\• ?\÷ ?\≠ ?\≡ ?\≈ ?\… ?\⏐ ?\⎯ ?\↵
1551 ?\ℵ ?\ℑ ?\ℜ ?\℘ ?\⊗ ?\⊕ ?\∅ ?\∩ ?\∪ ?\⊃ ?\⊇ ?\⊄ ?\⊂ ?\⊆ ?\∈ ?\∉
1552 ?\∠ ?\∇ ?\® ?\© ?\™ ?\∏ ?\√ ?\⋅ ?\¬ ?\∧ ?\∨ ?\⇔ ?\⇐ ?\⇑ ?\⇒ ?\⇓
1553 ?\◊ ?\〈 ?\® ?\© ?\™ ?\∑ ?\⎛ ?\⎜ ?\⎝ ?\⎡ ?\⎢ ?\⎣ ?\⎧ ?\⎨ ?\⎩ ?\⎪
1554 ?\ ?\〉 ?\∫ ?\⌠ ?\⎮ ?\⌡ ?\⎞ ?\⎟ ?\⎠ ?\⎤ ?\⎥ ?\⎦ ?\⎫ ?\⎬ ?\⎭])
1555 (map-160-254 (make-vector (* (1+ (- 254 160)) 2) nil)))
1556 (dotimes (i (1+ (- 126 32)))
1557 (aset map-32-126 (* i 2) (+ 32 i))
1558 (aset map-32-126 (1+ (* i 2)) (aref tbl-32-126 i)))
1559 (dotimes (i (1+ (- 254 160)))
1560 (aset map-160-254 (* i 2) (+ 160 i))
1561 (aset map-160-254 (1+ (* i 2)) (aref tbl-160-254 i)))
1562 (vconcat map-32-126 map-160-254)))
1564 (define-charset 'mac-dingbats
1566 :short-name "Mac Dingbats"
1567 :code-space [32 254]
1570 [?\ ?\✁ ?\✂ ?\✃ ?\✄ ?\☎ ?\✆ ?\✇ ?\✈ ?\✉ ?\☛ ?\☞ ?\✌ ?\✍ ?\✎ ?\✏
1571 ?\✐ ?\✑ ?\✒ ?\✓ ?\✔ ?\✕ ?\✖ ?\✗ ?\✘ ?\✙ ?\✚ ?\✛ ?\✜ ?\✝ ?\✞ ?\✟
1572 ?\✠ ?\✡ ?\✢ ?\✣ ?\✤ ?\✥ ?\✦ ?\✧ ?\★ ?\✩ ?\✪ ?\✫ ?\✬ ?\✭ ?\✮ ?\✯
1573 ?\✰ ?\✱ ?\✲ ?\✳ ?\✴ ?\✵ ?\✶ ?\✷ ?\✸ ?\✹ ?\✺ ?\✻ ?\✼ ?\✽ ?\✾ ?\✿
1574 ?\❀ ?\❁ ?\❂ ?\❃ ?\❄ ?\❅ ?\❆ ?\❇ ?\❈ ?\❉ ?\❊ ?\❋ ?\● ?\❍ ?\■ ?\❏
1575 ?\❐ ?\❑ ?\❒ ?\▲ ?\▼ ?\◆ ?\❖ ?\◗ ?\❘ ?\❙ ?\❚ ?\❛ ?\❜ ?\❝ ?\❞])
1576 (map-32-126 (make-vector (* (1+ (- 126 32)) 2) nil))
1578 [?\❨ ?\❩ ?\❪ ?\❫ ?\❬ ?\❭ ?\❮ ?\❯ ?\❰ ?\❱ ?\❲ ?\❳ ?\❴ ?\❵])
1579 (map-128-141 (make-vector (* (1+ (- 141 128)) 2) nil))
1581 [?\❡ ?\❢ ?\❣ ?\❤ ?\❥ ?\❦ ?\❧ ?\♣ ?\♦ ?\♥ ?\♠ ?\① ?\② ?\③ ?\④
1582 ?\⑤ ?\⑥ ?\⑦ ?\⑧ ?\⑨ ?\⑩ ?\❶ ?\❷ ?\❸ ?\❹ ?\❺ ?\❻ ?\❼ ?\❽ ?\❾ ?\❿
1583 ?\➀ ?\➁ ?\➂ ?\➃ ?\➄ ?\➅ ?\➆ ?\➇ ?\➈ ?\➉ ?\➊ ?\➋ ?\➌ ?\➍ ?\➎ ?\➏
1584 ?\➐ ?\➑ ?\➒ ?\➓ ?\➔ ?\→ ?\↔ ?\↕ ?\➘ ?\➙ ?\➚ ?\➛ ?\➜ ?\➝ ?\➞ ?\➟
1585 ?\➠ ?\➡ ?\➢ ?\➣ ?\➤ ?\➥ ?\➦ ?\➧ ?\➨ ?\➩ ?\➪ ?\➫ ?\➬ ?\➭ ?\➮ ?\➯])
1586 (map-161-239 (make-vector (* (1+ (- 239 161)) 2) nil))
1588 [?\➱ ?\➲ ?\➳ ?\➴ ?\➵ ?\➶ ?\➷ ?\➸ ?\➹ ?\➺ ?\➻ ?\➼ ?\➽ ?\➾])
1589 (map-241-254 (make-vector (* (1+ (- 254 241)) 2) nil)))
1590 (dotimes (i (1+ (- 126 32)))
1591 (aset map-32-126 (* i 2) (+ 32 i))
1592 (aset map-32-126 (1+ (* i 2)) (aref tbl-32-126 i)))
1593 (dotimes (i (1+ (- 141 128)))
1594 (aset map-128-141 (* i 2) (+ 128 i))
1595 (aset map-128-141 (1+ (* i 2)) (aref tbl-128-141 i)))
1596 (dotimes (i (1+ (- 239 161)))
1597 (aset map-161-239 (* i 2) (+ 161 i))
1598 (aset map-161-239 (1+ (* i 2)) (aref tbl-161-239 i)))
1599 (dotimes (i (1+ (- 254 241)))
1600 (aset map-241-254 (* i 2) (+ 241 i))
1601 (aset map-241-254 (1+ (* i 2)) (aref tbl-241-254 i)))
1602 (vconcat map-32-126 map-128-141 map-161-239 map-241-254)))
1604 (setq font-encoding-alist
1606 '(("mac-roman" . mac-roman)
1607 ("mac-centraleurroman" . mac-centraleurroman)
1608 ("mac-cyrillic" . mac-cyrillic)
1609 ("mac-symbol" . mac-symbol)
1610 ("mac-dingbats" . mac-dingbats))
1611 font-encoding-alist))
1613 (defun fontset-add-mac-fonts (fontset &optional base-family)
1614 (dolist (elt `((latin . (,(or base-family "Monaco") . "mac-roman"))
1615 (mac-roman . (,base-family . "mac-roman"))
1616 (mac-centraleurroman . (,base-family . "mac-centraleurroman"))
1617 (mac-cyrillic . (,base-family . "mac-cyrillic"))
1618 (mac-symbol . (,base-family . "mac-symbol"))
1619 (mac-dingbats . (,base-family . "mac-dingbats"))))
1620 (set-fontset-font fontset (car elt) (cdr elt))))
1622 (defun create-fontset-from-mac-roman-font (font &optional resolved-font
1624 "Create a fontset from a Mac roman font FONT.
1626 Optional 1st arg RESOLVED-FONT is a resolved name of FONT. If
1627 omitted, `x-resolve-font-name' is called to get the resolved name. At
1628 this time, if FONT is not available, error is signaled.
1630 Optional 2nd arg FONTSET-NAME is a string to be used in
1631 `<CHARSET_ENCODING>' fields of a new fontset name. If it is omitted,
1632 an appropriate name is generated automatically.
1634 It returns a name of the created fontset."
1636 (setq resolved-font (x-resolve-font-name font)))
1637 (let ((base-family (aref (x-decompose-font-name resolved-font)
1638 xlfd-regexp-family-subnum)))
1639 (if (string= base-family "*")
1640 (setq base-family nil))
1641 (new-fontset fontset-name (list (cons 'ascii resolved-font)))
1642 (fontset-add-mac-fonts fontset-name base-family)))
1644 ;; Setup the default fontset.
1645 (setup-default-fontset)
1647 ;; Create a fontset that uses mac-roman font. With this fontset,
1648 ;; characters belonging to mac-roman charset (that contains ASCII and
1649 ;; more Latin characters) are displayed by a mac-roman font.
1650 (create-fontset-from-mac-roman-font
1651 "-*-Monaco-*-*-*-*-12-*-*-*-*-*-mac-roman" nil
1652 "-apple-Monaco-normal-r-*-*-12-*-*-*-*-*-fontset-mac")
1654 ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...).
1655 (create-fontset-from-x-resource)
1657 ;; Apply a geometry resource to the initial frame. Put it at the end
1658 ;; of the alist, so that anything specified on the command line takes
1660 (let* ((res-geometry (x-get-resource "geometry" "Geometry"))
1664 (setq parsed (x-parse-geometry res-geometry))
1665 ;; If the resource specifies a position,
1666 ;; call the position and size "user-specified".
1667 (if (or (assq 'top parsed) (assq 'left parsed))
1668 (setq parsed (cons '(user-position . t)
1669 (cons '(user-size . t) parsed))))
1670 ;; All geometry parms apply to the initial frame.
1671 (setq initial-frame-alist (append initial-frame-alist parsed))
1672 ;; The size parms apply to all frames.
1673 (if (assq 'height parsed)
1674 (setq default-frame-alist
1675 (cons (cons 'height (cdr (assq 'height parsed)))
1676 default-frame-alist)))
1677 (if (assq 'width parsed)
1678 (setq default-frame-alist
1679 (cons (cons 'width (cdr (assq 'width parsed)))
1680 default-frame-alist))))))
1682 ;; Check the reverseVideo resource.
1683 (let ((case-fold-search t))
1684 (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
1686 (string-match "^\\(true\\|yes\\|on\\)$" rv))
1687 (setq default-frame-alist
1688 (cons '(reverse . t) default-frame-alist)))))
1690 (defun x-win-suspend-error ()
1691 (error "Suspending an Emacs running under Mac makes no sense"))
1692 (add-hook 'suspend-hook 'x-win-suspend-error)
1694 ;;; Arrange for the kill and yank functions to set and check the clipboard.
1695 (setq interprogram-cut-function 'x-select-text)
1696 (setq interprogram-paste-function 'x-get-selection-value)
1698 (defalias 'x-cut-buffer-or-selection-value 'x-get-selection-value)
1700 ;;; Turn off window-splitting optimization; Mac is usually fast enough
1701 ;;; that this is only annoying.
1702 (setq split-window-keep-point t)
1704 ;; Don't show the frame name; that's redundant.
1705 (setq-default mode-line-frame-identification " ")
1707 ;; Turn on support for mouse wheels.
1708 (mouse-wheel-mode 1)
1711 ;; Enable CLIPBOARD copy/paste through menu bar commands.
1712 (menu-bar-enable-clipboard)
1714 (defun mac-drag-n-drop (event)
1715 "Edit the files listed in the drag-n-drop EVENT.
1716 Switch to a buffer editing the last file dropped."
1718 ;; Make sure the drop target has positive co-ords
1719 ;; before setting the selected frame - otherwise it
1720 ;; won't work. <skx@tardis.ed.ac.uk>
1721 (let* ((window (posn-window (event-start event)))
1722 (coords (posn-x-y (event-start event)))
1725 (if (and (> x 0) (> y 0))
1726 (set-frame-selected-window nil window))
1727 (mapcar (lambda (file-name)
1728 (if (listp file-name)
1729 (let ((line (car file-name))
1730 (start (car (cdr file-name)))
1731 (end (car (cdr (cdr file-name)))))
1734 (if (and (> start 0) (> end 0))
1735 (progn (set-mark start)
1737 (dnd-handle-one-url window 'private
1738 (concat "file:" file-name))))
1739 (car (cdr (cdr event)))))
1742 (global-set-key [drag-n-drop] 'mac-drag-n-drop)
1744 ;; By checking whether the variable mac-ready-for-drag-n-drop has been
1745 ;; defined, the event loop in macterm.c can be informed that it can
1746 ;; now receive Finder drag and drop events. Files dropped onto the
1747 ;; Emacs application icon can only be processed when the initial frame
1748 ;; has been created: this is where the files should be opened.
1749 (add-hook 'after-init-hook
1751 (defvar mac-ready-for-drag-n-drop t)))
1753 ;;;; Non-toolkit Scroll bars
1755 (unless x-toolkit-scroll-bars
1758 ;; (defun mac-handle-scroll-bar-event (event) (interactive "e") (princ event))
1760 ;;(global-set-key [vertical-scroll-bar mouse-1] 'mac-handle-scroll-bar-event)
1763 [vertical-scroll-bar down-mouse-1]
1764 'mac-handle-scroll-bar-event)
1766 (global-unset-key [vertical-scroll-bar drag-mouse-1])
1767 (global-unset-key [vertical-scroll-bar mouse-1])
1769 (defun mac-handle-scroll-bar-event (event)
1770 "Handle scroll bar EVENT to emulate Mac Toolbox style scrolling."
1772 (let* ((position (event-start event))
1773 (window (nth 0 position))
1774 (bar-part (nth 4 position)))
1775 (select-window window)
1778 (goto-char (window-start window))
1779 (mac-scroll-down-line))
1780 ((eq bar-part 'above-handle)
1782 ((eq bar-part 'handle)
1783 (scroll-bar-drag event))
1784 ((eq bar-part 'below-handle)
1786 ((eq bar-part 'down)
1787 (goto-char (window-start window))
1788 (mac-scroll-up-line)))))
1790 (defun mac-scroll-ignore-events ()
1791 ;; Ignore confusing non-mouse events
1792 (while (not (memq (car-safe (read-event))
1793 '(mouse-1 double-mouse-1 triple-mouse-1))) nil))
1795 (defun mac-scroll-down ()
1797 (mac-scroll-ignore-events)
1800 (defun mac-scroll-down-line ()
1802 (mac-scroll-ignore-events)
1805 (defun mac-scroll-up ()
1807 (mac-scroll-ignore-events)
1810 (defun mac-scroll-up-line ()
1812 (mac-scroll-ignore-events)
1819 (unless (eq system-type 'darwin)
1820 ;; This variable specifies the Unix program to call (as a process) to
1821 ;; determine the amount of free space on a file system (defaults to
1822 ;; df). If it is not set to nil, ls-lisp will not work correctly
1823 ;; unless an external application df is implemented on the Mac.
1824 (setq directory-free-space-program nil)
1826 ;; Set this so that Emacs calls subprocesses with "sh" as shell to
1827 ;; expand filenames Note no subprocess for the shell is actually
1828 ;; started (see run_mac_command in sysdep.c).
1829 (setq shell-file-name "sh")
1831 ;; Some system variables are encoded with the system script code.
1832 (dolist (v '(system-name
1833 emacs-build-system ; Mac OS 9 version cannot dump
1834 user-login-name user-real-login-name user-full-name))
1835 (set v (decode-coding-string (symbol-value v) mac-system-coding-system))))
1837 ;; If Emacs is started from the Finder, change the default directory
1838 ;; to the user's home directory.
1839 (if (string= default-directory "/")
1842 ;; Darwin 6- pty breakage is now controlled from the C code so that
1843 ;; it applies to all builds on darwin. See s/darwin.h PTY_ITERATION.
1844 ;; (setq process-connection-type t)
1846 ;; Assume that fonts are always scalable on the Mac. This sometimes
1847 ;; results in characters with jagged edges. However, without it,
1848 ;; fonts with both truetype and bitmap representations but no italic
1849 ;; or bold bitmap versions will not display these variants correctly.
1850 (setq scalable-fonts-allowed t)
1852 ;; arch-tag: 71dfcd14-cde8-4d66-b05c-85ec94fb23a6
1853 ;;; mac-win.el ends here