comparison lisp/gtk-select.el @ 462:0784d089fdc9 r21-2-46

Import from CVS: tag r21-2-46
author cvs
date Mon, 13 Aug 2007 11:44:37 +0200
parents
children 308d34e9f07d
comparison
equal deleted inserted replaced
461:120ed4009e51 462:0784d089fdc9
1 ;;; gtk-select.el --- Lisp interface to GTK selections.
2
3 ;; Copyright (C) 1990, 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995 Sun Microsystems.
5 ;; Copyright (C) 2000 Free Software Foundation
6
7 ;; Maintainer: William Perry <wmperry@gnu.org>
8 ;; Keywords: extensions, dumped
9
10 ;; This file is part of XEmacs.
11
12 ;; XEmacs is free software; you can redistribute it and/or modify it
13 ;; under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; any later version.
16
17 ;; XEmacs is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with XEmacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
26
27 ;;; Synched up with: Not in FSF
28
29 ;;; Commentary:
30
31 ;; This file is dumped with XEmacs (when GTK support is compiled in).
32 ;; #### Only copes with copying/pasting text
33
34 ;;; Code:
35
36 (defun gtk-get-secondary-selection ()
37 "Return text selected from some GTK window."
38 (get-selection 'SECONDARY))
39
40 (defun gtk-own-secondary-selection (selection &optional type)
41 "Make a secondary GTK Selection of the given argument. The argument may be a
42 string or a cons of two markers (in which case the selection is considered to
43 be the text between those markers)."
44 (interactive (if (not current-prefix-arg)
45 (list (read-string "Store text for pasting: "))
46 (list (cons ;; these need not be ordered.
47 (copy-marker (point-marker))
48 (copy-marker (mark-marker))))))
49 (own-selection selection 'SECONDARY))
50
51 (defun gtk-notice-selection-requests (selection type successful)
52 "for possible use as the value of `gtk-sent-selection-hooks'."
53 (if (not successful)
54 (message "Selection request failed to convert %s to %s"
55 selection type)
56 (message "Sent selection %s as %s" selection type)))
57
58 (defun gtk-notice-selection-failures (selection type successful)
59 "for possible use as the value of `gtk-sent-selection-hooks'."
60 (or successful
61 (message "Selection request failed to convert %s to %s"
62 selection type)))
63
64 ;(setq gtk-sent-selection-hooks 'gtk-notice-selection-requests)
65 ;(setq gtk-sent-selection-hooks 'gtk-notice-selection-failures)