aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Mark Walters <markwalters1009@gmail.com>2013-11-17 12:04:09 +0000
committerGravatar David Bremner <david@tethera.net>2013-11-19 20:18:17 -0400
commit4eb151e26ce06f8889c6b1ca43ca79f7bfdab26d (patch)
tree0d643bde32175baa6492511d4668b630afa0397c /emacs
parent2fd7ef64baf02892a7bebfb57d593afb086145ef (diff)
emacs: do not put quoted reply in primary selection
In current emacs (24.3) select-active-regions is set to t by default. The reply insertion code sets the region to the quoted message to make it easy to delete (kill-region or C-w). These two things combine to put the quoted message in the primary selection. This is not what the user wanted and is a privacy risk (accidental pasting of the quoted message). We can avoid some of the problems by let-binding select-active-regions to nil. This fixes if the primary selection was previously in a non-emacs window but not if it was in an emacs window. To avoid the problem in the latter case we deactivate mark. One key test (which fails under many simpler "fixes") is: open emacs 24.3 with notmuch, open 2 windows (viewing different notmuch buffers), highlight some text in one, and then reply to a message in the other. In many of my earlier attempts to fix this big this test fails.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch-mua.el19
1 files changed, 17 insertions, 2 deletions
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 53802d26..00cd9808 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -346,10 +346,25 @@ the From: address first."
If PROMPT-FOR-SENDER is non-nil, the user will be prompted for
the From: address first. If REPLY-ALL is non-nil, the message
will be addressed to all recipients of the source message."
+
+;; In current emacs (24.3) select-active-regions is set to t by
+;; default. The reply insertion code sets the region to the quoted
+;; message to make it easy to delete (kill-region or C-w). These two
+;; things combine to put the quoted message in the primary selection.
+;;
+;; This is not what the user wanted and is a privacy risk (accidental
+;; pasting of the quoted message). We can avoid some of the problems
+;; by let-binding select-active-regions to nil. This fixes if the
+;; primary selection was previously in a non-emacs window but not if
+;; it was in an emacs window. To avoid the problem in the latter case
+;; we deactivate mark.
+
(let ((sender
(when prompt-for-sender
- (notmuch-mua-prompt-for-sender))))
- (notmuch-mua-reply query-string sender reply-all)))
+ (notmuch-mua-prompt-for-sender)))
+ (select-active-regions nil))
+ (notmuch-mua-reply query-string sender reply-all)
+ (deactivate-mark)))
(defun notmuch-mua-send-and-exit (&optional arg)
(interactive "P")