1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-20 18:17:20 +00:00

(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.
This commit is contained in:
Richard M. Stallman 2004-03-04 16:55:51 +00:00
parent 29f128f625
commit 387f00e68d

View File

@ -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 ========================================