* 23.0.60; customize or whatever to disable gpm-mouse-mode
@ 2008-06-01 22:44 Kevin Ryde
2008-06-10 21:14 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Ryde @ 2008-06-01 22:44 UTC (permalink / raw)
To: emacs-pretest-bug
I had some trouble disabling gpm-mouse-mode, which is on by default in
the recent cvs.
I tried M-x customize-variable gpm-mouse-mode and saving, which turned
it off, but on the next startup it was enabled again. Then I tried
"(gpm-mouse-mode 0)" in my .emacs, but that didn't have any effect at
all.
I suspect terminal-init-linux is forcibly turning it on after .emacs and
customizations have run.
I wonder if a saved customize could work in the next session. Or
alternatively have some guidance in the docstring or manual on
disabling. (I got what I wanted for the moment under term-setup-hook.
I like the gpm/kernel default selection stuff and get fairly annoyed by
programs that take it over with their own ideas :-).
I saw frames.texi mentions t-mouse-mode, perhaps it could have a couple
of words about it being enabled by default now, if that's going to be
the case (still as/when available, of course).
In GNU Emacs 23.0.60.1 (i586-pc-linux-gnu, GTK+ Version 2.12.9)
of 2008-06-01 on blah.blah
configured using `configure 'CFLAGS=-O -g' '--prefix=/down/emacs/b/inst' '--with-x-toolkit=gtk''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_AU
value of $XMODIFIERS: nil
locale-coding-system: iso-latin-1-unix
default-enable-multibyte-characters: t
Major mode: Lisp Interaction
Minor modes in effect:
show-paren-mode: t
file-name-shadow-mode: t
global-auto-composition-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
ESC x r e p o r t - e m a TAB RET
Recent messages:
("/down/emacs/b/src/emacs")
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: 23.0.60; customize or whatever to disable gpm-mouse-mode
2008-06-01 22:44 23.0.60; customize or whatever to disable gpm-mouse-mode Kevin Ryde
@ 2008-06-10 21:14 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2008-06-10 21:14 UTC (permalink / raw)
To: Kevin Ryde; +Cc: emacs-pretest-bug
> I had some trouble disabling gpm-mouse-mode, which is on by default in
> the recent cvs.
> I tried M-x customize-variable gpm-mouse-mode and saving, which turned
> it off, but on the next startup it was enabled again. Then I tried
> "(gpm-mouse-mode 0)" in my .emacs, but that didn't have any effect at
> all.
(defalias 'gpm-mouse-mode 'ignore)
will do the trick. But no, this is not the way it should be, I agree.
Can you try the patch below to see if it works more like what you'd expect?
Stefan
Index: lisp/t-mouse.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/t-mouse.el,v
retrieving revision 1.21
diff -u -r1.21 t-mouse.el
--- lisp/t-mouse.el 6 May 2008 07:57:53 -0000 1.21
+++ lisp/t-mouse.el 10 Jun 2008 21:12:51 -0000
@@ -41,6 +41,27 @@
;; Prevent warning when compiling in an Emacs without gpm support.
(declare-function gpm-mouse-start "term.c" ())
+(defun gpm-mouse-enable ()
+ "Try to enable gpm mouse support on the current terminal."
+ (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)
+ (set-terminal-parameter nil 'gpm-mouse-active t)
+ (setq activated t)))
+ ;; If something failed to turn it on, try to turn it off as well,
+ ;; just in case.
+ (unless activated (gpm-mouse-disable)))))
+
+(defun gpm-mouse-disable ()
+ "Try to disable gpm mouse support on the current terminal."
+ (when (fboundp 'gpm-mouse-stop)
+ (gpm-mouse-stop))
+ (set-terminal-parameter nil 'gpm-mouse-active nil))
+
;;;###autoload
(define-obsolete-function-alias 't-mouse-mode 'gpm-mouse-mode "23.1")
;;;###autoload
@@ -52,21 +73,14 @@
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
- (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)))))
+ :global t :group 'mouse :init-value t
+ (dolist (terminal (terminal-list))
+ (when (and (eq t (terminal-live-p terminal))
+ (not (eq gpm-mouse-mode
+ (terminal-parameter terminal 'gpm-mouse-active))))
+ ;; Simulate selecting a terminal by selecting one of its frames ;-(
+ (with-selected-frame (car (frames-on-display-list terminal))
+ (if gpm-mouse-mode (gpm-mouse-enable) (gpm-mouse-disable))))))
(provide 't-mouse)
Index: lisp/term/linux.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/term/linux.el,v
retrieving revision 1.13
diff -u -r1.13 linux.el
--- lisp/term/linux.el 7 Jun 2008 02:42:21 -0000 1.13
+++ lisp/term/linux.el 10 Jun 2008 21:12:51 -0000
@@ -9,7 +9,7 @@
;; It can't really display underlines.
(tty-no-underline)
- (ignore-errors (gpm-mouse-mode 1))
+ (ignore-errors (if gpm-mouse-mode (gpm-mouse-enable)))
;; Make Latin-1 input characters work, too.
;; Meta will continue to work, because the kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-06-10 21:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-01 22:44 23.0.60; customize or whatever to disable gpm-mouse-mode Kevin Ryde
2008-06-10 21:14 ` Stefan Monnier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).