Commit 6eac0de6 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(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.
parent e0de7bcb
...@@ -77,8 +77,7 @@ The data may also be a vector of valid non-vector selection values." ...@@ -77,8 +77,7 @@ The data may also be a vector of valid non-vector selection values."
(or (integerp (cdr data)) (or (integerp (cdr data))
(and (consp (cdr data)) (and (consp (cdr data))
(integerp (car (cdr data)))))) (integerp (car (cdr data))))))
;;; (and (fboundp 'extentp) (overlayp data)
;;; (extentp data))
(and (consp data) (and (consp data)
(markerp (car data)) (markerp (car data))
(markerp (cdr data)) (markerp (cdr data))
...@@ -122,11 +121,13 @@ Cut buffers are considered obsolete; you should use selections instead." ...@@ -122,11 +121,13 @@ Cut buffers are considered obsolete; you should use selections instead."
(defun xselect-convert-to-string (selection type value) (defun xselect-convert-to-string (selection type value)
(cond ((stringp value) (cond ((stringp value)
value) value)
;;; ((extentp value) ((overlayp value)
;;; (save-excursion (save-excursion
;;; (set-buffer (extent-buffer value)) (or (buffer-name (overlay-buffer value))
;;; (buffer-substring (extent-start-position value) (error "selection is in a killed buffer"))
;;; (extent-end-position value)))) (set-buffer (overlay-buffer value))
(buffer-substring (overlay-start value)
(overlay-end value))))
((and (consp value) ((and (consp value)
(markerp (car value)) (markerp (car value))
(markerp (cdr value))) (markerp (cdr value)))
...@@ -144,8 +145,8 @@ Cut buffers are considered obsolete; you should use selections instead." ...@@ -144,8 +145,8 @@ Cut buffers are considered obsolete; you should use selections instead."
(let ((value (let ((value
(cond ((stringp value) (cond ((stringp value)
(length value)) (length value))
;;; ((extentp value) ((overlayp value)
;;; (extent-length value)) (abs (- (overlay-end value) (overlay-start value))))
((and (consp value) ((and (consp value)
(markerp (car value)) (markerp (car value))
(markerp (cdr value))) (markerp (cdr value)))
...@@ -180,10 +181,9 @@ Cut buffers are considered obsolete; you should use selections instead." ...@@ -180,10 +181,9 @@ Cut buffers are considered obsolete; you should use selections instead."
'NULL) 'NULL)
(defun xselect-convert-to-filename (selection type value) (defun xselect-convert-to-filename (selection type value)
(cond (cond ((overlayp value)
;;; ((extentp value) (buffer-file-name (or (overlay-buffer value)
;;; (buffer-file-name (or (extent-buffer value) (error "selection is in a killed buffer"))))
;;; (error "selection is in a killed buffer"))))
((and (consp value) ((and (consp value)
(markerp (car value)) (markerp (car value))
(markerp (cdr value))) (markerp (cdr value)))
...@@ -193,10 +193,9 @@ Cut buffers are considered obsolete; you should use selections instead." ...@@ -193,10 +193,9 @@ Cut buffers are considered obsolete; you should use selections instead."
(defun xselect-convert-to-charpos (selection type value) (defun xselect-convert-to-charpos (selection type value)
(let (a b tmp) (let (a b tmp)
(cond ((cond (cond ((cond ((overlayp value)
;;; ((extentp value) (setq a (overlay-start value)
;;; (setq a (extent-start-position value) b (overlay-end value)))
;;; b (extent-end-position value)))
((and (consp value) ((and (consp value)
(markerp (car value)) (markerp (car value))
(markerp (cdr value))) (markerp (cdr value)))
...@@ -216,10 +215,10 @@ Cut buffers are considered obsolete; you should use selections instead." ...@@ -216,10 +215,10 @@ Cut buffers are considered obsolete; you should use selections instead."
(setq a (marker-position (car value)) (setq a (marker-position (car value))
b (marker-position (cdr value)) b (marker-position (cdr value))
buf (marker-buffer (car value)))) buf (marker-buffer (car value))))
;;; ((extentp value) ((overlayp value)
;;; (setq buf (extent-buffer value) (setq buf (overlay-buffer value)
;;; a (extent-start-position value) a (overlay-start value)
;;; b (extent-end-position value))) b (overlay-end value)))
) )
(save-excursion (save-excursion
(set-buffer buf) (set-buffer buf)
...@@ -238,10 +237,10 @@ Cut buffers are considered obsolete; you should use selections instead." ...@@ -238,10 +237,10 @@ Cut buffers are considered obsolete; you should use selections instead."
(setq a (car value) (setq a (car value)
b (cdr value) b (cdr value)
buf (marker-buffer a))) buf (marker-buffer a)))
;;; ((extentp value) ((overlayp value)
;;; (setq buf (extent-buffer value) (setq buf (overlay-buffer value)
;;; a (extent-start-position value) a (overlay-start value)
;;; b (extent-end-position value))) b (overlay-end value)))
) )
(save-excursion (save-excursion
(set-buffer buf) (set-buffer buf)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment