Mercurial > emacs
comparison lisp/term/mac-win.el @ 83620:ce4352d8bee9
* loadup.el: Load mac-win on a Mac. Avoid loading both x-win and
mac-win.
* term/mac-win.el:
(mac-initialize-window-system): New function. Move global setup
here.
* s/darwin.h (SYSTEM_PURESIZE_EXTRA): Define here.
(SYSTEM_PURESIZE_EXTRA): Only define on Carbon.
* emacsclient.c (decode_options): Don't use a tty on mac carbon.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Sat, 19 May 2007 23:12:46 +0000 |
parents | 5da6a46ddbd6 |
children | 9c01792a3ce8 |
comparison
equal
deleted
inserted
replaced
83619:5da6a46ddbd6 | 83620:ce4352d8bee9 |
---|---|
1060 ;;;; Function keys | 1060 ;;;; Function keys |
1061 | 1061 |
1062 (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame | 1062 (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame |
1063 global-map) | 1063 global-map) |
1064 | 1064 |
1065 (defun x-setup-function-keys (frame) | |
1066 "Setup Function Keys for mac." | |
1065 ;; Map certain keypad keys into ASCII characters | 1067 ;; Map certain keypad keys into ASCII characters |
1066 ;; that people usually expect. | 1068 ;; that people usually expect. |
1067 (define-key local-function-key-map [backspace] [?\d]) | 1069 (define-key local-function-key-map [backspace] [?\d]) |
1068 (define-key local-function-key-map [delete] [?\d]) | 1070 (define-key local-function-key-map [delete] [?\d]) |
1069 (define-key local-function-key-map [tab] [?\t]) | 1071 (define-key local-function-key-map [tab] [?\t]) |
1076 (define-key local-function-key-map [M-tab] [?\M-\t]) | 1078 (define-key local-function-key-map [M-tab] [?\M-\t]) |
1077 (define-key local-function-key-map [M-linefeed] [?\M-\n]) | 1079 (define-key local-function-key-map [M-linefeed] [?\M-\n]) |
1078 (define-key local-function-key-map [M-clear] [?\M-\C-l]) | 1080 (define-key local-function-key-map [M-clear] [?\M-\C-l]) |
1079 (define-key local-function-key-map [M-return] [?\M-\C-m]) | 1081 (define-key local-function-key-map [M-return] [?\M-\C-m]) |
1080 (define-key local-function-key-map [M-escape] [?\M-\e]) | 1082 (define-key local-function-key-map [M-escape] [?\M-\e]) |
1083 ) | |
1081 | 1084 |
1082 ;; These tell read-char how to convert | 1085 ;; These tell read-char how to convert |
1083 ;; these special chars to ASCII. | 1086 ;; these special chars to ASCII. |
1084 (put 'backspace 'ascii-character ?\d) | 1087 (put 'backspace 'ascii-character ?\d) |
1085 (put 'delete 'ascii-character ?\d) | 1088 (put 'delete 'ascii-character ?\d) |
2279 (dolist (item (mac-ae-list ae)) | 2282 (dolist (item (mac-ae-list ae)) |
2280 (if (not (equal (car item) "null")) | 2283 (if (not (equal (car item) "null")) |
2281 (mac-dnd-drop-data event (selected-frame) window | 2284 (mac-dnd-drop-data event (selected-frame) window |
2282 (cdr item) (car item) action))))) | 2285 (cdr item) (car item) action))))) |
2283 | 2286 |
2284 ;;; Do the actual Windows setup here; the above code just defines | |
2285 ;;; functions and variables that we use now. | |
2286 | |
2287 (setq command-line-args (x-handle-args command-line-args)) | |
2288 | |
2289 ;;; Make sure we have a valid resource name. | |
2290 (or (stringp x-resource-name) | |
2291 (let (i) | |
2292 (setq x-resource-name (invocation-name)) | |
2293 | |
2294 ;; Change any . or * characters in x-resource-name to hyphens, | |
2295 ;; so as not to choke when we use it in X resource queries. | |
2296 (while (setq i (string-match "[.*]" x-resource-name)) | |
2297 (aset x-resource-name i ?-)))) | |
2298 | |
2299 (if (x-display-list) | |
2300 ;; On Mac OS 8/9, Most coding systems used in code conversion for | |
2301 ;; font names are not ready at the time when the terminal frame is | |
2302 ;; created. So we reconstruct font name table for the initial | |
2303 ;; frame. | |
2304 (mac-clear-font-name-table) | |
2305 (x-open-connection "Mac" | |
2306 x-command-line-resources | |
2307 ;; Exit Emacs with fatal error if this fails. | |
2308 t)) | |
2309 | |
2310 (setq frame-creation-function 'x-create-frame-with-faces) | |
2311 | |
2312 (defvar mac-font-encoder-list | 2287 (defvar mac-font-encoder-list |
2313 '(("mac-roman" mac-roman-encoder | 2288 '(("mac-roman" mac-roman-encoder |
2314 ccl-encode-mac-roman-font "%s") | 2289 ccl-encode-mac-roman-font "%s") |
2315 ("mac-centraleurroman" encode-mac-centraleurroman | 2290 ("mac-centraleurroman" encode-mac-centraleurroman |
2316 ccl-encode-mac-centraleurroman-font "%s ce") | 2291 ccl-encode-mac-centraleurroman-font "%s ce") |
2484 (let ((fontset | 2459 (let ((fontset |
2485 (create-fontset-from-ascii-font font resolved-font fontset-name))) | 2460 (create-fontset-from-ascii-font font resolved-font fontset-name))) |
2486 (fontset-add-mac-fonts fontset t) | 2461 (fontset-add-mac-fonts fontset t) |
2487 fontset)) | 2462 fontset)) |
2488 | 2463 |
2464 (defun x-win-suspend-error () | |
2465 (error "Suspending an Emacs running under Mac makes no sense")) | |
2466 | |
2467 (defalias 'x-cut-buffer-or-selection-value 'x-get-selection-value) | |
2468 | |
2469 (defvar mac-initialized nil | |
2470 "Non-nil if the w32 window system has been initialized.") | |
2471 | |
2472 (defun mac-initialize-window-system () | |
2473 "Initialize Emacs for Mac GUI frames." | |
2474 | |
2475 ;;; Do the actual Windows setup here; the above code just defines | |
2476 ;;; functions and variables that we use now. | |
2477 | |
2478 (setq command-line-args (x-handle-args command-line-args)) | |
2479 | |
2480 ;;; Make sure we have a valid resource name. | |
2481 (or (stringp x-resource-name) | |
2482 (let (i) | |
2483 (setq x-resource-name (invocation-name)) | |
2484 | |
2485 ;; Change any . or * characters in x-resource-name to hyphens, | |
2486 ;; so as not to choke when we use it in X resource queries. | |
2487 (while (setq i (string-match "[.*]" x-resource-name)) | |
2488 (aset x-resource-name i ?-)))) | |
2489 | |
2490 (if (x-display-list) | |
2491 ;; On Mac OS 8/9, Most coding systems used in code conversion for | |
2492 ;; font names are not ready at the time when the terminal frame is | |
2493 ;; created. So we reconstruct font name table for the initial | |
2494 ;; frame. | |
2495 (mac-clear-font-name-table) | |
2496 (x-open-connection "Mac" | |
2497 x-command-line-resources | |
2498 ;; Exit Emacs with fatal error if this fails. | |
2499 t)) | |
2500 | |
2501 (add-hook 'suspend-hook 'x-win-suspend-error) | |
2502 | |
2503 ;;; Arrange for the kill and yank functions to set and check the clipboard. | |
2504 (setq interprogram-cut-function 'x-select-text) | |
2505 (setq interprogram-paste-function 'x-get-selection-value) | |
2506 | |
2507 | |
2508 | |
2509 | |
2510 ;;; Turn off window-splitting optimization; Mac is usually fast enough | |
2511 ;;; that this is only annoying. | |
2512 (setq split-window-keep-point t) | |
2513 | |
2514 ;; Don't show the frame name; that's redundant. | |
2515 (setq-default mode-line-frame-identification " ") | |
2516 | |
2517 ;; Turn on support for mouse wheels. | |
2518 (mouse-wheel-mode 1) | |
2519 | |
2520 | |
2521 ;; Enable CLIPBOARD copy/paste through menu bar commands. | |
2522 (menu-bar-enable-clipboard) | |
2523 | |
2524 | |
2525 ;; Initiate drag and drop | |
2526 | |
2527 (define-key special-event-map [drag-n-drop] 'mac-dnd-handle-drag-n-drop-event) | |
2528 | |
2529 | |
2530 ;;;; Non-toolkit Scroll bars | |
2531 | |
2532 (unless x-toolkit-scroll-bars | |
2533 | |
2534 ;; for debugging | |
2535 ;; (defun mac-handle-scroll-bar-event (event) (interactive "e") (princ event)) | |
2536 | |
2537 ;;(global-set-key [vertical-scroll-bar mouse-1] 'mac-handle-scroll-bar-event) | |
2538 | |
2539 (global-set-key | |
2540 [vertical-scroll-bar down-mouse-1] | |
2541 'mac-handle-scroll-bar-event) | |
2542 | |
2543 (global-unset-key [vertical-scroll-bar drag-mouse-1]) | |
2544 (global-unset-key [vertical-scroll-bar mouse-1]) | |
2545 | |
2489 ;; Adjust Courier font specifications in x-fixed-font-alist. | 2546 ;; Adjust Courier font specifications in x-fixed-font-alist. |
2490 (let ((courier-fonts (assoc "Courier" x-fixed-font-alist))) | 2547 (let ((courier-fonts (assoc "Courier" x-fixed-font-alist))) |
2491 (if courier-fonts | 2548 (if courier-fonts |
2492 (dolist (label-fonts (cdr courier-fonts)) | 2549 (dolist (label-fonts (cdr courier-fonts)) |
2493 (setcdr label-fonts | 2550 (setcdr label-fonts |
2590 (if (and rv | 2647 (if (and rv |
2591 (string-match "^\\(true\\|yes\\|on\\)$" rv)) | 2648 (string-match "^\\(true\\|yes\\|on\\)$" rv)) |
2592 (setq default-frame-alist | 2649 (setq default-frame-alist |
2593 (cons '(reverse . t) default-frame-alist))))) | 2650 (cons '(reverse . t) default-frame-alist))))) |
2594 | 2651 |
2595 (defun x-win-suspend-error () | |
2596 (error "Suspending an Emacs running under Mac makes no sense")) | |
2597 | |
2598 (defalias 'x-cut-buffer-or-selection-value 'x-get-selection-value) | |
2599 | |
2600 (defvar mac-initialized nil | |
2601 "Non-nil if the w32 window system has been initialized.") | |
2602 | |
2603 (defun mac-initialize-window-system () | |
2604 "Initialize Emacs for Mac GUI frames." | |
2605 | |
2606 (add-hook 'suspend-hook 'x-win-suspend-error) | |
2607 | |
2608 ;;; Arrange for the kill and yank functions to set and check the clipboard. | |
2609 (setq interprogram-cut-function 'x-select-text) | |
2610 (setq interprogram-paste-function 'x-get-selection-value) | |
2611 | |
2612 | |
2613 | |
2614 | |
2615 ;;; Turn off window-splitting optimization; Mac is usually fast enough | |
2616 ;;; that this is only annoying. | |
2617 (setq split-window-keep-point t) | |
2618 | |
2619 ;; Don't show the frame name; that's redundant. | |
2620 (setq-default mode-line-frame-identification " ") | |
2621 | |
2622 ;; Turn on support for mouse wheels. | |
2623 (mouse-wheel-mode 1) | |
2624 | |
2625 | |
2626 ;; Enable CLIPBOARD copy/paste through menu bar commands. | |
2627 (menu-bar-enable-clipboard) | |
2628 | |
2629 | |
2630 ;; Initiate drag and drop | |
2631 | |
2632 (define-key special-event-map [drag-n-drop] 'mac-dnd-handle-drag-n-drop-event) | |
2633 | |
2634 | |
2635 ;;;; Non-toolkit Scroll bars | |
2636 | |
2637 (unless x-toolkit-scroll-bars | |
2638 | |
2639 ;; for debugging | |
2640 ;; (defun mac-handle-scroll-bar-event (event) (interactive "e") (princ event)) | |
2641 | |
2642 ;;(global-set-key [vertical-scroll-bar mouse-1] 'mac-handle-scroll-bar-event) | |
2643 | |
2644 (global-set-key | |
2645 [vertical-scroll-bar down-mouse-1] | |
2646 'mac-handle-scroll-bar-event) | |
2647 | |
2648 (global-unset-key [vertical-scroll-bar drag-mouse-1]) | |
2649 (global-unset-key [vertical-scroll-bar mouse-1]) | |
2650 | |
2651 (setq mac-initialized t))) | 2652 (setq mac-initialized t))) |
2652 | 2653 |
2653 (defun mac-handle-scroll-bar-event (event) | 2654 (defun mac-handle-scroll-bar-event (event) |
2654 "Handle scroll bar EVENT to emulate Mac Toolbox style scrolling." | 2655 "Handle scroll bar EVENT to emulate Mac Toolbox style scrolling." |
2655 (interactive "e") | 2656 (interactive "e") |