comparison lisp/term/pc-win.el @ 17478:14989cb202dc

* (x-select-enable-clipboard): New variable. (x-select-text, x-get-selection-value): New functions, support for MS-Windows clipboard.
author Eli Zaretskii <eliz@gnu.org>
date Tue, 15 Apr 1997 15:00:38 +0000
parents 734b72203ac5
children 8f952e921136
comparison
equal deleted inserted replaced
17477:1b5cc3740793 17478:14989cb202dc
283 (defun x-defined-colors (&optional frame) 283 (defun x-defined-colors (&optional frame)
284 "Return a list of colors supported for a particular frame. 284 "Return a list of colors supported for a particular frame.
285 The argument FRAME specifies which frame to try. 285 The argument FRAME specifies which frame to try.
286 The value may be different for frames on different X displays." 286 The value may be different for frames on different X displays."
287 x-colors) 287 x-colors)
288
289 ;; From lisp/term/win32-win.el
288 ; 290 ;
289 ;; From lisp/select.el 291 ;;;; Selections and cut buffers
290 (defun x-get-selection (&rest rest) "") 292 ;
291 (fset 'x-set-selection 'ignore) 293 ;;; We keep track of the last text selected here, so we can check the
294 ;;; current selection against it, and avoid passing back our own text
295 ;;; from x-cut-buffer-or-selection-value.
296 (defvar x-last-selected-text nil)
297
298 (defvar x-select-enable-clipboard t
299 "Non-nil means cutting and pasting uses the clipboard.
300 This is in addition to the primary selection.")
301
302 (defun x-select-text (text &optional push)
303 (if x-select-enable-clipboard
304 (win16-set-clipboard-data text))
305 (setq x-last-selected-text text))
306
307 ;;; Return the value of the current selection.
308 ;;; Consult the selection, then the cut buffer. Treat empty strings
309 ;;; as if they were unset.
310 (defun x-get-selection-value ()
311 (if x-select-enable-clipboard
312 (let (text)
313 ;; Don't die if x-get-selection signals an error.
314 (condition-case c
315 (setq text (win16-get-clipboard-data))
316 (error (message "win16-get-clipboard-data:%s" c)))
317 (if (string= text "") (setq text nil))
318 (cond
319 ((not text) nil)
320 ((eq text x-last-selected-text) nil)
321 ((string= text x-last-selected-text)
322 ;; Record the newer string, so subsequent calls can use the 'eq' test.
323 (setq x-last-selected-text text)
324 nil)
325 (t
326 (setq x-last-selected-text text))))))
327
328 ;;; Arrange for the kill and yank functions to set and check the clipboard.
329 (setq interprogram-cut-function 'x-select-text)
330 (setq interprogram-paste-function 'x-get-selection-value)
292 331
293 ;; From lisp/faces.el: we only have one font, so always return 332 ;; From lisp/faces.el: we only have one font, so always return
294 ;; it, no matter which variety they've asked for. 333 ;; it, no matter which variety they've asked for.
295 (defun x-frob-font-slant (font which) 334 (defun x-frob-font-slant (font which)
296 font) 335 font)