annotate lisp/x-select.el @ 5556:a142ad1a9140

Use dlsym() in preference to NSLookupSymbolInModule() on Darwin, if available. ChangeLog addition: 2011-08-24 Aidan Kehoe <kehoea@parhasard.net> * configure.ac: On OS X, if dlopen() is available in dlfcn.h, use it in preference to dyld; the latter API is deprecated. Move DLSYM_NEEDS_UNDERSCORE together with HAVE_DLYD, it's not needed if the dlsym() and dlopen() APIs are being used. Define REALPATH_CORRECTS_CASE, DEFAULT_FILE_SYSTEM_IGNORE_CASE in this file, don't define them in terms of HAVE_DYLD in src/config.h.in. * configure: Regenerate. src/ChangeLog addition: 2011-08-24 Aidan Kehoe <kehoea@parhasard.net> * config.h.in: Move REALPATH_CORRECTS_CASE, DEFAULT_FILE_SYSTEM_IGNORE_CASE to ../configure.ac rather than implementing them in terms of HAVE_DYLD here.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 24 Aug 2011 23:41:29 +0100
parents 308d34e9f07d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;;; x-select.el --- Lisp interface to X Selections.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Copyright (C) 1990, 1997 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 ;; Copyright (C) 1995 Sun Microsystems.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 ;; Maintainer: XEmacs Development Team
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 ;; Keywords: extensions, dumped
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2620
diff changeset
11 ;; XEmacs is free software: you can redistribute it and/or modify it
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2620
diff changeset
12 ;; under the terms of the GNU General Public License as published by the
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2620
diff changeset
13 ;; Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2620
diff changeset
14 ;; option) any later version.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2620
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2620
diff changeset
17 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2620
diff changeset
18 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2620
diff changeset
19 ;; for more details.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2620
diff changeset
22 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 ;;; Synched up with: FSF 19.30 (select.el).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 ;;; Commentary:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 ;; This file is dumped with XEmacs (when X support is compiled in).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 ;; The selection code requires us to use certain symbols whose names are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 ;; all upper-case; this may seem tasteless, but it makes there be a 1:1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 ;; correspondence between these symbols and X Atoms (which are upcased).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 ;;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 444
diff changeset
36 (globally-declare-fboundp
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 444
diff changeset
37 '(x-get-cutbuffer-internal
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 444
diff changeset
38 x-rotate-cutbuffers-internal x-store-cutbuffer-internal))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 444
diff changeset
39
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 (define-obsolete-function-alias 'x-selection-exists-p 'selection-exists-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 (define-obsolete-function-alias 'x-selection-owner-p 'selection-owner-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 (define-obsolete-variable-alias 'x-selection-converter-alist 'selection-converter-alist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 (define-obsolete-variable-alias 'x-lost-selection-hooks 'lost-selection-hooks)
2620
5e906dd5c3e9 [xemacs-hg @ 2005-02-28 20:21:43 by aidan]
aidan
parents: 502
diff changeset
44 (define-obsolete-variable-alias 'x-selected-text-type 'selection-preferred-types)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 (define-obsolete-function-alias 'x-valid-simple-selection-p 'valid-simple-selection-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 (define-obsolete-function-alias 'x-own-selection 'own-selection)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 (define-obsolete-function-alias 'x-disown-selection 'disown-selection)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 (define-obsolete-function-alias 'x-delete-primary-selection 'delete-primary-selection)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 (define-obsolete-function-alias 'x-copy-primary-selection 'copy-primary-selection)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 (define-obsolete-function-alias 'x-kill-primary-selection 'kill-primary-selection)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 (define-obsolete-function-alias 'x-select-make-extent-for-selection
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 'select-make-extent-for-selection)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 (define-obsolete-function-alias 'x-cut-copy-clear-internal 'cut-copy-clear-internal)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 (define-obsolete-function-alias 'x-get-selection 'get-selection)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 (define-obsolete-function-alias 'x-get-clipboard 'get-clipboard)
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
56 (define-obsolete-function-alias 'x-yank-clipboard-selection
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 'yank-clipboard-selection)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 (define-obsolete-function-alias 'x-disown-selection-internal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 'disown-selection-internal)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 (defun x-get-secondary-selection ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 "Return text selected from some X window."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 (get-selection 'SECONDARY))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 (defun x-own-secondary-selection (selection &optional type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 "Make a secondary X Selection of the given argument. The argument may be a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 string or a cons of two markers (in which case the selection is considered to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 be the text between those markers)."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 (interactive (if (not current-prefix-arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 (list (read-string "Store text for pasting: "))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 (list (cons ;; these need not be ordered.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 (copy-marker (point-marker))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 (copy-marker (mark-marker))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 (own-selection selection 'SECONDARY))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 (defun x-notice-selection-requests (selection type successful)
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
77 "for possible use as the value of `x-sent-selection-hooks'."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 (if (not successful)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 (message "Selection request failed to convert %s to %s"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 selection type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 (message "Sent selection %s as %s" selection type)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 (defun x-notice-selection-failures (selection type successful)
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
84 "for possible use as the value of `x-sent-selection-hooks'."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 (or successful
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 (message "Selection request failed to convert %s to %s"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 selection type)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 ;(setq x-sent-selection-hooks 'x-notice-selection-requests)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 ;(setq x-sent-selection-hooks 'x-notice-selection-failures)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 ;;; Cut Buffer support
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 ;;; FSF name x-get-cut-buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 (defun x-get-cutbuffer (&optional which-one)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 "Return the value of one of the 8 X server cut buffers.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 Optional arg WHICH-ONE should be a number from 0 to 7, defaulting to 0.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 Cut buffers are considered obsolete; you should use selections instead.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
100 This function does nothing if cut buffer support was not compiled in."
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
101 (when (fboundp 'x-get-cutbuffer-internal)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
102 (x-get-cutbuffer-internal
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
103 (aref [CUT_BUFFER0 CUT_BUFFER1 CUT_BUFFER2 CUT_BUFFER3
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
104 CUT_BUFFER4 CUT_BUFFER5 CUT_BUFFER6 CUT_BUFFER7]
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
105 (or which-one 0)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 ;;; FSF name x-set-cut-buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 (defun x-store-cutbuffer (string &optional push)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 "Store STRING into the X server's primary cut buffer.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
110 If optional arg PUSH is non-nil, also rotate the cut buffers: this
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
111 means the previous value of the primary cut buffer moves to the second
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 cut buffer, and the second to the third, and so on (there are 8 buffers.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 Cut buffers are considered obsolete; you should use selections instead.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
114 This function does nothing if cut buffer support was not compiled in."
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
115 (when (fboundp 'x-store-cutbuffer-internal)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
116 (when push
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
117 (x-rotate-cutbuffers-internal 1))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
118 (x-store-cutbuffer-internal 'CUT_BUFFER0 string)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 ;FSFmacs (provide 'select)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 ;;; x-select.el ends here.