diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2007-09-28 20:13:31 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2007-09-28 20:13:31 +0000 |
commit | 0e2806fa7e416ccf7abcee708d5919eb52379a5e (patch) | |
tree | 038aadc7c6bef0db763d0a1cba0a15af8059b362 /lisp/t-mouse.el | |
parent | 4ce5ab773b96bcef00e412e08b84c8b374a949fe (diff) | |
download | emacs-0e2806fa7e416ccf7abcee708d5919eb52379a5e.tar.gz |
(gpm-mouse-mode): Rename from t-mouse-mode. Rewrite.
(t-mouse-mode): New compatibility alias.
Diffstat (limited to 'lisp/t-mouse.el')
-rw-r--r-- | lisp/t-mouse.el | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/lisp/t-mouse.el b/lisp/t-mouse.el index 821bad4e819..e88067b7fe5 100644 --- a/lisp/t-mouse.el +++ b/lisp/t-mouse.el @@ -40,29 +40,31 @@ ;;; Code: ;;;###autoload -(define-minor-mode t-mouse-mode - "Toggle t-mouse mode to use the mouse in Linux consoles. -With prefix arg, turn t-mouse mode on if arg is positive, otherwise turn it -off. +(define-obsolete-function-alias 't-mouse-mode 'gpm-mouse-mode "23.1") +;;;###autoload +(define-minor-mode gpm-mouse-mode + "Toggle gpm-mouse mode to use the mouse in GNU/Linux consoles. +With prefix arg, turn gpm-mouse mode on if arg is positive, +otherwise turn it off. -This allows the use of the mouse when operating on a Linux console, in the -same way as you can use the mouse under X11. -It requires the `mev' program, part of the `gpm' utilities." +This allows the use of the mouse when operating on a GNU/Linux console, +in the same way as you can use the mouse under X11. +It relies on the `gpm' daemon being activated." :global t :group 'mouse - (if window-system - (error "t-mouse only works in the console on GNU/Linux") - (if t-mouse-mode - (progn - (unless (fboundp 'term-open-connection) - (progn - (setq t-mouse-mode nil) - (error "Emacs must be built with Gpm to use this mode"))) - (unless (term-open-connection) - (progn - (setq t-mouse-mode nil) - (error "Can't open mouse connection")))) - ;; Turn it off - (term-close-connection)))) + (let ((activated nil)) + (unwind-protect + (progn + (unless (fboundp 'gpm-mouse-start) + (error "Emacs must be built with Gpm to use this mode")) + (when gpm-mouse-mode + (gpm-mouse-start) + (setq activated t))) + ;; If the user asked to turn it off do that. + ;; If something failed to turn it on, try to turn it off as well, + ;; just in case. + (when (and (fboundp 'gpm-mouse-stop) (not activated)) + (setq gpm-mouse-mode nil) + (gpm-mouse-stop))))) (provide 't-mouse) |