Mercurial > emacs
annotate lisp/obsolete/lselect.el @ 94612:b37bca16668a
Typo fix.
author | Eric S. Raymond <esr@snark.thyrsus.com> |
---|---|
date | Sun, 04 May 2008 13:20:50 +0000 |
parents | ee22366f2a68 |
children | 43d30a1ea764 |
rev | line source |
---|---|
85891
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
1 ;;; lselect.el --- Lucid interface to X Selections |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
2 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
3 ;; Copyright (C) 1990, 1993, 2001, 2002, 2003, 2004, |
87649 | 4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
85891
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
5 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
6 ;; Maintainer: FSF |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
7 ;; Keywords: emulations |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
8 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
9 ;; This won't completely work until we support or emulate Lucid-style extents. |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
10 ;; Based on Lucid's selection code. |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
11 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
12 ;; This file is part of GNU Emacs. |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
13 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
14 ;; GNU Emacs is free software; you can redistribute it and/or modify |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
15 ;; it under the terms of the GNU General Public License as published by |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
16 ;; the Free Software Foundation; either version 3, or (at your option) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
17 ;; any later version. |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
18 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
19 ;; GNU Emacs is distributed in the hope that it will be useful, |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
22 ;; GNU General Public License for more details. |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
23 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
24 ;; You should have received a copy of the GNU General Public License |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
27 ;; Boston, MA 02110-1301, USA. |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
28 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
29 ;;; Commentary: |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
30 |
94000
ee22366f2a68
Add a comment giving version of obsolescence.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
31 ;; This file has been obsolete since Emacs 23.1. |
ee22366f2a68
Add a comment giving version of obsolescence.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
32 |
85891
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
33 ;;; Code: |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
34 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
35 ;; The selection code requires us to use certain symbols whose names are |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
36 ;; all upper-case; this may seem tasteless, but it makes there be a 1:1 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
37 ;; correspondence between these symbols and X Atoms (which are upcased.) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
38 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
39 ;; This is Lucid/XEmacs stuff |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
40 (defvar mouse-highlight-priority) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
41 (defvar x-lost-selection-functions) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
42 (defvar zmacs-regions) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
43 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
44 (defalias 'x-get-cutbuffer 'x-get-cut-buffer) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
45 (defalias 'x-store-cutbuffer 'x-set-cut-buffer) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
46 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
47 (or (facep 'primary-selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
48 (make-face 'primary-selection)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
49 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
50 (or (facep 'secondary-selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
51 (make-face 'secondary-selection)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
52 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
53 (defun x-get-secondary-selection () |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
54 "Return text selected from some X window." |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
55 (x-get-selection-internal 'SECONDARY 'STRING)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
56 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
57 (defvar primary-selection-extent nil |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
58 "The extent of the primary selection; don't use this.") |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
59 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
60 (defvar secondary-selection-extent nil |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
61 "The extent of the secondary selection; don't use this.") |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
62 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
63 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
64 (defun x-select-make-extent-for-selection (selection previous-extent face) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
65 ;; Given a selection, this makes an extent in the buffer which holds that |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
66 ;; selection, for highlighting purposes. If the selection isn't associated |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
67 ;; with a buffer, this does nothing. |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
68 (let ((buffer nil) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
69 (valid (and (extentp previous-extent) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
70 (extent-buffer previous-extent) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
71 (buffer-name (extent-buffer previous-extent)))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
72 start end) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
73 (cond ((stringp selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
74 ;; if we're selecting a string, lose the previous extent used |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
75 ;; to highlight the selection. |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
76 (setq valid nil)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
77 ((consp selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
78 (setq start (min (car selection) (cdr selection)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
79 end (max (car selection) (cdr selection)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
80 valid (and valid |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
81 (eq (marker-buffer (car selection)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
82 (extent-buffer previous-extent))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
83 buffer (marker-buffer (car selection)))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
84 ((extentp selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
85 (setq start (extent-start-position selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
86 end (extent-end-position selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
87 valid (and valid |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
88 (eq (extent-buffer selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
89 (extent-buffer previous-extent))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
90 buffer (extent-buffer selection))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
91 ) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
92 (if (and (not valid) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
93 (extentp previous-extent) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
94 (extent-buffer previous-extent) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
95 (buffer-name (extent-buffer previous-extent))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
96 (delete-extent previous-extent)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
97 (if (not buffer) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
98 ;; string case |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
99 nil |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
100 ;; normal case |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
101 (if valid |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
102 (set-extent-endpoints previous-extent start end) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
103 (setq previous-extent (make-extent start end buffer)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
104 ;; use same priority as mouse-highlighting so that conflicts between |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
105 ;; the selection extent and a mouse-highlighted extent are resolved |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
106 ;; by the usual size-and-endpoint-comparison method. |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
107 (set-extent-priority previous-extent mouse-highlight-priority) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
108 (set-extent-face previous-extent face))))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
109 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
110 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
111 (defun x-own-selection (selection &optional type) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
112 "Make a primary X Selection of the given argument. |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
113 The argument may be a string, a cons of two markers, or an extent. |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
114 In the latter cases the selection is considered to be the text |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
115 between the markers, or the between extents endpoints." |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
116 (interactive (if (not current-prefix-arg) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
117 (list (read-string "Store text for pasting: ")) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
118 (list (cons ;; these need not be ordered. |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
119 (copy-marker (point-marker)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
120 (copy-marker (mark-marker)))))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
121 (or type (setq type 'PRIMARY)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
122 (x-set-selection selection type) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
123 (cond ((eq type 'PRIMARY) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
124 (setq primary-selection-extent |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
125 (x-select-make-extent-for-selection |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
126 selection primary-selection-extent 'primary-selection))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
127 ((eq type 'SECONDARY) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
128 (setq secondary-selection-extent |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
129 (x-select-make-extent-for-selection |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
130 selection secondary-selection-extent 'secondary-selection)))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
131 selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
132 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
133 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
134 (defun x-own-secondary-selection (selection &optional type) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
135 "Make a secondary X Selection of the given argument. The argument may be a |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
136 string or a cons of two markers (in which case the selection is considered to |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
137 be the text between those markers.)" |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
138 (interactive (if (not current-prefix-arg) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
139 (list (read-string "Store text for pasting: ")) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
140 (list (cons ;; these need not be ordered. |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
141 (copy-marker (point-marker)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
142 (copy-marker (mark-marker)))))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
143 (x-own-selection selection 'SECONDARY)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
144 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
145 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
146 (defun x-own-clipboard (string) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
147 "Paste the given string to the X Clipboard." |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
148 (x-own-selection string 'CLIPBOARD)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
149 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
150 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
151 (defun x-disown-selection (&optional secondary-p) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
152 "Assuming we own the selection, disown it. With an argument, discard the |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
153 secondary selection instead of the primary selection." |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
154 (x-disown-selection-internal (if secondary-p 'SECONDARY 'PRIMARY))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
155 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
156 (defun x-dehilight-selection (selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
157 "for use as a value of `x-lost-selection-functions'." |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
158 (cond ((eq selection 'PRIMARY) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
159 (if primary-selection-extent |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
160 (let ((inhibit-quit t)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
161 (delete-extent primary-selection-extent) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
162 (setq primary-selection-extent nil))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
163 (if zmacs-regions (zmacs-deactivate-region))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
164 ((eq selection 'SECONDARY) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
165 (if secondary-selection-extent |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
166 (let ((inhibit-quit t)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
167 (delete-extent secondary-selection-extent) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
168 (setq secondary-selection-extent nil))))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
169 nil) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
170 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
171 (setq x-lost-selection-functions 'x-dehilight-selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
172 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
173 (defun x-notice-selection-requests (selection type successful) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
174 "for possible use as the value of `x-sent-selection-functions'." |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
175 (if (not successful) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
176 (message "Selection request failed to convert %s to %s" |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
177 selection type) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
178 (message "Sent selection %s as %s" selection type))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
179 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
180 (defun x-notice-selection-failures (selection type successful) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
181 "for possible use as the value of `x-sent-selection-functions'." |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
182 (or successful |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
183 (message "Selection request failed to convert %s to %s" |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
184 selection type))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
185 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
186 ;(setq x-sent-selection-functions 'x-notice-selection-requests) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
187 ;(setq x-sent-selection-functions 'x-notice-selection-failures) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
188 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
189 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
190 ;; Random utility functions |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
191 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
192 (defun x-kill-primary-selection () |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
193 "If there is a selection, delete the text it covers, and copy it to |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
194 both the kill ring and the Clipboard." |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
195 (interactive) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
196 (or (x-selection-owner-p) (error "Emacs does not own the primary selection")) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
197 (setq last-command nil) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
198 (or primary-selection-extent |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
199 (error "the primary selection is not an extent?")) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
200 (save-excursion |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
201 (set-buffer (extent-buffer primary-selection-extent)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
202 (kill-region (extent-start-position primary-selection-extent) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
203 (extent-end-position primary-selection-extent))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
204 (x-disown-selection nil)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
205 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
206 (defun x-delete-primary-selection () |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
207 "If there is a selection, delete the text it covers *without* copying it to |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
208 the kill ring or the Clipboard." |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
209 (interactive) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
210 (or (x-selection-owner-p) (error "Emacs does not own the primary selection")) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
211 (setq last-command nil) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
212 (or primary-selection-extent |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
213 (error "the primary selection is not an extent?")) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
214 (save-excursion |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
215 (set-buffer (extent-buffer primary-selection-extent)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
216 (delete-region (extent-start-position primary-selection-extent) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
217 (extent-end-position primary-selection-extent))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
218 (x-disown-selection nil)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
219 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
220 (defun x-copy-primary-selection () |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
221 "If there is a selection, copy it to both the kill ring and the Clipboard." |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
222 (interactive) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
223 (setq last-command nil) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
224 (or (x-selection-owner-p) (error "Emacs does not own the primary selection")) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
225 (or primary-selection-extent |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
226 (error "the primary selection is not an extent?")) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
227 (save-excursion |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
228 (set-buffer (extent-buffer primary-selection-extent)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
229 (copy-region-as-kill (extent-start-position primary-selection-extent) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
230 (extent-end-position primary-selection-extent)))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
231 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
232 (defun x-yank-clipboard-selection () |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
233 "If someone owns a Clipboard selection, insert it at point." |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
234 (interactive) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
235 (setq last-command nil) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
236 (let ((clip (x-get-clipboard))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
237 (or clip (error "there is no clipboard selection")) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
238 (push-mark) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
239 (insert clip))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
240 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
241 (provide 'lselect) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
242 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
243 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
244 ;; Local variables: |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
245 ;; byte-compile-warnings: (not unresolved) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
246 ;; End: |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
247 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
248 ;; arch-tag: 92fa54d4-c5d1-4e9b-ad58-cf1e13930556 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
249 ;;; lselect.el ends here |