;;; mac-win.el --- parse switches controlling interface with Mac window system -*-coding: iso-2022-7bit;-*-
-;; Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005
+;; Copyright (C) 1999, 2000, 2002, 2003, 2005
;; Free Software Foundation, Inc.
;; Author: Andrew Choi <akochoi@mac.com>
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
(require 'mouse)
(require 'scroll-bar)
(require 'faces)
-;;(require 'select)
+(require 'select)
(require 'menu-bar)
(require 'fontset)
(require 'dnd)
(let ((param (nth 3 aelt)))
(setq default-frame-alist
(cons (cons param
- (string-to-int (car x-invocation-args)))
+ (string-to-number (car x-invocation-args)))
default-frame-alist)
x-invocation-args
(cdr x-invocation-args))))))
(define-key special-event-map [language-change] 'mac-handle-language-change)
\f
-;;;; Selections and cut buffers
-
-;; Setup to use the Mac clipboard. The functions mac-cut-function and
-;; mac-paste-function are defined in mac.c.
-(set-selection-coding-system 'compound-text-mac)
-
-(setq interprogram-cut-function
- '(lambda (str push)
- (mac-cut-function
- (encode-coding-string str selection-coding-system t) push)))
-
-(setq interprogram-paste-function
- '(lambda ()
- (let ((clipboard (mac-paste-function)))
- (if clipboard
- (decode-coding-string clipboard selection-coding-system t)))))
-
+;;;; Selections and Services menu
+
+;; Setup to use the Mac clipboard.
+(set-selection-coding-system mac-system-coding-system)
+
+;;; 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-get-selection-value.
+(defvar x-last-selected-text-clipboard nil
+ "The value of the CLIPBOARD 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.")
+
+(defcustom x-select-enable-clipboard t
+ "*Non-nil means cutting and pasting uses the clipboard.
+This is in addition to the primary selection."
+ :type 'boolean
+ :group 'killing)
+
+;;; Make TEXT, a string, the primary X selection.
+(defun x-select-text (text &optional push)
+ (x-set-selection 'PRIMARY text)
+ (setq x-last-selected-text-primary text)
+ (if (not x-select-enable-clipboard)
+ (setq x-last-selected-text-clipboard nil)
+ (x-set-selection 'CLIPBOARD text)
+ (setq x-last-selected-text-clipboard text))
+ )
+
+(defun x-get-selection (&optional type data-type)
+ "Return the value of a selection.
+The argument TYPE (default `PRIMARY') says which selection,
+and the argument DATA-TYPE (default `STRING') says
+how to convert the data.
+
+TYPE may be any symbol \(but nil stands for `PRIMARY'). However,
+only a few symbols are commonly used. They conventionally have
+all upper-case names. The most often used ones, in addition to
+`PRIMARY', are `SECONDARY' and `CLIPBOARD'.
+
+DATA-TYPE is usually `STRING', but can also be one of the symbols
+in `selection-converter-alist', which see."
+ (let ((data (x-get-selection-internal (or type 'PRIMARY)
+ (or data-type 'STRING)))
+ (coding (or next-selection-coding-system
+ selection-coding-system)))
+ (when (and (stringp data)
+ (setq data-type (get-text-property 0 'foreign-selection data)))
+ (cond ((eq data-type 'public.utf16-plain-text)
+ (let ((encoded (and (fboundp 'mac-code-convert-string)
+ (mac-code-convert-string data
+ 'utf-16 coding))))
+ (if encoded
+ (let ((coding-save last-coding-system-used))
+ (setq data (decode-coding-string encoded coding))
+ (setq last-coding-system-used coding-save))
+ (setq data
+ (decode-coding-string data 'utf-16)))))
+ ((eq data-type 'com.apple.traditional-mac-plain-text)
+ (setq data (decode-coding-string data coding)))
+ ((eq data-type 'public.file-url)
+ (setq data (decode-coding-string data 'utf-8))
+ ;; Remove a trailing nul character.
+ (let ((len (length data)))
+ (if (and (> len 0) (= (aref data (1- len)) ?\0))
+ (setq data (substring data 0 (1- len)))))))
+ (put-text-property 0 (length data) 'foreign-selection data-type data))
+ data))
+
+(defun x-selection-value (type)
+ (let ((data-types '(public.utf16-plain-text
+ com.apple.traditional-mac-plain-text
+ public.file-url))
+ text tiff-image)
+ (while (and (null text) data-types)
+ (setq text (condition-case nil
+ (x-get-selection type (car data-types))
+ (error nil)))
+ (setq data-types (cdr data-types)))
+ (if text
+ (remove-text-properties 0 (length text) '(foreign-selection nil) text))
+ (setq tiff-image (condition-case nil
+ (x-get-selection type 'public.tiff)
+ (error nil)))
+ (when tiff-image
+ (remove-text-properties 0 (length tiff-image)
+ '(foreign-selection nil) tiff-image)
+ (setq tiff-image (create-image tiff-image 'tiff t))
+ (or text (setq text " "))
+ (put-text-property 0 (length text) 'display tiff-image text))
+ text))
+
+;;; Return the value of the current selection.
+;;; 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-get-selection-value ()
+ (let (clip-text primary-text)
+ (if (not x-select-enable-clipboard)
+ (setq x-last-selected-text-clipboard nil)
+ (setq clip-text (x-selection-value 'CLIPBOARD))
+ (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))))
+ )
+
+ (setq primary-text (x-selection-value 'PRIMARY))
+ ;; 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))))
+
+ ;; As we have done one selection, clear this now.
+ (setq next-selection-coding-system nil)
+
+ ;; At this point we have recorded the current values for the
+ ;; selection from clipboard (if we are supposed to) and primary,
+ ;; So return the first one that has changed (which is the first
+ ;; non-null one).
+ (or clip-text primary-text)
+ ))
+
+(put 'CLIPBOARD 'mac-scrap-name "com.apple.scrap.clipboard")
+(when (eq system-type 'darwin)
+ (put 'FIND 'mac-scrap-name "com.apple.scrap.find")
+ (put 'PRIMARY 'mac-scrap-name
+ (format "org.gnu.Emacs.%d.selection.PRIMARY" (emacs-pid))))
+(put 'com.apple.traditional-mac-plain-text 'mac-ostype "TEXT")
+(put 'public.utf16-plain-text 'mac-ostype "utxt")
+(put 'public.tiff 'mac-ostype "TIFF")
+(put 'public.file-url 'mac-ostype "furl")
+
+(defun mac-select-convert-to-string (selection type value)
+ (let ((str (cdr (xselect-convert-to-string selection nil value)))
+ coding)
+ (setq coding (or next-selection-coding-system selection-coding-system))
+ (if coding
+ (setq coding (coding-system-base coding))
+ (setq coding 'raw-text))
+ (when str
+ ;; If TYPE is nil, this is a local request, thus return STR as
+ ;; is. Otherwise, encode STR.
+ (if (not type)
+ str
+ (let ((inhibit-read-only t))
+ (remove-text-properties 0 (length str) '(composition nil) str)
+ (cond
+ ((eq type 'public.utf16-plain-text)
+ (let (s)
+ (when (and (fboundp 'mac-code-convert-string)
+ (memq coding (find-coding-systems-string str)))
+ (setq coding (coding-system-change-eol-conversion coding 'mac))
+ (setq s (mac-code-convert-string
+ (encode-coding-string str coding)
+ coding 'utf-16)))
+ (setq str (or s (encode-coding-string str 'utf-16-mac)))))
+ ((eq type 'com.apple.traditional-mac-plain-text)
+ (let ((encodables (find-coding-systems-string str))
+ (rest mac-script-code-coding-systems))
+ (unless (memq coding encodables)
+ (while (and rest (not (memq (cdar rest) encodables)))
+ (setq rest (cdr rest)))
+ (if rest
+ (setq coding (cdar rest)))))
+ (setq coding (coding-system-change-eol-conversion coding 'mac))
+ (setq str (encode-coding-string str coding)))
+ (t
+ (error "Unknown selection type: %S" type))
+ )))
+
+ (setq next-selection-coding-system nil)
+ (cons type str))))
+
+(defun mac-select-convert-to-file-url (selection type value)
+ (let ((filename (xselect-convert-to-filename selection type value))
+ (coding (or file-name-coding-system default-file-name-coding-system)))
+ (if (and filename coding)
+ (setq filename (encode-coding-string filename coding)))
+ (and filename
+ (concat "file://localhost"
+ (mapconcat 'url-hexify-string
+ (split-string filename "/") "/")))))
+
+(setq selection-converter-alist
+ (nconc
+ '((public.utf16-plain-text . mac-select-convert-to-string)
+ (com.apple.traditional-mac-plain-text . mac-select-convert-to-string)
+ ;; This is not enabled by default because the `Import Image'
+ ;; menu makes Emacs crash or hang for unknown reasons.
+ ;; (public.tiff . nil)
+ (public.file-url . mac-select-convert-to-file-url)
+ )
+ selection-converter-alist))
+
+(defun mac-services-open-file ()
+ (interactive)
+ (find-file-existing (x-selection-value mac-services-selection)))
+
+(defun mac-services-open-selection ()
+ (interactive)
+ (switch-to-buffer (generate-new-buffer "*untitled*"))
+ (insert (x-selection-value mac-services-selection))
+ (sit-for 0)
+ (save-buffer) ; It pops up the save dialog.
+ )
+
+(defun mac-services-insert-text ()
+ (interactive)
+ (let ((text (x-selection-value mac-services-selection)))
+ (if (not buffer-read-only)
+ (insert text)
+ (kill-new text)
+ (message
+ (substitute-command-keys
+ "The text from the Services menu can be accessed with \\[yank]")))))
+
+(defvar mac-application-menu-map (make-sparse-keymap))
+(define-key mac-application-menu-map [quit] 'save-buffers-kill-emacs)
+(define-key mac-application-menu-map [services perform open-file]
+ 'mac-services-open-file)
+(define-key mac-application-menu-map [services perform open-selection]
+ 'mac-services-open-selection)
+(define-key mac-application-menu-map [services paste]
+ 'mac-services-insert-text)
+(define-key mac-application-menu-map [preferences] 'customize)
+(define-key mac-application-menu-map [about] 'display-splash-screen)
+(global-set-key [menu-bar application] mac-application-menu-map)
\f
;;; Do the actual Windows setup here; the above code just defines
;;; functions and variables that we use now.
(coding-system-put 'mac-cyrillic 'mime-charset 'x-mac-cyrillic)
(let
- ((encoding-vector (make-vector 256 nil))
- (i 0)
- (vec
+ ((encoding-vector
(vconcat
(make-vector 32 nil)
;; mac-symbol (32..126) -> emacs-mule mapping
?\\e$,1'@\e(B ?\\e$,1'8\e(B ?\\e$,1'A\e(B ?\\e$,1'C\e(B ?\\e$,1'D\e(B ?\\e$,1'E\e(B ?\\e$,1'V\e(B ?\\e$,1'I\e(B ?\\e$,1'>\e(B ?\\e$,1'H\e(B ?\\e$,1'6\e(B ?\{ ?\| ?\} ?\\e$,1x\\e(B]
(make-vector (- 160 127) nil)
;; mac-symbol (160..254) -> emacs-mule mapping
+ ;; Mapping of the following characters are changed from the
+ ;; original one:
+ ;; 0xE2 0x00AE+0xF87F -> 0x00AE # REGISTERED SIGN, alternate: sans serif
+ ;; 0xE3 0x00A9+0xF87F -> 0x00A9 # COPYRIGHT SIGN, alternate: sans serif
+ ;; 0xE4 0x2122+0xF87F -> 0x2122 # TRADE MARK SIGN, alternate: sans serif
[?\\e$,1tL\e(B ?\\e$,1'R\e(B ?\\e$,1s2\e(B ?\\e$,1y$\e(B ?\\e$,1sD\e(B ?\\e$,1x>\e(B ?\\e$,1!R\e(B ?\\e$,2#c\e(B ?\\e$,2#f\e(B ?\\e$,2#e\e(B ?\\e$,2#`\e(B ?\\e$,1vt\e(B ?\\e$,1vp\e(B ?\\e$,1vq\e(B ?\\e$,1vr\e(B ?\\e$,1vs\e(B
?\\e,A0\e(B ?\\e,A1\e(B ?\\e$,1s3\e(B ?\\e$,1y%\e(B ?\\e,AW\e(B ?\\e$,1x=\e(B ?\\e$,1x"\e(B ?\\e$,1s"\e(B ?\\e,Aw\e(B ?\\e$,1y \e(B ?\\e$,1y!\e(B ?\\e$,1xh\e(B ?\\e$,1s&\e(B ?\\e$,1|p\e(B ?\\e$,1|O\e(B ?\\e$,1w5\e(B
?\\e$,1uu\e(B ?\\e$,1uQ\e(B ?\\e$,1u\\e(B ?\\e$,1uX\e(B ?\\e$,1yW\e(B ?\\e$,1yU\e(B ?\\e$,1x%\e(B ?\\e$,1xI\e(B ?\\e$,1xJ\e(B ?\\e$,1yC\e(B ?\\e$,1yG\e(B ?\\e$,1yD\e(B ?\\e$,1yB\e(B ?\\e$,1yF\e(B ?\\e$,1x(\e(B ?\\e$,1x)\e(B
?\\e$,1x@\e(B ?\\e$,1x'\e(B ?\\e,A.\e(B ?\\e,A)\e(B ?\\e$,1ub\e(B ?\\e$,1x/\e(B ?\\e$,1x:\e(B ?\\e$,1z%\e(B ?\\e,A,\e(B ?\\e$,1xG\e(B ?\\e$,1xH\e(B ?\\e$,1wT\e(B ?\\e$,1wP\e(B ?\\e$,1wQ\e(B ?\\e$,1wR\e(B ?\\e$,1wS\e(B
- ?\\e$,2"*\e(B ?\\e$B!R\e(B ?\\e,A.\e(B ?\\e,A)\e(B ?\\e$,1ub\e(B ?\\e$,1x1\e(B ?\\e$,1|;\e(B ?\\e$,1|<\e(B ?\\e$,1|=\e(B ?\\e$,1|A\e(B ?\\e$,1|B\e(B ?\\e$,1|C\e(B ?\\e$,1|G\e(B ?\\e$,1|H\e(B ?\\e$,1|I\e(B ?\\e$,1|J\e(B
- ?\\e$,3b_\e(B ?\\e$B!S\e(B ?\\e$,1xK\e(B ?\\e$,1{ \e(B ?\\e$,1|N\e(B ?\\e$,1{!\e(B ?\\e$,1|>\e(B ?\\e$,1|?\e(B ?\\e$,1|@\e(B ?\\e$,1|D\e(B ?\\e$,1|E\e(B ?\\e$,1|F\e(B ?\\e$,1|K\e(B ?\\e$,1|L\e(B ?\\e$,1|M\e(B]
- ))
- len translation-table)
- (setq len (length vec))
- (while (< i len)
- (aset encoding-vector i
- (if (null (aref vec i)) i
- ;; (decode-char 'ucs (aref vec i))
- (aref vec i)
- ))
- (setq i (1+ i)))
- (while (< i 256)
- (setq i (1+ i)))
+ ?\\e$,2"*\e(B ?\\e$,2=H\e(B ?\\e,A.\e(B ?\\e,A)\e(B ?\\e$,1ub\e(B ?\\e$,1x1\e(B ?\\e$,1|;\e(B ?\\e$,1|<\e(B ?\\e$,1|=\e(B ?\\e$,1|A\e(B ?\\e$,1|B\e(B ?\\e$,1|C\e(B ?\\e$,1|G\e(B ?\\e$,1|H\e(B ?\\e$,1|I\e(B ?\\e$,1|J\e(B
+ ?\\e$,3b_\e(B ?\\e$,2=I\e(B ?\\e$,1xK\e(B ?\\e$,1{ \e(B ?\\e$,1|N\e(B ?\\e$,1{!\e(B ?\\e$,1|>\e(B ?\\e$,1|?\e(B ?\\e$,1|@\e(B ?\\e$,1|D\e(B ?\\e$,1|E\e(B ?\\e$,1|F\e(B ?\\e$,1|K\e(B ?\\e$,1|L\e(B ?\\e$,1|M\e(B
+ nil]))
+ translation-table)
(setq translation-table
(make-translation-table-from-vector encoding-vector))
;; (define-translation-table 'mac-symbol-decoder translation-table)
(char-table-extra-slot translation-table 0)))
(let
- ((encoding-vector (make-vector 256 nil))
- (i 0)
- (vec
+ ((encoding-vector
(vconcat
(make-vector 32 nil)
;; mac-dingbats (32..126) -> emacs-mule mapping
?\\e$,2%`\e(B ?\\e$,2%a\e(B ?\\e$,2%b\e(B ?\\e$,2%c\e(B ?\\e$,2%d\e(B ?\\e$,2%e\e(B ?\\e$,2%f\e(B ?\\e$,2%g\e(B ?\\e$,2"e\e(B ?\\e$,2%i\e(B ?\\e$,2%j\e(B ?\\e$,2%k\e(B ?\\e$,2%l\e(B ?\\e$,2%m\e(B ?\\e$,2%n\e(B ?\\e$,2%o\e(B
?\\e$,2%p\e(B ?\\e$,2%q\e(B ?\\e$,2%r\e(B ?\\e$,2%s\e(B ?\\e$,2%t\e(B ?\\e$,2%u\e(B ?\\e$,2%v\e(B ?\\e$,2%w\e(B ?\\e$,2%x\e(B ?\\e$,2%y\e(B ?\\e$,2%z\e(B ?\\e$,2%{\e(B ?\\e$,2%|\e(B ?\\e$,2%}\e(B ?\\e$,2%~\e(B ?\\e$,2%\7f\e(B
?\\e$,2& \e(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?\\e$,2'#\e(B ?\\e$,2'$\e(B ?\\e$,2'%\e(B ?\\e$,2'&\e(B ?\\e$,2''\e(B ?\\e$,2'(\e(B ?\\e$,2')\e(B ?\\e$,2'*\e(B ?\\e$,2'+\e(B ?\\e$,2',\e(B ?\\e$,2'-\e(B ?\\e$,2'.\e(B ?\\e$,2'/\e(B]
- [nil]
+ ?\\e$,2' \e(B ?\\e$,2'!\e(B ?\\e$,2'"\e(B ?\\e$,2'#\e(B ?\\e$,2'$\e(B ?\\e$,2'%\e(B ?\\e$,2'&\e(B ?\\e$,2''\e(B ?\\e$,2'(\e(B ?\\e$,2')\e(B ?\\e$,2'*\e(B ?\\e$,2'+\e(B ?\\e$,2',\e(B ?\\e$,2'-\e(B ?\\e$,2'.\e(B ?\\e$,2'/\e(B
+ nil
;; mac-dingbats (241..254) -> emacs-mule mapping
- [?\\e$,2'1\e(B ?\\e$,2'2\e(B ?\\e$,2'3\e(B ?\\e$,2'4\e(B ?\\e$,2'5\e(B ?\\e$,2'6\e(B ?\\e$,2'7\e(B ?\\e$,2'8\e(B ?\\e$,2'9\e(B ?\\e$,2':\e(B ?\\e$,2';\e(B ?\\e$,2'<\e(B ?\\e$,2'=\e(B ?\\e$,2'>\e(B]
- ))
- len translation-table)
- (setq len (length vec))
- (while (< i len)
- (aset encoding-vector i
- (if (null (aref vec i)) i
- ;; (decode-char 'ucs (aref vec i))
- (aref vec i)
- ))
- (setq i (1+ i)))
- (while (< i 256)
- (setq i (1+ i)))
+ ?\\e$,2'1\e(B ?\\e$,2'2\e(B ?\\e$,2'3\e(B ?\\e$,2'4\e(B ?\\e$,2'5\e(B ?\\e$,2'6\e(B ?\\e$,2'7\e(B ?\\e$,2'8\e(B ?\\e$,2'9\e(B ?\\e$,2':\e(B ?\\e$,2';\e(B ?\\e$,2'<\e(B ?\\e$,2'=\e(B ?\\e$,2'>\e(B
+ nil]))
+ translation-table)
(setq translation-table
(make-translation-table-from-vector encoding-vector))
;; (define-translation-table 'mac-dingbats-decoder translation-table)
'(ascii eight-bit-control eight-bit-graphic))
(set-fontset-font fontset key font)))
(get encoder 'translation-table)))))
-
+
(defun create-fontset-from-mac-roman-font (font &optional resolved-font
fontset-name)
"Create a fontset from a Mac roman font FONT.
(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)
+
(defun mac-drag-n-drop (event)
"Edit the files listed in the drag-n-drop EVENT.
Switch to a buffer editing the last file dropped."
'(lambda ()
(defvar mac-ready-for-drag-n-drop t)))
\f
-;;;; Scroll bars
+;;;; Non-toolkit Scroll bars
+
+(unless x-toolkit-scroll-bars
;; for debugging
;; (defun mac-handle-scroll-bar-event (event) (interactive "e") (princ event))
(mac-scroll-ignore-events)
(scroll-up 1)))
+)
\f
;;;; Others