Mercurial > emacs
annotate lisp/obsolete/lselect.el @ 94711:234b6de33fa7
Switch to recommended form of GPLv3 permissions notice.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 07 May 2008 03:41:32 +0000 |
parents | 43d30a1ea764 |
children |
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 |
94667
43d30a1ea764
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94000
diff
changeset
|
14 ;; GNU Emacs is free software: you can redistribute it and/or modify |
85891
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 |
94667
43d30a1ea764
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94000
diff
changeset
|
16 ;; the Free Software Foundation, either version 3 of the License, or |
43d30a1ea764
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94000
diff
changeset
|
17 ;; (at your option) any later version. |
85891
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 |
94667
43d30a1ea764
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94000
diff
changeset
|
25 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
85891
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
26 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
27 ;;; Commentary: |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
28 |
94000
ee22366f2a68
Add a comment giving version of obsolescence.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
29 ;; 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
|
30 |
85891
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
31 ;;; Code: |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
32 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
33 ;; 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
|
34 ;; 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
|
35 ;; 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
|
36 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
37 ;; This is Lucid/XEmacs stuff |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
38 (defvar mouse-highlight-priority) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
39 (defvar x-lost-selection-functions) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
40 (defvar zmacs-regions) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
41 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
42 (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
|
43 (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
|
44 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
45 (or (facep 'primary-selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
46 (make-face 'primary-selection)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
47 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
48 (or (facep 'secondary-selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
49 (make-face 'secondary-selection)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
50 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
51 (defun x-get-secondary-selection () |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
52 "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
|
53 (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
|
54 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
55 (defvar primary-selection-extent nil |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
56 "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
|
57 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
58 (defvar secondary-selection-extent nil |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
59 "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
|
60 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
61 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
62 (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
|
63 ;; 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
|
64 ;; 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
|
65 ;; 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
|
66 (let ((buffer nil) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
67 (valid (and (extentp previous-extent) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
68 (extent-buffer previous-extent) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
69 (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
|
70 start end) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
71 (cond ((stringp selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
72 ;; 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
|
73 ;; to highlight the selection. |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
74 (setq valid nil)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
75 ((consp selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
76 (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
|
77 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
|
78 valid (and valid |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
79 (eq (marker-buffer (car selection)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
80 (extent-buffer previous-extent))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
81 buffer (marker-buffer (car selection)))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
82 ((extentp selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
83 (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
|
84 end (extent-end-position selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
85 valid (and valid |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
86 (eq (extent-buffer selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
87 (extent-buffer previous-extent))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
88 buffer (extent-buffer selection))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
89 ) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
90 (if (and (not valid) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
91 (extentp previous-extent) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
92 (extent-buffer previous-extent) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
93 (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
|
94 (delete-extent previous-extent)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
95 (if (not buffer) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
96 ;; string case |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
97 nil |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
98 ;; normal case |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
99 (if valid |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
100 (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
|
101 (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
|
102 ;; 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
|
103 ;; 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
|
104 ;; 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
|
105 (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
|
106 (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
|
107 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
108 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
109 (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
|
110 "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
|
111 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
|
112 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
|
113 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
|
114 (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
|
115 (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
|
116 (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
|
117 (copy-marker (point-marker)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
118 (copy-marker (mark-marker)))))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
119 (or type (setq type 'PRIMARY)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
120 (x-set-selection selection type) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
121 (cond ((eq type 'PRIMARY) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
122 (setq primary-selection-extent |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
123 (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
|
124 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
|
125 ((eq type 'SECONDARY) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
126 (setq secondary-selection-extent |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
127 (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
|
128 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
|
129 selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
130 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
131 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
132 (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
|
133 "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
|
134 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
|
135 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
|
136 (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
|
137 (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
|
138 (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
|
139 (copy-marker (point-marker)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
140 (copy-marker (mark-marker)))))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
141 (x-own-selection selection 'SECONDARY)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
142 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
143 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
144 (defun x-own-clipboard (string) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
145 "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
|
146 (x-own-selection string 'CLIPBOARD)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
147 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
148 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
149 (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
|
150 "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
|
151 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
|
152 (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
|
153 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
154 (defun x-dehilight-selection (selection) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
155 "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
|
156 (cond ((eq selection 'PRIMARY) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
157 (if primary-selection-extent |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
158 (let ((inhibit-quit t)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
159 (delete-extent primary-selection-extent) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
160 (setq primary-selection-extent nil))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
161 (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
|
162 ((eq selection 'SECONDARY) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
163 (if secondary-selection-extent |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
164 (let ((inhibit-quit t)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
165 (delete-extent secondary-selection-extent) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
166 (setq secondary-selection-extent nil))))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
167 nil) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
168 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
169 (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
|
170 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
171 (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
|
172 "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
|
173 (if (not successful) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
174 (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
|
175 selection type) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
176 (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
|
177 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
178 (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
|
179 "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
|
180 (or successful |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
181 (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
|
182 selection type))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
183 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
184 ;(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
|
185 ;(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
|
186 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
187 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
188 ;; Random utility functions |
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 (defun x-kill-primary-selection () |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
191 "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
|
192 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
|
193 (interactive) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
194 (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
|
195 (setq last-command nil) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
196 (or primary-selection-extent |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
197 (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
|
198 (save-excursion |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
199 (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
|
200 (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
|
201 (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
|
202 (x-disown-selection nil)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
203 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
204 (defun x-delete-primary-selection () |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
205 "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
|
206 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
|
207 (interactive) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
208 (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
|
209 (setq last-command nil) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
210 (or primary-selection-extent |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
211 (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
|
212 (save-excursion |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
213 (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
|
214 (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
|
215 (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
|
216 (x-disown-selection nil)) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
217 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
218 (defun x-copy-primary-selection () |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
219 "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
|
220 (interactive) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
221 (setq last-command nil) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
222 (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
|
223 (or primary-selection-extent |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
224 (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
|
225 (save-excursion |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
226 (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
|
227 (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
|
228 (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
|
229 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
230 (defun x-yank-clipboard-selection () |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
231 "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
|
232 (interactive) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
233 (setq last-command nil) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
234 (let ((clip (x-get-clipboard))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
235 (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
|
236 (push-mark) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
237 (insert clip))) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
238 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
239 (provide 'lselect) |
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 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
242 ;; Local variables: |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
243 ;; byte-compile-warnings: (not unresolved) |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
244 ;; End: |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
245 |
aa192da33904
* emacs-lisp/lselect.el: Move to obsolete/lselect.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
246 ;; 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
|
247 ;;; lselect.el ends here |