comparison lisp/msw-select.el @ 284:558f606b08ae r21-0b40

Import from CVS: tag r21-0b40
author cvs
date Mon, 13 Aug 2007 10:34:13 +0200
parents 7df0dd720c89
children 57709be46d1b
comparison
equal deleted inserted replaced
283:fa3d41851a08 284:558f606b08ae
47 (push-mark) 47 (push-mark)
48 (if mouse-track-rectangle-p 48 (if mouse-track-rectangle-p
49 (insert-rectangle clip) 49 (insert-rectangle clip)
50 (insert clip)))) 50 (insert clip))))
51 51
52 (defun mswindows-clear-clipboard ()
53 "Delete the selection without copying it to the clipboard or the kill ring."
54 (interactive "*")
55 (mswindows-cut-copy-clear-clipboard 'clear))
56
52 (defun mswindows-copy-clipboard () 57 (defun mswindows-copy-clipboard ()
53 "Copy the selection to the mswindows clipboard and to the kill ring." 58 "Copy the selection to the mswindows clipboard and to the kill ring."
54 (interactive) 59 (interactive)
55 (mswindows-cut-copy-clipboard 'copy)) 60 (mswindows-cut-copy-clear-clipboard 'copy))
56 61
57 (defun mswindows-cut-clipboard () 62 (defun mswindows-cut-clipboard ()
58 "Copy the selection to the mswindows clipboard and to the kill ring, 63 "Copy the selection to the mswindows clipboard and to the kill ring,
59 then delete it." 64 then delete it."
60 (interactive "*") 65 (interactive "*")
61 (mswindows-cut-copy-clipboard 'cut)) 66 (mswindows-cut-copy-clear-clipboard 'cut))
62 67
63 (defun mswindows-cut-copy-clipboard (mode) 68 (defun mswindows-cut-copy-clear-clipboard (mode)
64 "Don't use this function. 69 "Don't use this function.
65 Use mswindows-cut-clipboard or mswindows-copy-clipboard instead." 70 Use mswindows-cut-clipboard, mswindows-copy-clipboard or
66 (or (memq mode '(cut copy)) (error "unkown mode %S" mode)) 71 mswindows-clear-clipboard instead."
72 (or (memq mode '(cut copy clear)) (error "unkown mode %S" mode))
67 (setq last-command nil) 73 (setq last-command nil)
68 (let ((s (mark-marker)) (e (point-marker))) 74 (let ((s (mark-marker)) (e (point-marker)))
69 (if s 75 (if s
70 (progn 76 (progn
71 (if mouse-track-rectangle-p 77 (if mouse-track-rectangle-p
72 (progn 78 (progn
73 (setq killed-rectangle (extract-rectangle s e)) 79 (setq killed-rectangle (extract-rectangle s e))
74 (kill-new (mapconcat 'identity killed-rectangle "\n"))) 80 (kill-new (mapconcat 'identity killed-rectangle "\n")))
75 (copy-region-as-kill s e)) 81 (copy-region-as-kill s e))
76 (mswindows-set-clipboard (car kill-ring)) 82 (if (memq mode '(cut copy))
77 (if (eq mode 'cut) 83 (mswindows-set-clipboard (car kill-ring)))
84 (if (memq mode '(cut clear))
78 (if mouse-track-rectangle-p 85 (if mouse-track-rectangle-p
79 (delete-rectangle s e) 86 (delete-rectangle s e)
80 (delete-region s e)) 87 (delete-region s e))
81 ;; mswindows apps normally leave the selection active but that feels weird here 88 ;; mswindows apps normally leave the selection active but that feels weird here
82 ;; (setq zmacs-region-stays t) 89 ;; (setq zmacs-region-stays t)