From: Richard M. Stallman Date: Thu, 4 Mar 2004 16:55:51 +0000 (+0000) Subject: (mouse-sel-has-been-enabled): New var. X-Git-Tag: ttn-vms-21-2-B4~7365 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=387f00e68d0bf41e79af10310d44a9cbd412a3c0;p=emacs.git (mouse-sel-has-been-enabled): New var. (mouse-sel-mode): When enabling, set mouse-sel-has-been-enabled. When disabling, restore old values only if mouse-sel-has-been-enabled. --- diff --git a/lisp/mouse-sel.el b/lisp/mouse-sel.el index 92e837657f6..57c131d43c1 100644 --- a/lisp/mouse-sel.el +++ b/lisp/mouse-sel.el @@ -196,6 +196,9 @@ If nil, point will always be placed at the beginning of the region." ;;=== User Command ======================================================== +(defvar mouse-sel-has-been-enabled nil + "Non-nil if Mouse Sel mode has been enabled at least once.") + (defvar mouse-sel-original-bindings nil) (defvar mouse-sel-original-interprogram-cut-function nil) (defvar mouse-sel-original-interprogram-paste-function nil) @@ -252,7 +255,8 @@ primary selection and region." (setq mouse-sel-original-interprogram-cut-function interprogram-cut-function mouse-sel-original-interprogram-paste-function - interprogram-paste-function) + interprogram-paste-function + mouse-sel-has-been-enabled t) (unless (eq mouse-sel-default-bindings 'interprogram-cut-paste) (setq interprogram-cut-function nil interprogram-paste-function nil)))) @@ -261,10 +265,11 @@ primary selection and region." (remove-hook 'x-lost-selection-hooks 'mouse-sel-lost-selection-hook) (dolist (binding mouse-sel-original-bindings) (global-set-key (car binding) (cdr binding))) - (setq interprogram-cut-function - mouse-sel-original-interprogram-cut-function - interprogram-paste-function - mouse-sel-original-interprogram-paste-function))) + (if mouse-sel-has-been-enabled + (setq interprogram-cut-function + mouse-sel-original-interprogram-cut-function + interprogram-paste-function + mouse-sel-original-interprogram-paste-function)))) ;;=== Internal Variables/Constants ========================================