diff options
| author | YAMAMOTO Mitsuharu | 2006-05-05 06:43:12 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2006-05-05 06:43:12 +0000 |
| commit | 6e53dc956bc35adb73dfe6a1e2839a606b768e14 (patch) | |
| tree | da8f7c0720216bcd42756ec47440aeb25836aa39 | |
| parent | 2f566b1802e07fed07ec4d93170f5fa23e2d578f (diff) | |
| download | emacs-6e53dc956bc35adb73dfe6a1e2839a606b768e14.tar.gz emacs-6e53dc956bc35adb73dfe6a1e2839a606b768e14.zip | |
(mac-utxt-to-string, mac-string-to-utxt)
(mac-TEXT-to-string, mac-string-to-TEXT, mac-furl-to-string)
(mac-TIFF-to-string): New functions.
(mac-text-encoding-mac-japanese-basic-variant): New constant.
(x-get-selection, x-selection-value)
(mac-select-convert-to-string): Use them.
(mac-dnd-types-alist): New customization variable.
(mac-dnd-handle-furl, mac-dnd-handle-hfs, mac-dnd-insert-utxt)
(mac-dnd-insert-TEXT, mac-dnd-insert-TIFF, mac-dnd-drop-data)
(mac-dnd-handle-drag-n-drop-event): New functions.
(mac-drag-n-drop): Remove function.
(global-map): Bind drag-n-drop and M-drag-n-drop to
mac-dnd-handle-drag-n-drop-event.
| -rw-r--r-- | lisp/term/mac-win.el | 434 |
1 files changed, 272 insertions, 162 deletions
diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el index 188ecdf8f27..6495f30e2c7 100644 --- a/lisp/term/mac-win.el +++ b/lisp/term/mac-win.el | |||
| @@ -1128,6 +1128,107 @@ correspoinding TextEncodingBase value." | |||
| 1128 | (mac-add-charset-info "mac-dingbats" 34) | 1128 | (mac-add-charset-info "mac-dingbats" 34) |
| 1129 | (mac-add-charset-info "iso10646-1" 126) ; for ATSUI | 1129 | (mac-add-charset-info "iso10646-1" 126) ; for ATSUI |
| 1130 | 1130 | ||
| 1131 | (cp-make-coding-system | ||
| 1132 | mac-centraleurroman | ||
| 1133 | [?\,AD(B ?\$,1 (B ?\$,1 !(B ?\,AI(B ?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(B ?\,AM(B ?\$,1!=(B ?\$,1!>(B ?\$,1!*(B ?\,AS(B ?\,AT(B | ||
| 1140 | ?\$,1!+(B ?\$,1!.(B ?\,AZ(B ?\$,1!/(B ?\$,1!0(B ?\$,1!1(B ?\$,1!2(B ?\$,1!3(B ?\,A](B ?\,A}(B ?\$,1 W(B ?\$,1!;(B ?\$,1 a(B ?\$,1!<(B ?\$,1 B(B ?\$,1$g(B] | ||
| 1141 | "Mac Central European Roman Encoding (MIME:x-mac-centraleurroman).") | ||
| 1142 | (coding-system-put 'mac-centraleurroman 'mime-charset 'x-mac-centraleurroman) | ||
| 1143 | |||
| 1144 | (cp-make-coding-system | ||
| 1145 | mac-cyrillic | ||
| 1146 | [?\$,1(0(B ?\$,1(1(B ?\$,1(2(B ?\$,1(3(B ?\$,1(4(B ?\$,1(5(B ?\$,1(6(B ?\$,1(7(B ?\$,1(8(B ?\$,1(9(B ?\$,1(:(B ?\$,1(;(B ?\$,1(<(B ?\$,1(=(B ?\$,1(>(B ?\$,1(?(B | ||
| 1147 | ?\$,1(@(B ?\$,1(A(B ?\$,1(B(B ?\$,1(C(B ?\$,1(D(B ?\$,1(E(B ?\$,1(F(B ?\$,1(G(B ?\$,1(H(B ?\$,1(I(B ?\$,1(J(B ?\$,1(K(B ?\$,1(L(B ?\$,1(M(B ?\$,1(N(B ?\$,1(O(B | ||
| 1148 | ?\$,1s (B ?\,A0(B ?\$,1)P(B ?\,A#(B ?\,A'(B ?\$,1s"(B ?\,A6(B ?\$,1(&(B ?\,A.(B ?\,A)(B ?\$,1ub(B ?\$,1("(B ?\$,1(r(B ?\$,1y (B ?\$,1(#(B ?\$,1(s(B | ||
| 1149 | ?\$,1x>(B ?\,A1(B ?\$,1y$(B ?\$,1y%(B ?\$,1(v(B ?\,A5(B ?\$,1)Q(B ?\$,1(((B ?\$,1($(B ?\$,1(t(B ?\$,1('(B ?\$,1(w(B ?\$,1()(B ?\$,1(y(B ?\$,1(*(B ?\$,1(z(B | ||
| 1150 | ?\$,1(x(B ?\$,1(%(B ?\,A,(B ?\$,1x:(B ?\$,1!R(B ?\$,1xh(B ?\$,1x&(B ?\,A+(B ?\,A;(B ?\$,1s&(B ?\,A (B ?\$,1(+(B ?\$,1({(B ?\$,1(,(B ?\$,1(|(B ?\$,1(u(B | ||
| 1151 | ?\$,1rs(B ?\$,1rt(B ?\$,1r|(B ?\$,1r}(B ?\$,1rx(B ?\$,1ry(B ?\,Aw(B ?\$,1r~(B ?\$,1(.(B ?\$,1(~(B ?\$,1(/(B ?\$,1((B ?\$,1uV(B ?\$,1(!(B ?\$,1(q(B ?\$,1(o(B | ||
| 1152 | ?\$,1(P(B ?\$,1(Q(B ?\$,1(R(B ?\$,1(S(B ?\$,1(T(B ?\$,1(U(B ?\$,1(V(B ?\$,1(W(B ?\$,1(X(B ?\$,1(Y(B ?\$,1(Z(B ?\$,1([(B ?\$,1(\(B ?\$,1(](B ?\$,1(^(B ?\$,1(_(B | ||
| 1153 | ?\$,1(`(B ?\$,1(a(B ?\$,1(b(B ?\$,1(c(B ?\$,1(d(B ?\$,1(e(B ?\$,1(f(B ?\$,1(g(B ?\$,1(h(B ?\$,1(i(B ?\$,1(j(B ?\$,1(k(B ?\$,1(l(B ?\$,1(m(B ?\$,1(n(B ?\$,1tL(B] | ||
| 1154 | "Mac Cyrillic Encoding (MIME:x-mac-cyrillic).") | ||
| 1155 | (coding-system-put 'mac-cyrillic 'mime-charset 'x-mac-cyrillic) | ||
| 1156 | |||
| 1157 | (let | ||
| 1158 | ((encoding-vector | ||
| 1159 | (vconcat | ||
| 1160 | (make-vector 32 nil) | ||
| 1161 | ;; mac-symbol (32..126) -> emacs-mule mapping | ||
| 1162 | [?\ ?\! ?\$,1x (B ?\# ?\$,1x#(B ?\% ?\& ?\$,1x-(B ?\( ?\) ?\$,1x7(B ?\+ ?\, ?\$,1x2(B ?\. ?\/ | ||
| 1163 | ?\0 ?\1 ?\2 ?\3 ?\4 ?\5 ?\6 ?\7 ?\8 ?\9 ?\: ?\; ?\< ?\= ?\> ?\? | ||
| 1164 | ?\$,1xe(B ?\$,1&q(B ?\$,1&r(B ?\$,1''(B ?\$,1&t(B ?\$,1&u(B ?\$,1'&(B ?\$,1&s(B ?\$,1&w(B ?\$,1&y(B ?\$,1'Q(B ?\$,1&z(B ?\$,1&{(B ?\$,1&|(B ?\$,1&}(B ?\$,1&(B | ||
| 1165 | ?\$,1' (B ?\$,1&x(B ?\$,1'!(B ?\$,1'#(B ?\$,1'$(B ?\$,1'%(B ?\$,1'B(B ?\$,1')(B ?\$,1&~(B ?\$,1'((B ?\$,1&v(B ?\[ ?\$,1xT(B ?\] ?\$,1ye(B ?\_ | ||
| 1166 | ?\$,3bE(B ?\$,1'1(B ?\$,1'2(B ?\$,1'G(B ?\$,1'4(B ?\$,1'5(B ?\$,1'F(B ?\$,1'3(B ?\$,1'7(B ?\$,1'9(B ?\$,1'U(B ?\$,1':(B ?\$,1';(B ?\$,1'<(B ?\$,1'=(B ?\$,1'?(B | ||
| 1167 | ?\$,1'@(B ?\$,1'8(B ?\$,1'A(B ?\$,1'C(B ?\$,1'D(B ?\$,1'E(B ?\$,1'V(B ?\$,1'I(B ?\$,1'>(B ?\$,1'H(B ?\$,1'6(B ?\{ ?\| ?\} ?\$,1x\(B] | ||
| 1168 | (make-vector (- 160 127) nil) | ||
| 1169 | ;; mac-symbol (160..254) -> emacs-mule mapping | ||
| 1170 | ;; Mapping of the following characters are changed from the | ||
| 1171 | ;; original one: | ||
| 1172 | ;; 0xE2 0x00AE+0xF87F -> 0x00AE # REGISTERED SIGN, alternate: sans serif | ||
| 1173 | ;; 0xE3 0x00A9+0xF87F -> 0x00A9 # COPYRIGHT SIGN, alternate: sans serif | ||
| 1174 | ;; 0xE4 0x2122+0xF87F -> 0x2122 # TRADE MARK SIGN, alternate: sans serif | ||
| 1175 | [?\$,1tL(B ?\$,1'R(B ?\$,1s2(B ?\$,1y$(B ?\$,1sD(B ?\$,1x>(B ?\$,1!R(B ?\$,2#c(B ?\$,2#f(B ?\$,2#e(B ?\$,2#`(B ?\$,1vt(B ?\$,1vp(B ?\$,1vq(B ?\$,1vr(B ?\$,1vs(B | ||
| 1176 | ?\,A0(B ?\,A1(B ?\$,1s3(B ?\$,1y%(B ?\,AW(B ?\$,1x=(B ?\$,1x"(B ?\$,1s"(B ?\,Aw(B ?\$,1y (B ?\$,1y!(B ?\$,1xh(B ?\$,1s&(B ?\$,1|p(B ?\$,1|O(B ?\$,1w5(B | ||
| 1177 | ?\$,1uu(B ?\$,1uQ(B ?\$,1u\(B ?\$,1uX(B ?\$,1yW(B ?\$,1yU(B ?\$,1x%(B ?\$,1xI(B ?\$,1xJ(B ?\$,1yC(B ?\$,1yG(B ?\$,1yD(B ?\$,1yB(B ?\$,1yF(B ?\$,1x((B ?\$,1x)(B | ||
| 1178 | ?\$,1x@(B ?\$,1x'(B ?\,A.(B ?\,A)(B ?\$,1ub(B ?\$,1x/(B ?\$,1x:(B ?\$,1z%(B ?\,A,(B ?\$,1xG(B ?\$,1xH(B ?\$,1wT(B ?\$,1wP(B ?\$,1wQ(B ?\$,1wR(B ?\$,1wS(B | ||
| 1179 | ?\$,2"*(B ?\$,2=H(B ?\,A.(B ?\,A)(B ?\$,1ub(B ?\$,1x1(B ?\$,1|;(B ?\$,1|<(B ?\$,1|=(B ?\$,1|A(B ?\$,1|B(B ?\$,1|C(B ?\$,1|G(B ?\$,1|H(B ?\$,1|I(B ?\$,1|J(B | ||
| 1180 | ?\$,3b_(B ?\$,2=I(B ?\$,1xK(B ?\$,1{ (B ?\$,1|N(B ?\$,1{!(B ?\$,1|>(B ?\$,1|?(B ?\$,1|@(B ?\$,1|D(B ?\$,1|E(B ?\$,1|F(B ?\$,1|K(B ?\$,1|L(B ?\$,1|M(B | ||
| 1181 | nil])) | ||
| 1182 | translation-table) | ||
| 1183 | (setq translation-table | ||
| 1184 | (make-translation-table-from-vector encoding-vector)) | ||
| 1185 | ;; (define-translation-table 'mac-symbol-decoder translation-table) | ||
| 1186 | (define-translation-table 'mac-symbol-encoder | ||
| 1187 | (char-table-extra-slot translation-table 0))) | ||
| 1188 | |||
| 1189 | (let | ||
| 1190 | ((encoding-vector | ||
| 1191 | (vconcat | ||
| 1192 | (make-vector 32 nil) | ||
| 1193 | ;; mac-dingbats (32..126) -> emacs-mule mapping | ||
| 1194 | [?\ ?\$,2%A(B ?\$,2%B(B ?\$,2%C(B ?\$,2%D(B ?\$,2"n(B ?\$,2%F(B ?\$,2%G(B ?\$,2%H(B ?\$,2%I(B ?\$,2"{(B ?\$,2"~(B ?\$,2%L(B ?\$,2%M(B ?\$,2%N(B ?\$,2%O(B | ||
| 1195 | ?\$,2%P(B ?\$,2%Q(B ?\$,2%R(B ?\$,2%S(B ?\$,2%T(B ?\$,2%U(B ?\$,2%V(B ?\$,2%W(B ?\$,2%X(B ?\$,2%Y(B ?\$,2%Z(B ?\$,2%[(B ?\$,2%\(B ?\$,2%](B ?\$,2%^(B ?\$,2%_(B | ||
| 1196 | ?\$,2%`(B ?\$,2%a(B ?\$,2%b(B ?\$,2%c(B ?\$,2%d(B ?\$,2%e(B ?\$,2%f(B ?\$,2%g(B ?\$,2"e(B ?\$,2%i(B ?\$,2%j(B ?\$,2%k(B ?\$,2%l(B ?\$,2%m(B ?\$,2%n(B ?\$,2%o(B | ||
| 1197 | ?\$,2%p(B ?\$,2%q(B ?\$,2%r(B ?\$,2%s(B ?\$,2%t(B ?\$,2%u(B ?\$,2%v(B ?\$,2%w(B ?\$,2%x(B ?\$,2%y(B ?\$,2%z(B ?\$,2%{(B ?\$,2%|(B ?\$,2%}(B ?\$,2%~(B ?\$,2%(B | ||
| 1198 | ?\$,2& (B ?\$,2&!(B ?\$,2&"(B ?\$,2&#(B ?\$,2&$(B ?\$,2&%(B ?\$,2&&(B ?\$,2&'(B ?\$,2&((B ?\$,2&)(B ?\$,2&*(B ?\$,2&+(B ?\$,2"/(B ?\$,2&-(B ?\$,2!`(B ?\$,2&/(B | ||
| 1199 | ?\$,2&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B ?\$,2&{(B ?\$,2&|(B ?\$,2&}(B ?\$,2&~(B ?\$,2&(B | ||
| 1209 | ?\$,2' (B ?\$,2'!(B ?\$,2'"(B ?\$,2'#(B ?\$,2'$(B ?\$,2'%(B ?\$,2'&(B ?\$,2''(B ?\$,2'((B ?\$,2')(B ?\$,2'*(B ?\$,2'+(B ?\$,2',(B ?\$,2'-(B ?\$,2'.(B ?\$,2'/(B | ||
| 1210 | nil | ||
| 1211 | ;; mac-dingbats (241..254) -> emacs-mule mapping | ||
| 1212 | ?\$,2'1(B ?\$,2'2(B ?\$,2'3(B ?\$,2'4(B ?\$,2'5(B ?\$,2'6(B ?\$,2'7(B ?\$,2'8(B ?\$,2'9(B ?\$,2':(B ?\$,2';(B ?\$,2'<(B ?\$,2'=(B ?\$,2'>(B | ||
| 1213 | nil])) | ||
| 1214 | translation-table) | ||
| 1215 | (setq translation-table | ||
| 1216 | (make-translation-table-from-vector encoding-vector)) | ||
| 1217 | ;; (define-translation-table 'mac-dingbats-decoder translation-table) | ||
| 1218 | (define-translation-table 'mac-dingbats-encoder | ||
| 1219 | (char-table-extra-slot translation-table 0))) | ||
| 1220 | |||
| 1221 | (defconst mac-system-coding-system | ||
| 1222 | (let ((base (or (cdr (assq mac-system-script-code | ||
| 1223 | mac-script-code-coding-systems)) | ||
| 1224 | 'mac-roman))) | ||
| 1225 | (if (eq system-type 'darwin) | ||
| 1226 | base | ||
| 1227 | (coding-system-change-eol-conversion base 'mac))) | ||
| 1228 | "Coding system derived from the system script code.") | ||
| 1229 | |||
| 1230 | (set-selection-coding-system mac-system-coding-system) | ||
| 1231 | |||
| 1131 | 1232 | ||
| 1132 | ;;;; Keyboard layout/language change events | 1233 | ;;;; Keyboard layout/language change events |
| 1133 | (defun mac-handle-language-change (event) | 1234 | (defun mac-handle-language-change (event) |
| @@ -1141,6 +1242,89 @@ correspoinding TextEncodingBase value." | |||
| 1141 | (define-key key-translation-map [?\x80] "\\")))) | 1242 | (define-key key-translation-map [?\x80] "\\")))) |
| 1142 | 1243 | ||
| 1143 | (define-key special-event-map [language-change] 'mac-handle-language-change) | 1244 | (define-key special-event-map [language-change] 'mac-handle-language-change) |
| 1245 | |||
| 1246 | |||
| 1247 | ;;;; Conversion between common flavors and Lisp string. | ||
| 1248 | |||
| 1249 | (defconst mac-text-encoding-mac-japanese-basic-variant #x20001 | ||
| 1250 | "MacJapanese text encoding without Apple double-byte extensions.") | ||
| 1251 | |||
| 1252 | (defun mac-utxt-to-string (data &optional coding-system) | ||
| 1253 | (or coding-system (setq coding-system mac-system-coding-system)) | ||
| 1254 | (let* ((encoding | ||
| 1255 | (and (eq system-type 'darwin) | ||
| 1256 | (eq (coding-system-base coding-system) 'japanese-shift-jis) | ||
| 1257 | mac-text-encoding-mac-japanese-basic-variant)) | ||
| 1258 | (str (and (fboundp 'mac-code-convert-string) | ||
| 1259 | (mac-code-convert-string data nil | ||
| 1260 | (or encoding coding-system))))) | ||
| 1261 | (when str | ||
| 1262 | (setq str (decode-coding-string str coding-system)) | ||
| 1263 | (if (= encoding mac-text-encoding-mac-japanese-basic-variant) | ||
| 1264 | ;; Does it contain Apple one-byte extensions other than | ||
| 1265 | ;; reverse solidus? | ||
| 1266 | (if (string-match "[\xa0\xfd-\xff]" str) | ||
| 1267 | (setq str nil) | ||
| 1268 | (subst-char-in-string ?\x5c ?\(J\(B str t) | ||
| 1269 | (subst-char-in-string ?\x80 ?\\ str t)))) | ||
| 1270 | (or str | ||
| 1271 | (decode-coding-string data | ||
| 1272 | (if (eq (byteorder) ?B) 'utf-16be 'utf-16le))))) | ||
| 1273 | |||
| 1274 | (defun mac-string-to-utxt (string &optional coding-system) | ||
| 1275 | (or coding-system (setq coding-system mac-system-coding-system)) | ||
| 1276 | (let (data encoding) | ||
| 1277 | (when (and (fboundp 'mac-code-convert-string) | ||
| 1278 | (memq (coding-system-base coding-system) | ||
| 1279 | (find-coding-systems-string string))) | ||
| 1280 | (setq coding-system | ||
| 1281 | (coding-system-change-eol-conversion coding-system 'mac)) | ||
| 1282 | (when (and (eq system-type 'darwin) | ||
| 1283 | (eq coding-system 'japanese-shift-jis-mac)) | ||
| 1284 | (setq encoding mac-text-encoding-mac-japanese-basic-variant) | ||
| 1285 | (setq string (subst-char-in-string ?\\ ?\x80 string)) | ||
| 1286 | (subst-char-in-string ?\(J\(B ?\x5c string t)) | ||
| 1287 | (setq data (mac-code-convert-string | ||
| 1288 | (encode-coding-string string coding-system) | ||
| 1289 | (or encoding coding-system) nil))) | ||
| 1290 | (or data (encode-coding-string string (if (eq (byteorder) ?B) | ||
| 1291 | 'utf-16be-mac | ||
| 1292 | 'utf-16le-mac))))) | ||
| 1293 | |||
| 1294 | (defun mac-TEXT-to-string (data &optional coding-system) | ||
| 1295 | (or coding-system (setq coding-system mac-system-coding-system)) | ||
| 1296 | (prog1 (setq data (decode-coding-string data coding-system)) | ||
| 1297 | (when (eq (coding-system-base coding-system) 'japanese-shift-jis) | ||
| 1298 | ;; (subst-char-in-string ?\x5c ?\(J\(B data t) | ||
| 1299 | (subst-char-in-string ?\x80 ?\\ data t)))) | ||
| 1300 | |||
| 1301 | (defun mac-string-to-TEXT (string &optional coding-system) | ||
| 1302 | (or coding-system (setq coding-system mac-system-coding-system)) | ||
| 1303 | (let ((encodables (find-coding-systems-string string)) | ||
| 1304 | (rest mac-script-code-coding-systems)) | ||
| 1305 | (unless (memq (coding-system-base coding-system) encodables) | ||
| 1306 | (while (and rest (not (memq (cdar rest) encodables))) | ||
| 1307 | (setq rest (cdr rest))) | ||
| 1308 | (if rest | ||
| 1309 | (setq coding-system (cdar rest))))) | ||
| 1310 | (setq coding-system | ||
| 1311 | (coding-system-change-eol-conversion coding-system 'mac)) | ||
| 1312 | (when (eq coding-system 'japanese-shift-jis-mac) | ||
| 1313 | ;; (setq string (subst-char-in-string ?\\ ?\x80 string)) | ||
| 1314 | (setq string (subst-char-in-string ?\(J\(B ?\x5c string))) | ||
| 1315 | (encode-coding-string string coding-system)) | ||
| 1316 | |||
| 1317 | (defun mac-furl-to-string (data) | ||
| 1318 | ;; Remove a trailing nul character. | ||
| 1319 | (let ((len (length data))) | ||
| 1320 | (if (and (> len 0) (= (aref data (1- len)) ?\0)) | ||
| 1321 | (substring data 0 (1- len)) | ||
| 1322 | data))) | ||
| 1323 | |||
| 1324 | (defun mac-TIFF-to-string (data &optional text) | ||
| 1325 | (prog1 (or text (setq text (copy-sequence " "))) | ||
| 1326 | (put-text-property 0 (length text) 'display (create-image data 'tiff t) | ||
| 1327 | text))) | ||
| 1144 | 1328 | ||
| 1145 | ;;;; Selections | 1329 | ;;;; Selections |
| 1146 | 1330 | ||
| @@ -1190,22 +1374,11 @@ in `selection-converter-alist', which see." | |||
| 1190 | (when (and (stringp data) | 1374 | (when (and (stringp data) |
| 1191 | (setq data-type (get-text-property 0 'foreign-selection data))) | 1375 | (setq data-type (get-text-property 0 'foreign-selection data))) |
| 1192 | (cond ((eq data-type 'public.utf16-plain-text) | 1376 | (cond ((eq data-type 'public.utf16-plain-text) |
| 1193 | (let ((encoded (and (fboundp 'mac-code-convert-string) | 1377 | (setq data (mac-utxt-to-string data coding))) |
| 1194 | (mac-code-convert-string data nil coding)))) | ||
| 1195 | (if encoded | ||
| 1196 | (setq data (decode-coding-string encoded coding)) | ||
| 1197 | (setq data | ||
| 1198 | (decode-coding-string data | ||
| 1199 | (if (eq (byteorder) ?B) | ||
| 1200 | 'utf-16be 'utf-16le)))))) | ||
| 1201 | ((eq data-type 'com.apple.traditional-mac-plain-text) | 1378 | ((eq data-type 'com.apple.traditional-mac-plain-text) |
| 1202 | (setq data (decode-coding-string data coding))) | 1379 | (setq data (mac-TEXT-to-string data coding))) |
| 1203 | ((eq data-type 'public.file-url) | 1380 | ((eq data-type 'public.file-url) |
| 1204 | (setq data (decode-coding-string data 'utf-8)) | 1381 | (setq data (mac-furl-to-string data)))) |
| 1205 | ;; Remove a trailing nul character. | ||
| 1206 | (let ((len (length data))) | ||
| 1207 | (if (and (> len 0) (= (aref data (1- len)) ?\0)) | ||
| 1208 | (setq data (substring data 0 (1- len))))))) | ||
| 1209 | (put-text-property 0 (length data) 'foreign-selection data-type data)) | 1382 | (put-text-property 0 (length data) 'foreign-selection data-type data)) |
| 1210 | data)) | 1383 | data)) |
| 1211 | 1384 | ||
| @@ -1227,9 +1400,7 @@ in `selection-converter-alist', which see." | |||
| 1227 | (when tiff-image | 1400 | (when tiff-image |
| 1228 | (remove-text-properties 0 (length tiff-image) | 1401 | (remove-text-properties 0 (length tiff-image) |
| 1229 | '(foreign-selection nil) tiff-image) | 1402 | '(foreign-selection nil) tiff-image) |
| 1230 | (setq tiff-image (create-image tiff-image 'tiff t)) | 1403 | (setq text (mac-TIFF-to-string tiff-image text))) |
| 1231 | (or text (setq text " ")) | ||
| 1232 | (put-text-property 0 (length text) 'display tiff-image text)) | ||
| 1233 | text)) | 1404 | text)) |
| 1234 | 1405 | ||
| 1235 | ;;; Return the value of the current selection. | 1406 | ;;; Return the value of the current selection. |
| @@ -1300,11 +1471,7 @@ in `selection-converter-alist', which see." | |||
| 1300 | 1471 | ||
| 1301 | (defun mac-select-convert-to-string (selection type value) | 1472 | (defun mac-select-convert-to-string (selection type value) |
| 1302 | (let ((str (cdr (xselect-convert-to-string selection nil value))) | 1473 | (let ((str (cdr (xselect-convert-to-string selection nil value))) |
| 1303 | coding) | 1474 | (coding (or next-selection-coding-system selection-coding-system))) |
| 1304 | (setq coding (or next-selection-coding-system selection-coding-system)) | ||
| 1305 | (if coding | ||
| 1306 | (setq coding (coding-system-base coding)) | ||
| 1307 | (setq coding 'raw-text)) | ||
| 1308 | (when str | 1475 | (when str |
| 1309 | ;; If TYPE is nil, this is a local request, thus return STR as | 1476 | ;; If TYPE is nil, this is a local request, thus return STR as |
| 1310 | ;; is. Otherwise, encode STR. | 1477 | ;; is. Otherwise, encode STR. |
| @@ -1314,28 +1481,9 @@ in `selection-converter-alist', which see." | |||
| 1314 | (remove-text-properties 0 (length str) '(composition nil) str) | 1481 | (remove-text-properties 0 (length str) '(composition nil) str) |
| 1315 | (cond | 1482 | (cond |
| 1316 | ((eq type 'public.utf16-plain-text) | 1483 | ((eq type 'public.utf16-plain-text) |
| 1317 | (let (s) | 1484 | (setq str (mac-string-to-utxt str coding))) |
| 1318 | (when (and (fboundp 'mac-code-convert-string) | ||
| 1319 | (memq coding (find-coding-systems-string str))) | ||
| 1320 | (setq coding (coding-system-change-eol-conversion coding 'mac)) | ||
| 1321 | (setq s (mac-code-convert-string | ||
| 1322 | (encode-coding-string str coding) | ||
| 1323 | coding nil))) | ||
| 1324 | (setq str (or s | ||
| 1325 | (encode-coding-string str | ||
| 1326 | (if (eq (byteorder) ?B) | ||
| 1327 | 'utf-16be-mac | ||
| 1328 | 'utf-16le-mac)))))) | ||
| 1329 | ((eq type 'com.apple.traditional-mac-plain-text) | 1485 | ((eq type 'com.apple.traditional-mac-plain-text) |
| 1330 | (let ((encodables (find-coding-systems-string str)) | 1486 | (setq str (mac-string-to-TEXT str coding))) |
| 1331 | (rest mac-script-code-coding-systems)) | ||
| 1332 | (unless (memq coding encodables) | ||
| 1333 | (while (and rest (not (memq (cdar rest) encodables))) | ||
| 1334 | (setq rest (cdr rest))) | ||
| 1335 | (if rest | ||
| 1336 | (setq coding (cdar rest))))) | ||
| 1337 | (setq coding (coding-system-change-eol-conversion coding 'mac)) | ||
| 1338 | (setq str (encode-coding-string str coding))) | ||
| 1339 | (t | 1487 | (t |
| 1340 | (error "Unknown selection type: %S" type)) | 1488 | (error "Unknown selection type: %S" type)) |
| 1341 | ))) | 1489 | ))) |
| @@ -1589,6 +1737,83 @@ Currently the `mailto' scheme is supported." | |||
| 1589 | ;; processed when the initial frame has been created: this is where | 1737 | ;; processed when the initial frame has been created: this is where |
| 1590 | ;; the files should be opened. | 1738 | ;; the files should be opened. |
| 1591 | (add-hook 'after-init-hook 'mac-process-deferred-apple-events) | 1739 | (add-hook 'after-init-hook 'mac-process-deferred-apple-events) |
| 1740 | |||
| 1741 | |||
| 1742 | ;;;; Drag and drop | ||
| 1743 | |||
| 1744 | (defcustom mac-dnd-types-alist | ||
| 1745 | '(("furl" . mac-dnd-handle-furl) | ||
| 1746 | ("hfs " . mac-dnd-handle-hfs) | ||
| 1747 | ("utxt" . mac-dnd-insert-utxt) | ||
| 1748 | ("TEXT" . mac-dnd-insert-TEXT) | ||
| 1749 | ("TIFF" . mac-dnd-insert-TIFF)) | ||
| 1750 | "Which function to call to handle a drop of that type. | ||
| 1751 | The function takes three arguments, WINDOW, ACTION and DATA. | ||
| 1752 | WINDOW is where the drop occured, ACTION is always `private' on | ||
| 1753 | Mac. DATA is the drop data. Unlike the x-dnd counterpart, the | ||
| 1754 | return value of the function is not significant. | ||
| 1755 | |||
| 1756 | See also `mac-dnd-known-types'." | ||
| 1757 | :version "22.1" | ||
| 1758 | :type 'alist | ||
| 1759 | :group 'mac) | ||
| 1760 | |||
| 1761 | (defun mac-dnd-handle-furl (window action data) | ||
| 1762 | (dnd-handle-one-url window action (mac-furl-to-string data))) | ||
| 1763 | |||
| 1764 | (defun mac-dnd-handle-hfs (window action data) | ||
| 1765 | ;; struct HFSFlavor { | ||
| 1766 | ;; OSType fileType; | ||
| 1767 | ;; OSType fileCreator; | ||
| 1768 | ;; UInt16 fdFlags; | ||
| 1769 | ;; FSSpec fileSpec; | ||
| 1770 | ;; }; | ||
| 1771 | (let* ((file-name (mac-coerce-ae-data "fss " (substring data 10) | ||
| 1772 | 'undecoded-file-name)) | ||
| 1773 | (url (concat "file://" | ||
| 1774 | (mapconcat 'url-hexify-string | ||
| 1775 | (split-string file-name "/") "/")))) | ||
| 1776 | (dnd-handle-one-url window action url))) | ||
| 1777 | |||
| 1778 | (defun mac-dnd-insert-utxt (window action data) | ||
| 1779 | (dnd-insert-text window action (mac-utxt-to-string data))) | ||
| 1780 | |||
| 1781 | (defun mac-dnd-insert-TEXT (window action data) | ||
| 1782 | (dnd-insert-text window action (mac-TEXT-to-string data))) | ||
| 1783 | |||
| 1784 | (defun mac-dnd-insert-TIFF (window action data) | ||
| 1785 | (dnd-insert-text window action (mac-TIFF-to-string data))) | ||
| 1786 | |||
| 1787 | (defun mac-dnd-drop-data (event frame window data type) | ||
| 1788 | (let* ((type-info (assoc type mac-dnd-types-alist)) | ||
| 1789 | (handler (cdr type-info)) | ||
| 1790 | (action 'private) | ||
| 1791 | (w (posn-window (event-start event)))) | ||
| 1792 | (when handler | ||
| 1793 | (if (and (windowp w) (window-live-p w) | ||
| 1794 | (not (window-minibuffer-p w)) | ||
| 1795 | (not (window-dedicated-p w))) | ||
| 1796 | ;; If dropping in an ordinary window which we could use, | ||
| 1797 | ;; let dnd-open-file-other-window specify what to do. | ||
| 1798 | (progn | ||
| 1799 | (goto-char (posn-point (event-start event))) | ||
| 1800 | (funcall handler window action data)) | ||
| 1801 | ;; If we can't display the file here, | ||
| 1802 | ;; make a new window for it. | ||
| 1803 | (let ((dnd-open-file-other-window t)) | ||
| 1804 | (select-frame frame) | ||
| 1805 | (funcall handler window action data)))))) | ||
| 1806 | |||
| 1807 | (defun mac-dnd-handle-drag-n-drop-event (event) | ||
| 1808 | "Receive drag and drop events." | ||
| 1809 | (interactive "e") | ||
| 1810 | (let ((window (posn-window (event-start event)))) | ||
| 1811 | (when (windowp window) (select-window window)) | ||
| 1812 | (dolist (item (mac-ae-list (mac-event-ae event))) | ||
| 1813 | (if (not (equal (car item) "null")) | ||
| 1814 | (mac-dnd-drop-data event (selected-frame) window | ||
| 1815 | (cdr item) (car item))))) | ||
| 1816 | (select-frame-set-input-focus (selected-frame))) | ||
| 1592 | 1817 | ||
| 1593 | ;;; Do the actual Windows setup here; the above code just defines | 1818 | ;;; Do the actual Windows setup here; the above code just defines |
| 1594 | ;;; functions and variables that we use now. | 1819 | ;;; functions and variables that we use now. |
| @@ -1618,96 +1843,6 @@ Currently the `mailto' scheme is supported." | |||
| 1618 | 1843 | ||
| 1619 | (setq frame-creation-function 'x-create-frame-with-faces) | 1844 | (setq frame-creation-function 'x-create-frame-with-faces) |
| 1620 | 1845 | ||
| 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1! (B ?\$,1rz(B ?\$,1r~(B ?\$,1!!(B ?\$,1 z(B ?\$,1 {(B ?\,AA(B ?\$,1!$(B ?\$,1!%(B ?\,AM(B ?\$,1!=(B ?\$,1!>(B ?\$,1!*(B ?\,AS(B ?\,AT(B | ||
| 1630 | ?\$,1!+(B ?\$,1!.(B ?\,AZ(B ?\$,1!/(B ?\$,1!0(B ?\$,1!1(B ?\$,1!2(B ?\$,1!3(B ?\,A](B ?\,A}(B ?\$,1 W(B ?\$,1!;(B ?\$,1 a(B ?\$,1!<(B ?\$,1 B(B ?\$,1$g(B] | ||
| 1631 | "Mac Central European Roman Encoding (MIME:x-mac-centraleurroman).") | ||
| 1632 | (coding-system-put 'mac-centraleurroman 'mime-charset 'x-mac-centraleurroman) | ||
| 1633 | |||
| 1634 | (cp-make-coding-system | ||
| 1635 | mac-cyrillic | ||
| 1636 | [?\$,1(0(B ?\$,1(1(B ?\$,1(2(B ?\$,1(3(B ?\$,1(4(B ?\$,1(5(B ?\$,1(6(B ?\$,1(7(B ?\$,1(8(B ?\$,1(9(B ?\$,1(:(B ?\$,1(;(B ?\$,1(<(B ?\$,1(=(B ?\$,1(>(B ?\$,1(?(B | ||
| 1637 | ?\$,1(@(B ?\$,1(A(B ?\$,1(B(B ?\$,1(C(B ?\$,1(D(B ?\$,1(E(B ?\$,1(F(B ?\$,1(G(B ?\$,1(H(B ?\$,1(I(B ?\$,1(J(B ?\$,1(K(B ?\$,1(L(B ?\$,1(M(B ?\$,1(N(B ?\$,1(O(B | ||
| 1638 | ?\$,1s (B ?\,A0(B ?\$,1)P(B ?\,A#(B ?\,A'(B ?\$,1s"(B ?\,A6(B ?\$,1(&(B ?\,A.(B ?\,A)(B ?\$,1ub(B ?\$,1("(B ?\$,1(r(B ?\$,1y (B ?\$,1(#(B ?\$,1(s(B | ||
| 1639 | ?\$,1x>(B ?\,A1(B ?\$,1y$(B ?\$,1y%(B ?\$,1(v(B ?\,A5(B ?\$,1)Q(B ?\$,1(((B ?\$,1($(B ?\$,1(t(B ?\$,1('(B ?\$,1(w(B ?\$,1()(B ?\$,1(y(B ?\$,1(*(B ?\$,1(z(B | ||
| 1640 | ?\$,1(x(B ?\$,1(%(B ?\,A,(B ?\$,1x:(B ?\$,1!R(B ?\$,1xh(B ?\$,1x&(B ?\,A+(B ?\,A;(B ?\$,1s&(B ?\,A (B ?\$,1(+(B ?\$,1({(B ?\$,1(,(B ?\$,1(|(B ?\$,1(u(B | ||
| 1641 | ?\$,1rs(B ?\$,1rt(B ?\$,1r|(B ?\$,1r}(B ?\$,1rx(B ?\$,1ry(B ?\,Aw(B ?\$,1r~(B ?\$,1(.(B ?\$,1(~(B ?\$,1(/(B ?\$,1((B ?\$,1uV(B ?\$,1(!(B ?\$,1(q(B ?\$,1(o(B | ||
| 1642 | ?\$,1(P(B ?\$,1(Q(B ?\$,1(R(B ?\$,1(S(B ?\$,1(T(B ?\$,1(U(B ?\$,1(V(B ?\$,1(W(B ?\$,1(X(B ?\$,1(Y(B ?\$,1(Z(B ?\$,1([(B ?\$,1(\(B ?\$,1(](B ?\$,1(^(B ?\$,1(_(B | ||
| 1643 | ?\$,1(`(B ?\$,1(a(B ?\$,1(b(B ?\$,1(c(B ?\$,1(d(B ?\$,1(e(B ?\$,1(f(B ?\$,1(g(B ?\$,1(h(B ?\$,1(i(B ?\$,1(j(B ?\$,1(k(B ?\$,1(l(B ?\$,1(m(B ?\$,1(n(B ?\$,1tL(B] | ||
| 1644 | "Mac Cyrillic Encoding (MIME:x-mac-cyrillic).") | ||
| 1645 | (coding-system-put 'mac-cyrillic 'mime-charset 'x-mac-cyrillic) | ||
| 1646 | |||
| 1647 | (let | ||
| 1648 | ((encoding-vector | ||
| 1649 | (vconcat | ||
| 1650 | (make-vector 32 nil) | ||
| 1651 | ;; mac-symbol (32..126) -> emacs-mule mapping | ||
| 1652 | [?\ ?\! ?\$,1x (B ?\# ?\$,1x#(B ?\% ?\& ?\$,1x-(B ?\( ?\) ?\$,1x7(B ?\+ ?\, ?\$,1x2(B ?\. ?\/ | ||
| 1653 | ?\0 ?\1 ?\2 ?\3 ?\4 ?\5 ?\6 ?\7 ?\8 ?\9 ?\: ?\; ?\< ?\= ?\> ?\? | ||
| 1654 | ?\$,1xe(B ?\$,1&q(B ?\$,1&r(B ?\$,1''(B ?\$,1&t(B ?\$,1&u(B ?\$,1'&(B ?\$,1&s(B ?\$,1&w(B ?\$,1&y(B ?\$,1'Q(B ?\$,1&z(B ?\$,1&{(B ?\$,1&|(B ?\$,1&}(B ?\$,1&(B | ||
| 1655 | ?\$,1' (B ?\$,1&x(B ?\$,1'!(B ?\$,1'#(B ?\$,1'$(B ?\$,1'%(B ?\$,1'B(B ?\$,1')(B ?\$,1&~(B ?\$,1'((B ?\$,1&v(B ?\[ ?\$,1xT(B ?\] ?\$,1ye(B ?\_ | ||
| 1656 | ?\$,3bE(B ?\$,1'1(B ?\$,1'2(B ?\$,1'G(B ?\$,1'4(B ?\$,1'5(B ?\$,1'F(B ?\$,1'3(B ?\$,1'7(B ?\$,1'9(B ?\$,1'U(B ?\$,1':(B ?\$,1';(B ?\$,1'<(B ?\$,1'=(B ?\$,1'?(B | ||
| 1657 | ?\$,1'@(B ?\$,1'8(B ?\$,1'A(B ?\$,1'C(B ?\$,1'D(B ?\$,1'E(B ?\$,1'V(B ?\$,1'I(B ?\$,1'>(B ?\$,1'H(B ?\$,1'6(B ?\{ ?\| ?\} ?\$,1x\(B] | ||
| 1658 | (make-vector (- 160 127) nil) | ||
| 1659 | ;; mac-symbol (160..254) -> emacs-mule mapping | ||
| 1660 | ;; Mapping of the following characters are changed from the | ||
| 1661 | ;; original one: | ||
| 1662 | ;; 0xE2 0x00AE+0xF87F -> 0x00AE # REGISTERED SIGN, alternate: sans serif | ||
| 1663 | ;; 0xE3 0x00A9+0xF87F -> 0x00A9 # COPYRIGHT SIGN, alternate: sans serif | ||
| 1664 | ;; 0xE4 0x2122+0xF87F -> 0x2122 # TRADE MARK SIGN, alternate: sans serif | ||
| 1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 | (setq translation-table | ||
| 1674 | (make-translation-table-from-vector encoding-vector)) | ||
| 1675 | ;; (define-translation-table 'mac-symbol-decoder translation-table) | ||
| 1676 | (define-translation-table 'mac-symbol-encoder | ||
| 1677 | (char-table-extra-slot translation-table 0))) | ||
| 1678 | |||
| 1679 | (let | ||
| 1680 | ((encoding-vector | ||
| 1681 | (vconcat | ||
| 1682 | (make-vector 32 nil) | ||
| 1683 | ;; mac-dingbats (32..126) -> emacs-mule mapping | ||
| 1684 | [?\ ?\$,2%A(B ?\$,2%B(B ?\$,2%C(B ?\$,2%D(B ?\$,2"n(B ?\$,2%F(B ?\$,2%G(B ?\$,2%H(B ?\$,2%I(B ?\$,2"{(B ?\$,2"~(B ?\$,2%L(B ?\$,2%M(B ?\$,2%N(B ?\$,2%O(B | ||
| 1685 | ?\$,2%P(B ?\$,2%Q(B ?\$,2%R(B ?\$,2%S(B ?\$,2%T(B ?\$,2%U(B ?\$,2%V(B ?\$,2%W(B ?\$,2%X(B ?\$,2%Y(B ?\$,2%Z(B ?\$,2%[(B ?\$,2%\(B ?\$,2%](B ?\$,2%^(B ?\$,2%_(B | ||
| 1686 | ?\$,2%`(B ?\$,2%a(B ?\$,2%b(B ?\$,2%c(B ?\$,2%d(B ?\$,2%e(B ?\$,2%f(B ?\$,2%g(B ?\$,2"e(B ?\$,2%i(B ?\$,2%j(B ?\$,2%k(B ?\$,2%l(B ?\$,2%m(B ?\$,2%n(B ?\$,2%o(B | ||
| 1687 | ?\$,2%p(B ?\$,2%q(B ?\$,2%r(B ?\$,2%s(B ?\$,2%t(B ?\$,2%u(B ?\$,2%v(B ?\$,2%w(B ?\$,2%x(B ?\$,2%y(B ?\$,2%z(B ?\$,2%{(B ?\$,2%|(B ?\$,2%}(B ?\$,2%~(B ?\$,2%(B | ||
| 1688 | ?\$,2& (B ?\$,2&!(B ?\$,2&"(B ?\$,2&#(B ?\$,2&$(B ?\$,2&%(B ?\$,2&&(B ?\$,2&'(B ?\$,2&((B ?\$,2&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B ?\$,2&s(B ?\$,2&t(B ?\$,1vr(B ?\$,1vt(B ?\$,1vu(B ?\$,2&x(B ?\$,2&y(B ?\$,2&z(B ?\$,2&{(B ?\$,2&|(B ?\$,2&}(B ?\$,2&~(B ?\$,2&(B | ||
| 1699 | ?\$,2' (B ?\$,2'!(B ?\$,2'"(B ?\$,2'#(B ?\$,2'$(B ?\$,2'%(B ?\$,2'&(B ?\$,2''(B ?\$,2'((B ?\$,2')(B ?\$,2'*(B ?\$,2'+(B ?\$,2',(B ?\$,2'-(B ?\$,2'.(B ?\$,2'/(B | ||
| 1700 | nil | ||
| 1701 | ;; mac-dingbats (241..254) -> emacs-mule mapping | ||
| 1702 | ?\$,2'1(B ?\$,2'2(B ?\$,2'3(B ?\$,2'4(B ?\$,2'5(B ?\$,2'6(B ?\$,2'7(B ?\$,2'8(B ?\$,2'9(B ?\$,2':(B ?\$,2';(B ?\$,2'<(B ?\$,2'=(B ?\$,2'>(B | ||
| 1703 | nil])) | ||
| 1704 | translation-table) | ||
| 1705 | (setq translation-table | ||
| 1706 | (make-translation-table-from-vector encoding-vector)) | ||
| 1707 | ;; (define-translation-table 'mac-dingbats-decoder translation-table) | ||
| 1708 | (define-translation-table 'mac-dingbats-encoder | ||
| 1709 | (char-table-extra-slot translation-table 0))) | ||
| 1710 | |||
| 1711 | (defvar mac-font-encoder-list | 1846 | (defvar mac-font-encoder-list |
| 1712 | '(("mac-roman" mac-roman-encoder | 1847 | '(("mac-roman" mac-roman-encoder |
| 1713 | ccl-encode-mac-roman-font "%s") | 1848 | ccl-encode-mac-roman-font "%s") |
| @@ -2012,37 +2147,11 @@ ascii:-*-Monaco-*-*-*-*-12-*-*-*-*-*-mac-roman") | |||
| 2012 | ;; Enable CLIPBOARD copy/paste through menu bar commands. | 2147 | ;; Enable CLIPBOARD copy/paste through menu bar commands. |
| 2013 | (menu-bar-enable-clipboard) | 2148 | (menu-bar-enable-clipboard) |
| 2014 | 2149 | ||
| 2015 | (defconst mac-system-coding-system | 2150 | ;; Initiate drag and drop |
| 2016 | (let ((base (or (cdr (assq mac-system-script-code | ||
| 2017 | mac-script-code-coding-systems)) | ||
| 2018 | 'mac-roman))) | ||
| 2019 | (if (eq system-type 'darwin) | ||
| 2020 | base | ||
| 2021 | (coding-system-change-eol-conversion base 'mac))) | ||
| 2022 | "Coding system derived from the system script code.") | ||
| 2023 | |||
| 2024 | (set-selection-coding-system mac-system-coding-system) | ||
| 2025 | 2151 | ||
| 2026 | (defun mac-drag-n-drop (event) | 2152 | (global-set-key [drag-n-drop] 'mac-dnd-handle-drag-n-drop-event) |
| 2027 | "Edit the files listed in the drag-n-drop EVENT. | 2153 | (global-set-key [M-drag-n-drop] 'mac-dnd-handle-drag-n-drop-event) |
| 2028 | Switch to a buffer editing the last file dropped." | ||
| 2029 | (interactive "e") | ||
| 2030 | ;; Make sure the drop target has positive co-ords | ||
| 2031 | ;; before setting the selected frame - otherwise it | ||
| 2032 | ;; won't work. <skx@tardis.ed.ac.uk> | ||
| 2033 | (let* ((window (posn-window (event-start event))) | ||
| 2034 | (coords (posn-x-y (event-start event))) | ||
| 2035 | (x (car coords)) | ||
| 2036 | (y (cdr coords))) | ||
| 2037 | (if (and (> x 0) (> y 0)) | ||
| 2038 | (set-frame-selected-window nil window)) | ||
| 2039 | (dolist (file-name (nth 2 event)) | ||
| 2040 | (dnd-handle-one-url window 'private | ||
| 2041 | (concat "file:" file-name)))) | ||
| 2042 | (select-frame-set-input-focus (selected-frame))) | ||
| 2043 | 2154 | ||
| 2044 | (global-set-key [drag-n-drop] 'mac-drag-n-drop) | ||
| 2045 | (global-set-key [M-drag-n-drop] 'mac-drag-n-drop) | ||
| 2046 | 2155 | ||
| 2047 | ;;;; Non-toolkit Scroll bars | 2156 | ;;;; Non-toolkit Scroll bars |
| 2048 | 2157 | ||
| @@ -2107,6 +2216,7 @@ Switch to a buffer editing the last file dropped." | |||
| 2107 | (scroll-up 1))) | 2216 | (scroll-up 1))) |
| 2108 | 2217 | ||
| 2109 | ) | 2218 | ) |
| 2219 | |||
| 2110 | 2220 | ||
| 2111 | ;;;; Others | 2221 | ;;;; Others |
| 2112 | 2222 | ||