comparison lisp/t-mouse.el @ 84970:3e6ef5f41da8

(gpm-mouse-mode): Rename from t-mouse-mode. Rewrite. (t-mouse-mode): New compatibility alias.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 28 Sep 2007 20:13:05 +0000
parents e5a68f18fcb9
children 107ccd98fa12
comparison
equal deleted inserted replaced
84969:6e58c1c8c0fc 84970:3e6ef5f41da8
38 ;; 38 ;;
39 39
40 ;;; Code: 40 ;;; Code:
41 41
42 ;;;###autoload 42 ;;;###autoload
43 (define-minor-mode t-mouse-mode 43 (define-obsolete-function-alias 't-mouse-mode 'gpm-mouse-mode "23.1")
44 "Toggle t-mouse mode to use the mouse in Linux consoles. 44 ;;;###autoload
45 With prefix arg, turn t-mouse mode on if arg is positive, otherwise turn it 45 (define-minor-mode gpm-mouse-mode
46 off. 46 "Toggle gpm-mouse mode to use the mouse in GNU/Linux consoles.
47 With prefix arg, turn gpm-mouse mode on if arg is positive,
48 otherwise turn it off.
47 49
48 This allows the use of the mouse when operating on a Linux console, in the 50 This allows the use of the mouse when operating on a GNU/Linux console,
49 same way as you can use the mouse under X11. 51 in the same way as you can use the mouse under X11.
50 It requires the `mev' program, part of the `gpm' utilities." 52 It relies on the `gpm' daemon being activated."
51 :global t :group 'mouse 53 :global t :group 'mouse
52 (if window-system 54 (let ((activated nil))
53 (error "t-mouse only works in the console on GNU/Linux") 55 (unwind-protect
54 (if t-mouse-mode 56 (progn
55 (progn 57 (unless (fboundp 'gpm-mouse-start)
56 (unless (fboundp 'term-open-connection) 58 (error "Emacs must be built with Gpm to use this mode"))
57 (progn 59 (when gpm-mouse-mode
58 (setq t-mouse-mode nil) 60 (gpm-mouse-start)
59 (error "Emacs must be built with Gpm to use this mode"))) 61 (setq activated t)))
60 (unless (term-open-connection) 62 ;; If the user asked to turn it off do that.
61 (progn 63 ;; If something failed to turn it on, try to turn it off as well,
62 (setq t-mouse-mode nil) 64 ;; just in case.
63 (error "Can't open mouse connection")))) 65 (when (and (fboundp 'gpm-mouse-stop) (not activated))
64 ;; Turn it off 66 (setq gpm-mouse-mode nil)
65 (term-close-connection)))) 67 (gpm-mouse-stop)))))
66 68
67 (provide 't-mouse) 69 (provide 't-mouse)
68 70
69 ;; arch-tag: a63163b3-bfbe-4eb2-ab4f-201cd164b05d 71 ;; arch-tag: a63163b3-bfbe-4eb2-ab4f-201cd164b05d
70 ;;; t-mouse.el ends here 72 ;;; t-mouse.el ends here