[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/term/mac-win.el
From: |
YAMAMOTO Mitsuharu |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/term/mac-win.el |
Date: |
Fri, 06 May 2005 04:01:14 -0400 |
Index: emacs/lisp/term/mac-win.el
diff -c emacs/lisp/term/mac-win.el:1.43 emacs/lisp/term/mac-win.el:1.44
*** emacs/lisp/term/mac-win.el:1.43 Sun Apr 24 05:59:52 2005
--- emacs/lisp/term/mac-win.el Fri May 6 08:01:13 2005
***************
*** 1168,1174 ****
(defun x-select-text (text &optional push)
(x-set-selection 'PRIMARY text)
(setq x-last-selected-text-primary text)
! (when x-select-enable-clipboard
(x-set-selection 'CLIPBOARD text)
(setq x-last-selected-text-clipboard text))
)
--- 1168,1175 ----
(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))
)
***************
*** 1203,1222 ****
(setq data
(decode-coding-string data 'utf-16)))))
((eq data-type 'com.apple.traditional-mac-plain-text)
! (setq data (decode-coding-string data coding))))
(put-text-property 0 (length data) 'foreign-selection data-type data))
data))
(defun x-selection-value (type)
! (let (text tiff-image)
! (setq text (condition-case nil
! (x-get-selection type 'public.utf16-plain-text)
! (error nil)))
! (if (not text)
! (setq text (condition-case nil
! (x-get-selection type
! 'com.apple.traditional-mac-plain-text)
! (error nil))))
(if text
(remove-text-properties 0 (length text) '(foreign-selection nil) text))
(setq tiff-image (condition-case nil
--- 1204,1229 ----
(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
***************
*** 1237,1243 ****
;;; selection won't be added to the kill ring over and over.
(defun x-get-selection-value ()
(let (clip-text primary-text)
! (when x-select-enable-clipboard
(setq clip-text (x-selection-value 'CLIPBOARD))
(if (string= clip-text "") (setq clip-text nil))
--- 1244,1251 ----
;;; 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))
***************
*** 1286,1296 ****
))
(put 'CLIPBOARD 'mac-scrap-name "com.apple.scrap.clipboard")
! (if (eq system-type 'darwin)
! (put 'FIND 'mac-scrap-name "com.apple.scrap.find"))
(put 'com.apple.traditional-mac-plain-text 'mac-ostype "TEXT")
(put 'public.utf16-plain-text 'mac-ostype "utxt")
(put 'public.tiff 'mac-ostype "TIFF")
(defun mac-select-convert-to-string (selection type value)
(let ((str (cdr (xselect-convert-to-string selection nil value)))
--- 1294,1307 ----
))
(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)))
***************
*** 1326,1331 ****
--- 1337,1352 ----
(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)
***************
*** 1333,1338 ****
--- 1354,1360 ----
;; 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))
***************
*** 1702,1707 ****
--- 1724,1730 ----
(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.
***************
*** 1756,1762 ****
'(lambda ()
(defvar mac-ready-for-drag-n-drop t)))
! ;;;; Scroll bars
;; for debugging
;; (defun mac-handle-scroll-bar-event (event) (interactive "e") (princ event))
--- 1779,1787 ----
'(lambda ()
(defvar mac-ready-for-drag-n-drop t)))
! ;;;; Non-toolkit Scroll bars
!
! (unless x-toolkit-scroll-bars
;; for debugging
;; (defun mac-handle-scroll-bar-event (event) (interactive "e") (princ event))
***************
*** 1816,1821 ****
--- 1841,1847 ----
(mac-scroll-ignore-events)
(scroll-up 1)))
+ )
;;;; Others
- [Emacs-diffs] Changes to emacs/lisp/term/mac-win.el,
YAMAMOTO Mitsuharu <=