1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-05 11:45:45 +00:00

(cua-copy-region, cua-cut-region)

(cua-paste): Handle clipboard action.
(cua--init-keymaps): Remap clipboard-kill-region and
clipboard-kill-ring-save.
This commit is contained in:
Kim F. Storm 2005-05-08 22:29:20 +00:00
parent a0e6f95281
commit 6a350b06e2

View File

@ -777,9 +777,13 @@ With numeric prefix arg, copy to register 0-9 instead."
(let ((start (mark)) (end (point)))
(or (<= start end)
(setq start (prog1 end (setq end start))))
(if cua--register
(copy-to-register cua--register start end nil)
(copy-region-as-kill start end))
(cond
(cua--register
(copy-to-register cua--register start end nil))
((eq this-original-command 'clipboard-kill-ring-save)
(clipboard-kill-ring-save start end))
(t
(copy-region-as-kill start end)))
(if cua-keep-region-after-copy
(cua--keep-active)
(cua--deactivate))))
@ -795,9 +799,13 @@ With numeric prefix arg, copy to register 0-9 instead."
(let ((start (mark)) (end (point)))
(or (<= start end)
(setq start (prog1 end (setq end start))))
(if cua--register
(copy-to-register cua--register start end t)
(kill-region start end)))
(cond
(cua--register
(copy-to-register cua--register start end t))
((eq this-original-command 'clipboard-kill-region)
(clipboard-kill-region start end))
(t
(kill-region start end))))
(cua--deactivate)))
;;; Generic commands for regions, rectangles, and global marks
@ -864,6 +872,8 @@ If global mark is active, copy from register or one character."
(cua--insert-rectangle (cdr cua--last-killed-rectangle)
nil paste-column paste-lines)
(if arg (goto-char pt))))
((eq this-original-command 'clipboard-yank)
(clipboard-yank))
(t (yank arg)))))))
(defun cua-paste-pop (arg)
@ -1282,9 +1292,11 @@ If ARG is the atom `-', scroll upward by nearly full screen."
(define-key cua--region-keymap [remap delete-char] 'cua-delete-region)
;; kill region
(define-key cua--region-keymap [remap kill-region] 'cua-cut-region)
(define-key cua--region-keymap [remap clipboard-kill-region] 'cua-cut-region)
;; copy region
(define-key cua--region-keymap [remap copy-region-as-kill] 'cua-copy-region)
(define-key cua--region-keymap [remap kill-ring-save] 'cua-copy-region)
(define-key cua--region-keymap [remap clipboard-kill-ring-save] 'cua-copy-region)
;; cancel current region/rectangle
(define-key cua--region-keymap [remap keyboard-escape-quit] 'cua-cancel)
(define-key cua--region-keymap [remap keyboard-quit] 'cua-cancel)