diff options
author | Miles Bader <miles@gnu.org> | 2007-10-11 16:24:58 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2007-10-11 16:24:58 +0000 |
commit | c73bd236f75b742ad4642ec94798987ae6e3e1e8 (patch) | |
tree | ef5edc8db557fc1d25a17c379e4ae63a38b3ba5c /lisp/term/mac-win.el | |
parent | ecb21060d5c1752d41d7a742be565c59b5fcb855 (diff) | |
parent | 58ade22bf16a9ec2ff0aee6c59d8db4d1703e94f (diff) | |
download | emacs-c73bd236f75b742ad4642ec94798987ae6e3e1e8.tar.gz |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 866-879)
- Merge multi-tty branch
- Update from CVS
- Merge from emacs--rel--22
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-257
Diffstat (limited to 'lisp/term/mac-win.el')
-rw-r--r-- | lisp/term/mac-win.el | 170 |
1 files changed, 108 insertions, 62 deletions
diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el index a89d0fe306f..d638f97ede3 100644 --- a/lisp/term/mac-win.el +++ b/lisp/term/mac-win.el @@ -65,8 +65,8 @@ ;; An alist of X options and the function which handles them. See ;; ../startup.el. -(if (not (eq window-system 'mac)) - (error "%s: Loading mac-win.el but not compiled for Mac" (invocation-name))) +;; (if (not (eq window-system 'mac)) +;; (error "%s: Loading mac-win.el but not compiled for Mac" (invocation-name))) (require 'frame) (require 'mouse) @@ -76,7 +76,6 @@ (require 'menu-bar) (require 'fontset) (require 'dnd) -(eval-when-compile (require 'url)) (defvar mac-charset-info-alist) (defvar mac-service-selection) @@ -1062,22 +1061,25 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp") (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame global-map) +(defun x-setup-function-keys (frame) + "Setup Function Keys for mac." ;; Map certain keypad keys into ASCII characters ;; that people usually expect. -(define-key function-key-map [backspace] [?\d]) -(define-key function-key-map [delete] [?\d]) -(define-key function-key-map [tab] [?\t]) -(define-key function-key-map [linefeed] [?\n]) -(define-key function-key-map [clear] [?\C-l]) -(define-key function-key-map [return] [?\C-m]) -(define-key function-key-map [escape] [?\e]) -(define-key function-key-map [M-backspace] [?\M-\d]) -(define-key function-key-map [M-delete] [?\M-\d]) -(define-key function-key-map [M-tab] [?\M-\t]) -(define-key function-key-map [M-linefeed] [?\M-\n]) -(define-key function-key-map [M-clear] [?\M-\C-l]) -(define-key function-key-map [M-return] [?\M-\C-m]) -(define-key function-key-map [M-escape] [?\M-\e]) +(define-key local-function-key-map [backspace] [?\d]) +(define-key local-function-key-map [delete] [?\d]) +(define-key local-function-key-map [tab] [?\t]) +(define-key local-function-key-map [linefeed] [?\n]) +(define-key local-function-key-map [clear] [?\C-l]) +(define-key local-function-key-map [return] [?\C-m]) +(define-key local-function-key-map [escape] [?\e]) +(define-key local-function-key-map [M-backspace] [?\M-\d]) +(define-key local-function-key-map [M-delete] [?\M-\d]) +(define-key local-function-key-map [M-tab] [?\M-\t]) +(define-key local-function-key-map [M-linefeed] [?\M-\n]) +(define-key local-function-key-map [M-clear] [?\M-\C-l]) +(define-key local-function-key-map [M-return] [?\M-\C-m]) +(define-key local-function-key-map [M-escape] [?\M-\e]) +) ;; These tell read-char how to convert ;; these special chars to ASCII. @@ -2412,6 +2414,88 @@ It returns a name of the created fontset." (new-fontset fontset-name (list (cons 'ascii resolved-font))) (fontset-add-mac-fonts fontset-name base-family))) +(defun x-win-suspend-error () + (error "Suspending an Emacs running under Mac makes no sense")) + +(defalias 'x-cut-buffer-or-selection-value 'x-get-selection-value) + +(defvar mac-initialized nil + "Non-nil if the w32 window system has been initialized.") + +(defun mac-initialize-window-system () + "Initialize Emacs for Mac GUI frames." + +;;; Do the actual Windows setup here; the above code just defines +;;; functions and variables that we use now. + +(setq command-line-args (x-handle-args command-line-args)) + +;;; Make sure we have a valid resource name. +(or (stringp x-resource-name) + (let (i) + (setq x-resource-name (invocation-name)) + + ;; Change any . or * characters in x-resource-name to hyphens, + ;; so as not to choke when we use it in X resource queries. + (while (setq i (string-match "[.*]" x-resource-name)) + (aset x-resource-name i ?-)))) + +(if (x-display-list) + ;; On Mac OS 8/9, Most coding systems used in code conversion for + ;; font names are not ready at the time when the terminal frame is + ;; created. So we reconstruct font name table for the initial + ;; frame. + (mac-clear-font-name-table) + (x-open-connection "Mac" + x-command-line-resources + ;; Exit Emacs with fatal error if this fails. + t)) + +(add-hook 'suspend-hook 'x-win-suspend-error) + +;;; Arrange for the kill and yank functions to set and check the clipboard. +(setq interprogram-cut-function 'x-select-text) +(setq interprogram-paste-function 'x-get-selection-value) + + + + +;;; Turn off window-splitting optimization; Mac is usually fast enough +;;; that this is only annoying. +(setq split-window-keep-point t) + +;; Don't show the frame name; that's redundant. +(setq-default mode-line-frame-identification " ") + +;; Turn on support for mouse wheels. +(mouse-wheel-mode 1) + + +;; Enable CLIPBOARD copy/paste through menu bar commands. +(menu-bar-enable-clipboard) + + +;; Initiate drag and drop + +(define-key special-event-map [drag-n-drop] 'mac-dnd-handle-drag-n-drop-event) + + +;;;; Non-toolkit Scroll bars + +(unless x-toolkit-scroll-bars + +;; for debugging +;; (defun mac-handle-scroll-bar-event (event) (interactive "e") (princ event)) + +;;(global-set-key [vertical-scroll-bar mouse-1] 'mac-handle-scroll-bar-event) + +(global-set-key + [vertical-scroll-bar down-mouse-1] + 'mac-handle-scroll-bar-event) + +(global-unset-key [vertical-scroll-bar drag-mouse-1]) +(global-unset-key [vertical-scroll-bar mouse-1]) + ;; Adjust Courier font specifications in x-fixed-font-alist. (let ((courier-fonts (assoc "Courier" x-fixed-font-alist))) (if courier-fonts @@ -2477,50 +2561,7 @@ It returns a name of the created fontset." (setq default-frame-alist (cons '(reverse . t) default-frame-alist))))) -(defun x-win-suspend-error () - (error "Suspending an Emacs running under Mac makes no sense")) -(add-hook 'suspend-hook 'x-win-suspend-error) - -;;; Arrange for the kill and yank functions to set and check the clipboard. -(setq interprogram-cut-function 'x-select-text) -(setq interprogram-paste-function 'x-get-selection-value) - -(defalias 'x-cut-buffer-or-selection-value 'x-get-selection-value) - -;;; Turn off window-splitting optimization; Mac is usually fast enough -;;; that this is only annoying. -(setq split-window-keep-point t) - -;; Don't show the frame name; that's redundant. -(setq-default mode-line-frame-identification " ") - -;; Turn on support for mouse wheels. -(mouse-wheel-mode 1) - - -;; Enable CLIPBOARD copy/paste through menu bar commands. -(menu-bar-enable-clipboard) - -;; Initiate drag and drop - -(define-key special-event-map [drag-n-drop] 'mac-dnd-handle-drag-n-drop-event) - - -;;;; Non-toolkit Scroll bars - -(unless x-toolkit-scroll-bars - -;; for debugging -;; (defun mac-handle-scroll-bar-event (event) (interactive "e") (princ event)) - -;;(global-set-key [vertical-scroll-bar mouse-1] 'mac-handle-scroll-bar-event) - -(global-set-key - [vertical-scroll-bar down-mouse-1] - 'mac-handle-scroll-bar-event) - -(global-unset-key [vertical-scroll-bar drag-mouse-1]) -(global-unset-key [vertical-scroll-bar mouse-1]) +(setq mac-initialized t))) (defun mac-handle-scroll-bar-event (event) "Handle scroll bar EVENT to emulate Mac Toolbox style scrolling." @@ -2568,7 +2609,6 @@ It returns a name of the created fontset." (mac-scroll-ignore-events) (scroll-up 1))) -) ;;;; Others @@ -2606,5 +2646,11 @@ It returns a name of the created fontset." ;; or bold bitmap versions will not display these variants correctly. (setq scalable-fonts-allowed t) +(add-to-list 'handle-args-function-alist '(mac . x-handle-args)) +(add-to-list 'frame-creation-function-alist '(mac . x-create-frame-with-faces)) +(add-to-list 'window-system-initialization-alist '(mac . mac-initialize-window-system)) + +(provide 'mac-win) + ;; arch-tag: 71dfcd14-cde8-4d66-b05c-85ec94fb23a6 ;;; mac-win.el ends here |