|
From: | David Reitter |
Subject: | clipboard-kill-ring-save with tmm: avoid when region inactive? |
Date: | Tue, 10 Feb 2015 09:20:21 -0500 |
Hi, Would the change outlined below (see user message quoted) be reasonable? When transient-mark-mode is on, we should require the region to be active in order to copy/kill it via the commands. I did not find any programmatic use of these commands in Emacs code, though one would wonder if this creates package incompatibilities. - DR diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index cd1a4d0..e6d3b12c 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -536,14 +536,18 @@ (defun clipboard-kill-ring-save (beg end &optional region) "Copy region to kill ring, and save in the GUI's clipboard." (interactive "r\np") - (let ((gui-select-enable-clipboard t)) - (kill-ring-save beg end region))) + (if (or (not transient-mark-mode) (use-region-p)) + (let ((gui-select-enable-clipboard t)) + (kill-ring-save beg end region)) + (error "Region not active."))) (defun clipboard-kill-region (beg end &optional region) "Kill the region, and save it in the GUI's clipboard." (interactive "r\np") - (let ((gui-select-enable-clipboard t)) - (kill-region beg end region))) + (if (or (not transient-mark-mode) (use-region-p)) + (let ((gui-select-enable-clipboard t)) + (kill-region beg end region)) + (error "Region not active."))) (defun menu-bar-enable-clipboard () "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard.
|
[Prev in Thread] | Current Thread | [Next in Thread] |