changeset 6442:c81cfdffcf49

(x-valid-simple-selection-p): Accept an overlay. (xselect-convert-to-string, xselect-convert-to-length): (xselect-convert-to-filename xselect-convert-to-charpos): (xselect-convert-to-lineno, xselect-convert-to-colno): Likewise.
author Richard M. Stallman <rms@gnu.org>
date Sun, 20 Mar 1994 21:12:45 +0000
parents 6ca895922340
children 1d725a175387
files lisp/select.el
diffstat 1 files changed, 24 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/select.el	Sun Mar 20 18:59:22 1994 +0000
+++ b/lisp/select.el	Sun Mar 20 21:12:45 1994 +0000
@@ -77,8 +77,7 @@
 	   (or (integerp (cdr data))
 	       (and (consp (cdr data))
 		    (integerp (car (cdr data))))))
-;;;   (and (fboundp 'extentp)
-;;;	   (extentp data))
+      (overlayp data)
       (and (consp data)
 	   (markerp (car data))
 	   (markerp (cdr data))
@@ -122,11 +121,13 @@
 (defun xselect-convert-to-string (selection type value)
   (cond ((stringp value)
 	 value)
-;;;	((extentp value)
-;;;	 (save-excursion
-;;;	   (set-buffer (extent-buffer value))
-;;;	   (buffer-substring (extent-start-position value)
-;;;			     (extent-end-position value))))
+	((overlayp value)
+	 (save-excursion
+	   (or (buffer-name (overlay-buffer value))
+	       (error "selection is in a killed buffer"))
+	   (set-buffer (overlay-buffer value))
+	   (buffer-substring (overlay-start value)
+			     (overlay-end value))))
 	((and (consp value)
 	      (markerp (car value))
 	      (markerp (cdr value)))
@@ -144,8 +145,8 @@
   (let ((value
 	 (cond ((stringp value)
 		(length value))
-;;;	       ((extentp value)
-;;;		(extent-length value))
+	       ((overlayp value)
+		(abs (- (overlay-end value) (overlay-start value))))
 	       ((and (consp value)
 		     (markerp (car value))
 		     (markerp (cdr value)))
@@ -180,10 +181,9 @@
   'NULL)
 
 (defun xselect-convert-to-filename (selection type value)
-  (cond 
-;;;	((extentp value)
-;;;	 (buffer-file-name (or (extent-buffer value)
-;;;			       (error "selection is in a killed buffer"))))
+  (cond ((overlayp value)
+	 (buffer-file-name (or (overlay-buffer value)
+			       (error "selection is in a killed buffer"))))
 	((and (consp value)
 	      (markerp (car value))
 	      (markerp (cdr value)))
@@ -193,10 +193,9 @@
 
 (defun xselect-convert-to-charpos (selection type value)
   (let (a b tmp)
-    (cond ((cond 
-;;;		 ((extentp value)
-;;;		  (setq a (extent-start-position value)
-;;;			b (extent-end-position value)))
+    (cond ((cond ((overlayp value)
+		  (setq a (overlay-start value)
+			b (overlay-end value)))
 		 ((and (consp value)
 		       (markerp (car value))
 		       (markerp (cdr value)))
@@ -216,10 +215,10 @@
 		  (setq a (marker-position (car value))
 			b (marker-position (cdr value))
 			buf (marker-buffer (car value))))
-;;;		 ((extentp value)
-;;;		  (setq buf (extent-buffer value)
-;;;			a (extent-start-position value)
-;;;			b (extent-end-position value)))
+		 ((overlayp value)
+		  (setq buf (overlay-buffer value)
+			a (overlay-start value)
+			b (overlay-end value)))
 		 )
 	   (save-excursion
 	     (set-buffer buf)
@@ -238,10 +237,10 @@
 		  (setq a (car value)
 			b (cdr value)
 			buf (marker-buffer a)))
-;;;		 ((extentp value)
-;;;		  (setq buf (extent-buffer value)
-;;;			a (extent-start-position value)
-;;;			b (extent-end-position value)))
+		 ((overlayp value)
+		  (setq buf (overlay-buffer value)
+			a (overlay-start value)
+			b (overlay-end value)))
 		 )
 	   (save-excursion
 	     (set-buffer buf)