summaryrefslogtreecommitdiff
path: root/lisp/t-mouse.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2007-09-28 20:13:05 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2007-09-28 20:13:05 +0000
commit35a3b80ea44a886e94d0b40571f5cfd117d25eec (patch)
tree8d7425f4749bbe1d352107c22fc84ad91d48b58e /lisp/t-mouse.el
parentb75a1cd1034ee5d2942f9f2c7a6df347f330aeba (diff)
downloademacs-35a3b80ea44a886e94d0b40571f5cfd117d25eec.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.el44
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)