diff options
author | Richard M. Stallman <rms@gnu.org> | 2004-03-04 16:55:51 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2004-03-04 16:55:51 +0000 |
commit | 387f00e68d0bf41e79af10310d44a9cbd412a3c0 (patch) | |
tree | f30821c9cb6075df38e8f8dbededbaa2611047f9 /lisp/mouse-sel.el | |
parent | 29f128f625735cec363fb580e545c116d2189745 (diff) | |
download | emacs-387f00e68d0bf41e79af10310d44a9cbd412a3c0.tar.gz |
(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.
Diffstat (limited to 'lisp/mouse-sel.el')
-rw-r--r-- | lisp/mouse-sel.el | 15 |
1 files changed, 10 insertions, 5 deletions
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 ======================================== |