changeset 843:f46864126a0d

[xemacs-hg @ 2002-05-15 15:27:40 by stephent] fix yank-pop bug correctly <87adr1zbdd.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Wed, 15 May 2002 15:27:58 +0000
parents dc12269565c9
children 047d37eb70d7
files lisp/ChangeLog lisp/select.el lisp/simple.el src/ChangeLog src/select.c
diffstat 5 files changed, 43 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue May 14 18:14:30 2002 +0000
+++ b/lisp/ChangeLog	Wed May 15 15:27:58 2002 +0000
@@ -1,3 +1,18 @@
+2002-05-09  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	This patch is based on Jerry James's patch and analysis.
+
+	* select.el (get-clipboard):
+	(get-selection):
+	Update docstrings.
+	(get-clipboard-foreign):
+	(get-selection-foreign):
+	New function for use as `interprogram-paste-function's.
+
+	* simple.el (interprogram-paste-function): Change default to
+	`get-clipboard-foreign'; improve docstring.
+	(interprogram-cut-function): Improve dosctring.
+
 2002-05-13  Ben Wing  <ben@xemacs.org>
 
 	* files.el (revert-buffer):
--- a/lisp/select.el	Tue May 14 18:14:30 2002 +0000
+++ b/lisp/select.el	Wed May 15 15:27:58 2002 +0000
@@ -76,8 +76,13 @@
 
 (defun get-clipboard ()
   "Return text pasted to the clipboard.
+Not suitable for `interprogram-paste-function', use `get-clipboard-foreign'."
+  (get-selection 'CLIPBOARD))
+
+(defun get-clipboard-foreign ()
+  "Return text pasted to the clipboard by another program.
 See `interprogram-paste-function' for more information."
-  (get-selection 'CLIPBOARD))
+  (get-selection-foreign 'CLIPBOARD))
 
 (define-device-method get-cutbuffer
   "Return the value of one of the cut buffers.
@@ -91,11 +96,11 @@
   (condition-case nil (get-selection type data-type) (t nil)))
 
 (defun get-selection (&optional type data-type)
-  "Return the value of a window-system selection, or nil if XEmacs owns it.
+  "Return the value of a window-system selection.
 The argument TYPE (default `PRIMARY') says which selection,
 and the argument DATA-TYPE (default `STRING', or `COMPOUND_TEXT' under Mule)
 says how to convert the data. If there is no selection an error is signalled.
-See `interprogram-paste-function' for more information."
+Not suitable in a `interprogram-paste-function', q.v."
   (or type (setq type 'PRIMARY))
   (or data-type (setq data-type selected-text-type))
   (if (consp data-type)
--- a/lisp/simple.el	Tue May 14 18:14:30 2002 +0000
+++ b/lisp/simple.el	Wed May 15 15:27:58 2002 +0000
@@ -1224,7 +1224,9 @@
 The first argument, TEXT, is a string containing
 the text which should be made available.
 The second, PUSH, if non-nil means this is a \"new\" kill;
-nil means appending to an \"old\" kill."
+nil means appending to an \"old\" kill.
+
+One reasonable choice is `own-clipboard' (the default)."
   :type '(radio (function-item :tag "Send to Clipboard"
 			       :format "%t\n"
 			       own-clipboard)
@@ -1232,7 +1234,7 @@
 		(function :tag "Other"))
   :group 'killing)
 
-(defcustom interprogram-paste-function 'get-clipboard
+(defcustom interprogram-paste-function 'get-clipboard-foreign
   "Function to call to get text cut from other programs.
 
 Most window systems provide some sort of facility for cutting and
@@ -1250,10 +1252,13 @@
 most recent string, the function should return nil.  If it is
 difficult to tell whether Emacs or some other program provided the
 current string, it is probably good enough to return nil if the string
-is equal (according to `string=') to the last text Emacs provided."
+is equal (according to `string=') to the last text Emacs provided.
+
+Reasonable choices include `get-clipboard-foreign' (the default), and
+functions calling `get-selection-foreign' (q.v.)."
   :type '(radio (function-item :tag "Get from Clipboard"
 			       :format "%t\n"
-			       get-clipboard)
+			       get-clipboard-foreign)
 		(const :tag "None" nil)
 		(function :tag "Other"))
   :group 'killing)
--- a/src/ChangeLog	Tue May 14 18:14:30 2002 +0000
+++ b/src/ChangeLog	Wed May 15 15:27:58 2002 +0000
@@ -1,3 +1,9 @@
+2002-05-16  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* select.c (Fown_selection_internal):
+	* select.c (Fget_selection_internal):
+	Revert Jerry James's 2002-04-23 patch.
+
 2002-05-14  Ben Wing  <ben@xemacs.org>
 
 	* font-lock.c (find_context):
--- a/src/select.c	Tue May 14 18:14:30 2002 +0000
+++ b/src/select.c	Wed May 15 15:27:58 2002 +0000
@@ -139,8 +139,8 @@
 SELECTION-VALUE is typically a string, or a cons of two markers, but may be
 anything that the functions on selection-converter-out-alist know about.
 Optional arg HOW-TO-ADD specifies how the selection will be combined
-with any existing selection(s) - see `own-selection' and
-`interprogram-cut-function' for more information.
+with any existing selection(s) - see `own-selection' for more
+information.
 Optional arg DATA-TYPE is a window-system-specific type.
 Optional arg DEVICE specifies the device on which to assert the selection.
 It defaults to the selected device.
@@ -509,8 +509,8 @@
 }
 
 /* Request the selection value from the owner.  If we are the owner,
-   return Qnil.  If we are not the owner, this will block until all of
-   the data has arrived.
+   simply return our selection value.  If we are not the owner, this
+   will block until all of the data has arrived.
  */
 DEFUN ("get-selection-internal", Fget_selection_internal, 2, 3, 0, /*
 Return text selected from some window-system window.
@@ -518,8 +518,6 @@
 TARGET-TYPE is the type of data desired, typically STRING or COMPOUND_TEXT.
 Under Mule, if the resultant data comes back as 8-bit data in type
 TEXT or COMPOUND_TEXT, it will be decoded as Compound Text.
-If XEmacs already owns the selection, return nil.  See
-`interprogram-paste-function' for more information.
 */
        (selection, target_type, device))
 {
@@ -561,8 +559,7 @@
     {
       /* If we get something from the local cache, we may need to convert
          it slightly - to do this, we call select-coerce */
-      Lisp_Object val2 = call3 (Qselect_coerce, selection, target_type, val);
-      return (EQ (val, val2)) ? Qnil : val2;
+      val = call3 (Qselect_coerce, selection, target_type, val);
     }
   else if (HAS_DEVMETH_P (XDEVICE (device), get_foreign_selection))
     {