mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-23 10:34:07 +00:00
(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.
This commit is contained in:
parent
e0de7bcbbb
commit
6eac0de696
@ -77,8 +77,7 @@ The data may also be a vector of valid non-vector selection values."
|
||||
(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 @@ Cut buffers are considered obsolete; you should use selections instead."
|
||||
(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 @@ Cut buffers are considered obsolete; you should use selections instead."
|
||||
(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 @@ Cut buffers are considered obsolete; you should use selections instead."
|
||||
'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 @@ Cut buffers are considered obsolete; you should use selections instead."
|
||||
|
||||
(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 @@ Cut buffers are considered obsolete; you should use selections instead."
|
||||
(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 @@ Cut buffers are considered obsolete; you should use selections instead."
|
||||
(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)
|
||||
|
Loading…
Reference in New Issue
Block a user