From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Subject: Re: Patch for selection in Carbon Emacs
Date: Thu, 14 Apr 2005 19:14:37 +0900 [thread overview]
Message-ID: <wl64ypd5rm.wl%mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <wlk6n9ioal.wl%mituharu@math.s.chiba-u.ac.jp>
>>>>> On Mon, 11 Apr 2005 19:46:26 +0900, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> said:
> Selection data types and scrap flavor types are related in a similar
> way:
> (put 'mac-TEXT 'mac-scrap-flavor-type "TEXT")
> (put 'mac-UNICODE 'mac-scrap-flavor-type "utxt")
On second thought, I think I'd like to use UTIs (Uniform Type
Identifiers, http://developer.apple.com/qa/qa2005/qa1406.html) rather
than inventing new names.
(put 'com.apple.traditional-mac-plain-text 'mac-scrap-flavor-type "TEXT")
(put 'public.utf16-plain-text 'mac-scrap-flavor-type "utxt")
But it may not be good to use `.' as a part of a Lisp symbol name (its
printed representation prepends `\'), so I'd like to ask opinions
about that. I personally don't care that much.
By the way, TIFF images can be pasted from the clipboard using the
code below :-) (with the previously posted patch, of course)
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
(put 'com.apple.traditional-mac-plain-text 'mac-scrap-flavor-type "TEXT")
(put 'public.utf16-plain-text 'mac-scrap-flavor-type "utxt")
(put 'public.tiff 'mac-scrap-flavor-type "TIFF")
(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)
(public.tiff . ignore))
selection-converter-alist))
(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
(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))
next prev parent reply other threads:[~2005-04-14 10:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-11 10:46 Patch for selection in Carbon Emacs YAMAMOTO Mitsuharu
2005-04-14 10:14 ` YAMAMOTO Mitsuharu [this message]
2005-04-18 8:44 ` YAMAMOTO Mitsuharu
2005-04-18 9:32 ` Miles Bader
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=wl64ypd5rm.wl%mituharu@math.s.chiba-u.ac.jp \
--to=mituharu@math.s.chiba-u.ac.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.