aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier2013-12-08 01:24:54 -0500
committerStefan Monnier2013-12-08 01:24:54 -0500
commit6f8dfccfe3ec3e1137e712b49da12c8a9ab4bc85 (patch)
treeebe79741b1a81433ff73bd666e07626c1982bfbb /lisp
parent95b3d095f8791c9d0a2007f43fa4731401c64c87 (diff)
downloademacs-6f8dfccfe3ec3e1137e712b49da12c8a9ab4bc85.tar.gz
emacs-6f8dfccfe3ec3e1137e712b49da12c8a9ab4bc85.zip
Use delete-selection-mode in cua-mode.
* lisp/emulation/cua-base.el (cua--prefix-copy-handler) (cua--prefix-cut-handler): Rely on region-extract-function rather than checking cua--rectangle. (cua-delete-region): Use region-extract-function. (cua-replace-region): Delete function. (cua-copy-region, cua-cut-region): Obey region-extract-function. (cua--pre-command-handler-1): Don't do the delete-selection thing. (cua--self-insert-char-p): Ignore `self-insert-iso'. (cua--init-keymaps): Don't remap delete-selection commands. (cua-mode): Use delete-selection-mode instead of rolling our own. * lisp/emulation/cua-rect.el (cua--rectangle-region-extract): New function. (region-extract-function): Use it. (cua-mouse-save-then-kill-rectangle): Use cua-copy-region. (cua-copy-rectangle, cua-cut-rectangle, cua-delete-rectangle): Delete functions. (cua--init-rectangles): Don't re-remap copy-region-as-kill, kill-ring-save, kill-region, delete-char, delete-forward-char. Ignore self-insert-iso. * lisp/menu-bar.el (clipboard-kill-ring-save, clipboard-kill-region): Obey region-extract-function. * lisp/emulation/cua-gmrk.el (cua--init-global-mark): Ignore `self-insert-iso'. Fixes: debbugs:16085
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog27
-rw-r--r--lisp/emulation/cua-base.el90
-rw-r--r--lisp/emulation/cua-gmrk.el1
-rw-r--r--lisp/emulation/cua-rect.el58
-rw-r--r--lisp/menu-bar.el12
5 files changed, 80 insertions, 108 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index fafeb959d43..1e384f25579 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,32 @@
12013-12-08 Stefan Monnier <monnier@iro.umontreal.ca> 12013-12-08 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * emulation/cua-rect.el (cua--rectangle-region-extract): New function.
4 (region-extract-function): Use it.
5 (cua-mouse-save-then-kill-rectangle): Use cua-copy-region.
6 (cua-copy-rectangle, cua-cut-rectangle, cua-delete-rectangle):
7 Delete functions.
8 (cua--init-rectangles): Don't re-remap copy-region-as-kill,
9 kill-ring-save, kill-region, delete-char, delete-forward-char.
10 Ignore self-insert-iso.
11
12 * emulation/cua-gmrk.el (cua--init-global-mark):
13 Ignore `self-insert-iso'.
14
15 * emulation/cua-base.el (cua--prefix-copy-handler)
16 (cua--prefix-cut-handler): Rely on region-extract-function rather than
17 checking cua--rectangle.
18 (cua-delete-region): Use region-extract-function.
19 (cua-replace-region): Delete function.
20 (cua-copy-region, cua-cut-region): Obey region-extract-function.
21 (cua--pre-command-handler-1): Don't do the delete-selection thing.
22 (cua--self-insert-char-p): Ignore `self-insert-iso'.
23 (cua--init-keymaps): Don't remap delete-selection commands.
24 (cua-mode): Use delete-selection-mode instead of rolling our own
25 (bug#16085).
26
27 * menu-bar.el (clipboard-kill-ring-save, clipboard-kill-region):
28 Obey region-extract-function.
29
3 Make registers and delete-selection-mode work on rectangles. 30 Make registers and delete-selection-mode work on rectangles.
4 * register.el (describe-register-1): Don't modify the register's value. 31 * register.el (describe-register-1): Don't modify the register's value.
5 (copy-to-register): Obey region-extract-function. 32 (copy-to-register): Obey region-extract-function.
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index 292fd401a56..66afcc29525 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -96,10 +96,6 @@
96;; This is done by highlighting the first occurrence of "redo" 96;; This is done by highlighting the first occurrence of "redo"
97;; and type "repeat" M-v M-v. 97;; and type "repeat" M-v M-v.
98 98
99;; Note: Since CUA-mode duplicates the functionality of the
100;; delete-selection-mode, that mode is automatically disabled when
101;; CUA-mode is enabled.
102
103 99
104;; CUA mode indications 100;; CUA mode indications
105;; -------------------- 101;; --------------------
@@ -601,8 +597,6 @@ a cons (TYPE . COLOR), then both properties are affected."
601 cua--last-killed-rectangle nil)) 597 cua--last-killed-rectangle nil))
602 598
603;; All behind cua--rectangle tests. 599;; All behind cua--rectangle tests.
604(declare-function cua-copy-rectangle "cua-rect" (arg))
605(declare-function cua-cut-rectangle "cua-rect" (arg))
606(declare-function cua--rectangle-left "cua-rect" (&optional val)) 600(declare-function cua--rectangle-left "cua-rect" (&optional val))
607(declare-function cua--delete-rectangle "cua-rect" ()) 601(declare-function cua--delete-rectangle "cua-rect" ())
608(declare-function cua--insert-rectangle "cua-rect" 602(declare-function cua--insert-rectangle "cua-rect"
@@ -733,9 +727,7 @@ Repeating prefix key when region is active works as a single prefix key."
733(defun cua--prefix-copy-handler (arg) 727(defun cua--prefix-copy-handler (arg)
734 "Copy region/rectangle, then replay last key." 728 "Copy region/rectangle, then replay last key."
735 (interactive "P") 729 (interactive "P")
736 (if cua--rectangle 730 (cua-copy-region arg)
737 (cua-copy-rectangle arg)
738 (cua-copy-region arg))
739 (let ((keys (this-single-command-keys))) 731 (let ((keys (this-single-command-keys)))
740 (setq unread-command-events 732 (setq unread-command-events
741 (cons (aref keys (1- (length keys))) unread-command-events)))) 733 (cons (aref keys (1- (length keys))) unread-command-events))))
@@ -743,9 +735,7 @@ Repeating prefix key when region is active works as a single prefix key."
743(defun cua--prefix-cut-handler (arg) 735(defun cua--prefix-cut-handler (arg)
744 "Cut region/rectangle, then replay last key." 736 "Cut region/rectangle, then replay last key."
745 (interactive "P") 737 (interactive "P")
746 (if cua--rectangle 738 (cua-cut-region arg)
747 (cua-cut-rectangle arg)
748 (cua-cut-region arg))
749 (let ((keys (this-single-command-keys))) 739 (let ((keys (this-single-command-keys)))
750 (setq unread-command-events 740 (setq unread-command-events
751 (cons (aref keys (1- (length keys))) unread-command-events)))) 741 (cons (aref keys (1- (length keys))) unread-command-events))))
@@ -815,10 +805,10 @@ Save a copy in register 0 if `cua-delete-copy-to-register-0' is non-nil."
815 (let ((start (mark)) (end (point))) 805 (let ((start (mark)) (end (point)))
816 (or (<= start end) 806 (or (<= start end)
817 (setq start (prog1 end (setq end start)))) 807 (setq start (prog1 end (setq end start))))
818 (setq cua--last-deleted-region-text (filter-buffer-substring start end)) 808 (setq cua--last-deleted-region-text
809 (funcall region-extract-function t))
819 (if cua-delete-copy-to-register-0 810 (if cua-delete-copy-to-register-0
820 (set-register ?0 cua--last-deleted-region-text)) 811 (set-register ?0 cua--last-deleted-region-text))
821 (delete-region start end)
822 (setq cua--last-deleted-region-pos 812 (setq cua--last-deleted-region-pos
823 (cons (current-buffer) 813 (cons (current-buffer)
824 (and (consp buffer-undo-list) 814 (and (consp buffer-undo-list)
@@ -826,17 +816,6 @@ Save a copy in register 0 if `cua-delete-copy-to-register-0' is non-nil."
826 (cua--deactivate) 816 (cua--deactivate)
827 (/= start end))) 817 (/= start end)))
828 818
829(defun cua-replace-region ()
830 "Replace the active region with the character you type."
831 (interactive)
832 (let ((not-empty (and cua-delete-selection (cua-delete-region))))
833 (unless (eq this-original-command this-command)
834 (let ((overwrite-mode
835 (and overwrite-mode
836 not-empty
837 (not (eq this-original-command 'self-insert-command)))))
838 (cua--fallback)))))
839
840(defun cua-copy-region (arg) 819(defun cua-copy-region (arg)
841 "Copy the region to the kill ring. 820 "Copy the region to the kill ring.
842With numeric prefix arg, copy to register 0-9 instead." 821With numeric prefix arg, copy to register 0-9 instead."
@@ -848,11 +827,11 @@ With numeric prefix arg, copy to register 0-9 instead."
848 (setq start (prog1 end (setq end start)))) 827 (setq start (prog1 end (setq end start))))
849 (cond 828 (cond
850 (cua--register 829 (cua--register
851 (copy-to-register cua--register start end nil)) 830 (copy-to-register cua--register start end nil 'region))
852 ((eq this-original-command 'clipboard-kill-ring-save) 831 ((eq this-original-command 'clipboard-kill-ring-save)
853 (clipboard-kill-ring-save start end)) 832 (clipboard-kill-ring-save start end 'region))
854 (t 833 (t
855 (copy-region-as-kill start end))) 834 (copy-region-as-kill start end 'region)))
856 (if cua-keep-region-after-copy 835 (if cua-keep-region-after-copy
857 (cua--keep-active) 836 (cua--keep-active)
858 (cua--deactivate)))) 837 (cua--deactivate))))
@@ -870,11 +849,11 @@ With numeric prefix arg, copy to register 0-9 instead."
870 (setq start (prog1 end (setq end start)))) 849 (setq start (prog1 end (setq end start))))
871 (cond 850 (cond
872 (cua--register 851 (cua--register
873 (copy-to-register cua--register start end t)) 852 (copy-to-register cua--register start end t 'region))
874 ((eq this-original-command 'clipboard-kill-region) 853 ((eq this-original-command 'clipboard-kill-region)
875 (clipboard-kill-region start end)) 854 (clipboard-kill-region start end 'region))
876 (t 855 (t
877 (kill-region start end)))) 856 (kill-region start end 'region))))
878 (cua--deactivate))) 857 (cua--deactivate)))
879 858
880;;; Generic commands for regions, rectangles, and global marks 859;;; Generic commands for regions, rectangles, and global marks
@@ -1135,9 +1114,9 @@ With a double \\[universal-argument] prefix argument, unconditionally set mark."
1135 (if cua-enable-region-auto-help 1114 (if cua-enable-region-auto-help
1136 (cua-help-for-region t))))) 1115 (cua-help-for-region t)))))
1137 1116
1138;;; Scrolling commands which does not signal errors at top/bottom 1117;; Scrolling commands which do not signal errors at top/bottom
1139;;; of buffer at first key-press (instead moves to top/bottom 1118;; of buffer at first key-press (instead moves to top/bottom
1140;;; of buffer). 1119;; of buffer).
1141 1120
1142(defun cua-scroll-up (&optional arg) 1121(defun cua-scroll-up (&optional arg)
1143 "Scroll text of current window upward ARG lines; or near full screen if no ARG. 1122 "Scroll text of current window upward ARG lines; or near full screen if no ARG.
@@ -1221,30 +1200,8 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1221 ((not (symbolp this-command)) 1200 ((not (symbolp this-command))
1222 nil) 1201 nil)
1223 1202
1224 ;; Handle delete-selection property on non-movement commands
1225 ((not (eq (get this-command 'CUA) 'move)) 1203 ((not (eq (get this-command 'CUA) 'move))
1226 (when (and mark-active (not deactivate-mark)) 1204 nil)
1227 (let* ((ds (or (get this-command 'delete-selection)
1228 (get this-command 'pending-delete)))
1229 (nc (cond
1230 ((not ds) nil)
1231 ((eq ds 'yank)
1232 'cua-paste)
1233 ((eq ds 'kill)
1234 (if cua--rectangle
1235 'cua-copy-rectangle
1236 'cua-copy-region))
1237 ((eq ds 'supersede)
1238 (if cua--rectangle
1239 'cua-delete-rectangle
1240 'cua-delete-region))
1241 (t
1242 (if cua--rectangle
1243 'cua-delete-rectangle ;; replace?
1244 'cua-replace-region)))))
1245 (if nc
1246 (setq this-original-command this-command
1247 this-command nc)))))
1248 1205
1249 ;; Handle shifted cursor keys and other movement commands. 1206 ;; Handle shifted cursor keys and other movement commands.
1250 ;; If region is not active, region is activated if key is shifted. 1207 ;; If region is not active, region is activated if key is shifted.
@@ -1329,7 +1286,7 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1329 ;; Return DEF if current key sequence is self-inserting in 1286 ;; Return DEF if current key sequence is self-inserting in
1330 ;; global-map. 1287 ;; global-map.
1331 (if (memq (global-key-binding (this-single-command-keys)) 1288 (if (memq (global-key-binding (this-single-command-keys))
1332 '(self-insert-command self-insert-iso)) 1289 '(self-insert-command))
1333 def nil)) 1290 def nil))
1334 1291
1335(defvar cua-global-keymap (make-sparse-keymap) 1292(defvar cua-global-keymap (make-sparse-keymap)
@@ -1457,13 +1414,6 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1457 (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix) 1414 (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix)
1458 (define-key cua--region-keymap [(shift control c)] 'cua--shift-control-c-prefix) 1415 (define-key cua--region-keymap [(shift control c)] 'cua--shift-control-c-prefix)
1459 1416
1460 ;; replace current region
1461 (define-key cua--region-keymap [remap self-insert-command] 'cua-replace-region)
1462 (define-key cua--region-keymap [remap self-insert-iso] 'cua-replace-region)
1463 (define-key cua--region-keymap [remap insert-register] 'cua-replace-region)
1464 (define-key cua--region-keymap [remap newline-and-indent] 'cua-replace-region)
1465 (define-key cua--region-keymap [remap newline] 'cua-replace-region)
1466 (define-key cua--region-keymap [remap open-line] 'cua-replace-region)
1467 ;; delete current region 1417 ;; delete current region
1468 (define-key cua--region-keymap [remap delete-backward-char] 'cua-delete-region) 1418 (define-key cua--region-keymap [remap delete-backward-char] 'cua-delete-region)
1469 (define-key cua--region-keymap [remap backward-delete-char] 'cua-delete-region) 1419 (define-key cua--region-keymap [remap backward-delete-char] 'cua-delete-region)
@@ -1589,8 +1539,10 @@ shifted movement key, set `cua-highlight-region-shift-only'."
1589 (and (boundp 'delete-selection-mode) delete-selection-mode) 1539 (and (boundp 'delete-selection-mode) delete-selection-mode)
1590 (and (boundp 'pc-selection-mode) pc-selection-mode) 1540 (and (boundp 'pc-selection-mode) pc-selection-mode)
1591 shift-select-mode)) 1541 shift-select-mode))
1592 (if (and (boundp 'delete-selection-mode) delete-selection-mode) 1542 (if cua-delete-selection
1593 (delete-selection-mode -1)) 1543 (delete-selection-mode 1)
1544 (if (and (boundp 'delete-selection-mode) delete-selection-mode)
1545 (delete-selection-mode -1)))
1594 (if (and (boundp 'pc-selection-mode) pc-selection-mode) 1546 (if (and (boundp 'pc-selection-mode) pc-selection-mode)
1595 (pc-selection-mode -1)) 1547 (pc-selection-mode -1))
1596 (cua--deactivate) 1548 (cua--deactivate)
@@ -1602,7 +1554,9 @@ shifted movement key, set `cua-highlight-region-shift-only'."
1602 (cua--saved-state 1554 (cua--saved-state
1603 (setq transient-mark-mode (car cua--saved-state)) 1555 (setq transient-mark-mode (car cua--saved-state))
1604 (if (nth 1 cua--saved-state) 1556 (if (nth 1 cua--saved-state)
1605 (delete-selection-mode 1)) 1557 (delete-selection-mode 1)
1558 (if (and (boundp 'delete-selection-mode) delete-selection-mode)
1559 (delete-selection-mode -1)))
1606 (if (nth 2 cua--saved-state) 1560 (if (nth 2 cua--saved-state)
1607 (pc-selection-mode 1)) 1561 (pc-selection-mode 1))
1608 (setq shift-select-mode (nth 3 cua--saved-state)) 1562 (setq shift-select-mode (nth 3 cua--saved-state))
diff --git a/lisp/emulation/cua-gmrk.el b/lisp/emulation/cua-gmrk.el
index 78665624946..5554a7b6f01 100644
--- a/lisp/emulation/cua-gmrk.el
+++ b/lisp/emulation/cua-gmrk.el
@@ -362,7 +362,6 @@ With prefix argument, don't jump to global mark when canceling it."
362 (define-key cua--global-mark-keymap [remap backward-delete-char] 'cua-delete-backward-char-at-global-mark) 362 (define-key cua--global-mark-keymap [remap backward-delete-char] 'cua-delete-backward-char-at-global-mark)
363 (define-key cua--global-mark-keymap [remap backward-delete-char-untabify] 'cua-delete-backward-char-at-global-mark) 363 (define-key cua--global-mark-keymap [remap backward-delete-char-untabify] 'cua-delete-backward-char-at-global-mark)
364 (define-key cua--global-mark-keymap [remap self-insert-command] 'cua-insert-char-at-global-mark) 364 (define-key cua--global-mark-keymap [remap self-insert-command] 'cua-insert-char-at-global-mark)
365 (define-key cua--global-mark-keymap [remap self-insert-iso] 'cua-insert-char-at-global-mark)
366 365
367 ;; Catch self-inserting characters which are "stolen" by other modes 366 ;; Catch self-inserting characters which are "stolen" by other modes
368 (define-key cua--global-mark-keymap [t] 367 (define-key cua--global-mark-keymap [t]
diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el
index 16d109c6360..fba80033281 100644
--- a/lisp/emulation/cua-rect.el
+++ b/lisp/emulation/cua-rect.el
@@ -461,7 +461,7 @@ If command is repeated at same position, delete the rectangle."
461 (cua--deactivate)) 461 (cua--deactivate))
462 (cua-mouse-resize-rectangle event) 462 (cua-mouse-resize-rectangle event)
463 (let ((cua-keep-region-after-copy t)) 463 (let ((cua-keep-region-after-copy t))
464 (cua-copy-rectangle arg) 464 (cua-copy-region arg)
465 (setq cua--mouse-last-pos (cons (point) cua--last-killed-rectangle))))) 465 (setq cua--mouse-last-pos (cons (point) cua--last-killed-rectangle)))))
466 466
467(defun cua--mouse-ignore (_event) 467(defun cua--mouse-ignore (_event)
@@ -945,32 +945,6 @@ With prefix argument, toggle restriction."
945 (interactive) 945 (interactive)
946 (cua--rectangle-move 'right)) 946 (cua--rectangle-move 'right))
947 947
948(defun cua-copy-rectangle (arg)
949 (interactive "P")
950 (setq arg (cua--prefix-arg arg))
951 (cua--copy-rectangle-as-kill arg)
952 (if cua-keep-region-after-copy
953 (cua--keep-active)
954 (cua--deactivate)))
955
956(defun cua-cut-rectangle (arg)
957 (interactive "P")
958 (if buffer-read-only
959 (cua-copy-rectangle arg)
960 (setq arg (cua--prefix-arg arg))
961 (goto-char (min (mark) (point)))
962 (cua--copy-rectangle-as-kill arg)
963 (cua--delete-rectangle))
964 (cua--deactivate))
965
966(defun cua-delete-rectangle ()
967 (interactive)
968 (goto-char (min (point) (mark)))
969 (if cua-delete-copy-to-register-0
970 (set-register ?0 (cua--extract-rectangle)))
971 (cua--delete-rectangle)
972 (cua--deactivate))
973
974(defun cua-rotate-rectangle () 948(defun cua-rotate-rectangle ()
975 (interactive) 949 (interactive)
976 (cua--rectangle-corner (if (= (cua--rectangle-left) (cua--rectangle-right)) 0 1)) 950 (cua--rectangle-corner (if (= (cua--rectangle-left) (cua--rectangle-right)) 0 1))
@@ -1402,6 +1376,30 @@ With prefix arg, indent to that column."
1402 (goto-char cua--rect-undo-set-point) 1376 (goto-char cua--rect-undo-set-point)
1403 (setq cua--rect-undo-set-point nil))) 1377 (setq cua--rect-undo-set-point nil)))
1404 1378
1379(add-function :around region-extract-function
1380 #'cua--rectangle-region-extract)
1381
1382(defun cua--rectangle-region-extract (orig &optional delete)
1383 (cond
1384 ((not cua--rectangle) (funcall orig delete))
1385 ((eq delete 'delete-only) (cua--delete-rectangle))
1386 (t
1387 (let* ((strs (cua--extract-rectangle))
1388 (str (mapconcat #'identity strs "\n")))
1389 (if delete (cua--delete-rectangle))
1390 (setq killed-rectangle strs)
1391 (setq cua--last-killed-rectangle
1392 (cons (and kill-ring (car kill-ring)) killed-rectangle))
1393 (when (eq last-command 'kill-region)
1394 ;; Try to prevent kill-region from appending this to some
1395 ;; earlier element.
1396 (setq last-command 'kill-region-dont-append))
1397 (when strs
1398 (put-text-property 0 (length str) 'yank-handler
1399 `(rectangle--insert-for-yank ,strs t)
1400 str)
1401 str)))))
1402
1405;;; Initialization 1403;;; Initialization
1406 1404
1407(defun cua--rect-M/H-key (key cmd) 1405(defun cua--rect-M/H-key (key cmd)
@@ -1414,11 +1412,6 @@ With prefix arg, indent to that column."
1414 (cua--rect-M/H-key ?\s 'cua-clear-rectangle-mark) 1412 (cua--rect-M/H-key ?\s 'cua-clear-rectangle-mark)
1415 (cua--M/H-key cua--region-keymap ?\s 'cua-toggle-rectangle-mark)) 1413 (cua--M/H-key cua--region-keymap ?\s 'cua-toggle-rectangle-mark))
1416 1414
1417 (define-key cua--rectangle-keymap [remap copy-region-as-kill] 'cua-copy-rectangle)
1418 (define-key cua--rectangle-keymap [remap kill-ring-save] 'cua-copy-rectangle)
1419 (define-key cua--rectangle-keymap [remap kill-region] 'cua-cut-rectangle)
1420 (define-key cua--rectangle-keymap [remap delete-char] 'cua-delete-rectangle)
1421 (define-key cua--rectangle-keymap [remap delete-forward-char] 'cua-delete-rectangle)
1422 (define-key cua--rectangle-keymap [remap set-mark-command] 'cua-toggle-rectangle-mark) 1415 (define-key cua--rectangle-keymap [remap set-mark-command] 'cua-toggle-rectangle-mark)
1423 1416
1424 (define-key cua--rectangle-keymap [remap forward-char] 'cua-resize-rectangle-right) 1417 (define-key cua--rectangle-keymap [remap forward-char] 'cua-resize-rectangle-right)
@@ -1440,7 +1433,6 @@ With prefix arg, indent to that column."
1440 (define-key cua--rectangle-keymap [remap backward-delete-char] 'cua-delete-char-rectangle) 1433 (define-key cua--rectangle-keymap [remap backward-delete-char] 'cua-delete-char-rectangle)
1441 (define-key cua--rectangle-keymap [remap backward-delete-char-untabify] 'cua-delete-char-rectangle) 1434 (define-key cua--rectangle-keymap [remap backward-delete-char-untabify] 'cua-delete-char-rectangle)
1442 (define-key cua--rectangle-keymap [remap self-insert-command] 'cua-insert-char-rectangle) 1435 (define-key cua--rectangle-keymap [remap self-insert-command] 'cua-insert-char-rectangle)
1443 (define-key cua--rectangle-keymap [remap self-insert-iso] 'cua-insert-char-rectangle)
1444 1436
1445 ;; Catch self-inserting characters which are "stolen" by other modes 1437 ;; Catch self-inserting characters which are "stolen" by other modes
1446 (define-key cua--rectangle-keymap [t] 1438 (define-key cua--rectangle-keymap [t]
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 13c4c36be17..9e267d26c9b 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -545,17 +545,17 @@
545 (let ((x-select-enable-clipboard t)) 545 (let ((x-select-enable-clipboard t))
546 (yank))) 546 (yank)))
547 547
548(defun clipboard-kill-ring-save (beg end) 548(defun clipboard-kill-ring-save (beg end &optional region)
549 "Copy region to kill ring, and save in the X clipboard." 549 "Copy region to kill ring, and save in the X clipboard."
550 (interactive "r") 550 (interactive "r\np")
551 (let ((x-select-enable-clipboard t)) 551 (let ((x-select-enable-clipboard t))
552 (kill-ring-save beg end))) 552 (kill-ring-save beg end region)))
553 553
554(defun clipboard-kill-region (beg end) 554(defun clipboard-kill-region (beg end &optional region)
555 "Kill the region, and save it in the X clipboard." 555 "Kill the region, and save it in the X clipboard."
556 (interactive "r") 556 (interactive "r\np")
557 (let ((x-select-enable-clipboard t)) 557 (let ((x-select-enable-clipboard t))
558 (kill-region beg end))) 558 (kill-region beg end region)))
559 559
560(defun menu-bar-enable-clipboard () 560(defun menu-bar-enable-clipboard ()
561 "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard. 561 "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard.