GNU bug report logs - #4124
23.1; mwheel in --daemon mode

Previous Next

Package: emacs;

Reported by: John Prevost <prevost1 <at> cert.org>

Date: Tue, 11 Aug 2009 15:55:04 UTC

Severity: normal

Merged with 4127

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 4124 in the body.
You can then email your comments to 4124 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4124; Package emacs. (Tue, 11 Aug 2009 15:55:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to John Prevost <prevost1 <at> cert.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 11 Aug 2009 15:55:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: John Prevost <prevost1 <at> cert.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.1; mwheel in --daemon mode
Date: Tue, 11 Aug 2009 11:47:55 -0400
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs <at> gnu.org mailing list,
and to the gnu.emacs.bug news group.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

When emacs is started in --daemon mode, the window-system variable is
initially 'nil'.  In mwheel.el, mouse-wheel-down-event and
mouse-wheel-up-event are bound with defcustom declarations like the
following:

(defcustom mouse-wheel-down-event
  ;; In the latest versions of XEmacs, we could just use mouse-%s as well.
  (if (memq window-system '(w32 ns))
      'wheel-up
    (intern (format (if (featurep 'xemacs) "button%s" "mouse-%s")
		    mouse-wheel-down-button)))
  "Event used for scrolling down."
  :group 'mouse
  :type 'symbol
  :set 'mouse-wheel-change-button)

Since these run before any terminal is created in the --daemon case,
window-system may not be set to anything at all.

It is possible that this is a bug in mwheel, and that mwheel (and other
packages) should take care not to make use of the window-system variable
until startup.  (This may be particularly important if it's possible for
a single emacs binary to have support for multiple window systems.)

It is possible that a better solution to the problem that mwheel solves
above would be for either term/x-win.el to define-key mouse-4 and
mouse-5 to wheel-up and wheel-down, or for term/w32-win.el and
term/ns-win.el to define-key wheel-up and wheel-down to mouse-4 and
mouse-5, so that mwheel and other packages can use the same symbol on
all window systems.


Either way, the current state of the world is that --daemon results in a
non-functional mouse wheel on w32 and ns.


If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/Users/prevost1/Documents/src/emacs-23.1/nextstep/Emacs.app/Contents/Resources/etc/DEBUG for instructions.


In GNU Emacs 23.1.1 (i386-apple-darwin9.7.0, NS apple-appkit-949.46)
 of 2009-08-07 on TELPERION.WV.CC.CMU.EDU
Windowing system distributor `Apple', version 10.3.949
configured using `configure  '--prefix=/opt/emacs-23.1' '--with-ns''

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: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  diff-auto-refine-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  global-auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<help-echo> s-x r e p o r t M-x r e p o t <backspace> 
r t - e m <tab> <return>

Recent messages:
Loading /Users/prevost1/Documents/src/elisp/nxml-mode/rng-auto.el (source)...done
Loading /Users/prevost1/Documents/src/elisp/mercurial.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Terminal setup done
kill-region: The mark is not set now, so there is no region




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4124; Package emacs. (Tue, 11 Aug 2009 17:35:04 GMT) Full text and rfc822 format available.

Message #8 received at 4124 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: John Prevost <prevost1 <at> cert.org>
Cc: 4124 <at> debbugs.gnu.org
Subject: Re: bug#4124: 23.1; mwheel in --daemon mode
Date: Tue, 11 Aug 2009 10:27:48 -0700 (PDT)
John Prevost <prevost1 <at> cert.org> writes:

  > Please write in English if possible, because the Emacs maintainers
  > usually do not have translators to read other languages for them.
  > 
  > Your bug report will be posted to the bug-gnu-emacs <at> gnu.org mailing list,
  > and to the gnu.emacs.bug news group.
  > 
  > Please describe exactly what actions triggered the bug
  > and the precise symptoms of the bug:
  > 
  > When emacs is started in --daemon mode, the window-system variable is
  > initially 'nil'.  In mwheel.el, mouse-wheel-down-event and
  > mouse-wheel-up-event are bound with defcustom declarations like the
  > following:
  > 
  > (defcustom mouse-wheel-down-event
  >   ;; In the latest versions of XEmacs, we could just use mouse-%s as well.
  >   (if (memq window-system '(w32 ns))

In emacs-23 uses of window-system to initialize variables are most of
the time bugs because window-system is not a constant anymore.  Its
value depends of the frame it is used in, and we can have TTY and GUI
frames in the same emacs sessions, so...


  >       'wheel-up
  >     (intern (format (if (featurep 'xemacs) "button%s" "mouse-%s")
  > 		    mouse-wheel-down-button)))
  >   "Event used for scrolling down."
  >   :group 'mouse
  >   :type 'symbol
  >   :set 'mouse-wheel-change-button)
  > 
  > Since these run before any terminal is created in the --daemon case,
  > window-system may not be set to anything at all.
  > 
  > It is possible that this is a bug in mwheel, and that mwheel (and other
  > packages) should take care not to make use of the window-system variable
  > until startup.  (This may be particularly important if it's possible for
  > a single emacs binary to have support for multiple window systems.)
  > 
  > It is possible that a better solution to the problem that mwheel solves
  > above would be for either term/x-win.el to define-key mouse-4 and
  > mouse-5 to wheel-up and wheel-down, or for term/w32-win.el and
  > term/ns-win.el to define-key wheel-up and wheel-down to mouse-4 and
  > mouse-5, so that mwheel and other packages can use the same symbol on
  > all window systems.
  > 
  > 
  > Either way, the current state of the world is that --daemon results in a
  > non-functional mouse wheel on w32 and ns.

w32 does not use the daemon mode, nor can it use TTY and w32 frames at
the same time, so it should not matter.

What happens on ns if you take the `ns' out of the memq test above, does
it make it work?  (I don't have a mouse with a wheel, nor ns ...)


  > If Emacs crashed, and you have the Emacs process in the gdb debugger,
  > please include the output from the following gdb commands:
  >     `bt full' and `xbacktrace'.
  > If you would like to further debug the crash, please read the file
  > /Users/prevost1/Documents/src/emacs-23.1/nextstep/Emacs.app/Contents/Resources/etc/DEBUG for instructions.
  > 
  > 
  > In GNU Emacs 23.1.1 (i386-apple-darwin9.7.0, NS apple-appkit-949.46)
  >  of 2009-08-07 on TELPERION.WV.CC.CMU.EDU
  > Windowing system distributor `Apple', version 10.3.949
  > configured using `configure  '--prefix=/opt/emacs-23.1' '--with-ns''
  > 
  > 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: nil
  >   value of $XMODIFIERS: nil
  >   locale-coding-system: nil
  >   default-enable-multibyte-characters: t
  > 
  > Major mode: Fundamental
  > 
  > Minor modes in effect:
  >   diff-auto-refine-mode: t
  >   tooltip-mode: t
  >   tool-bar-mode: t
  >   mouse-wheel-mode: t
  >   menu-bar-mode: t
  >   file-name-shadow-mode: t
  >   global-font-lock-mode: t
  >   global-auto-composition-mode: t
  >   auto-encryption-mode: t
  >   auto-compression-mode: t
  >   line-number-mode: t
  >   transient-mark-mode: t
  > 
  > Recent input:
  > <help-echo> s-x r e p o r t M-x r e p o t <backspace> 
  > r t - e m <tab> <return>
  > 
  > Recent messages:
  > Loading /Users/prevost1/Documents/src/elisp/nxml-mode/rng-auto.el (source)...done
  > Loading /Users/prevost1/Documents/src/elisp/mercurial.el (source)...done
  > For information about GNU Emacs and the GNU system, type C-h C-a.
  > Terminal setup done
  > kill-region: The mark is not set now, so there is no region



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4124; Package emacs. (Tue, 11 Aug 2009 18:20:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to John Prevost <prevost1 <at> cert.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 11 Aug 2009 18:20:04 GMT) Full text and rfc822 format available.

Message #13 received at 4124 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: John Prevost <prevost1 <at> cert.org>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: "4124\@debbugs.gnu.org" <4124 <at> debbugs.gnu.org>
Subject: Re: bug#4124: 23.1; mwheel in --daemon mode
Date: Tue, 11 Aug 2009 14:13:10 -0400
Dan Nicolaescu <dann <at> ics.uci.edu> writes:

> In emacs-23 uses of window-system to initialize variables are most of
> the time bugs because window-system is not a constant anymore.  Its
> value depends of the frame it is used in, and we can have TTY and GUI
> frames in the same emacs sessions, so...

That was my assumption, yup.

> w32 does not use the daemon mode, nor can it use TTY and w32 frames at
> the same time, so it should not matter.

Hmm.  Is it not possible to start emacs in --daemon mode and use
emacsclient to open a file in w32?  I thought I had tested this and that
it had worked.  I did note that it was impossible to create tty and w32
frames at the same time.

> What happens on ns if you take the `ns' out of the memq test above, does
> it make it work?  (I don't have a mouse with a wheel, nor ns ...)

No.  The essential problem is that in 'x', the mouse wheel events are
'mouse-4' and 'mouse-5', while in 'ns' and 'w32', the mouse wheel events
are 'wheel-up' and 'wheel-down'.  The defcustom sets the default for the
events it will expect for to 'mouse-4' and 'mouse-5' (i.e. X-style
bindings), unless the window-system is ns or w32, in which case it uses
'wheel-up' and 'wheel-down'.

In fact, ns does need 'wheel-up' and 'wheel-down', so removing it from
the memq would result it in never working at all (i.e. failing always,
rather than only failing when emacs is started with --daemon).

It is possible to set the value of the mouse-wheel-down-event and
mouse-wheel-up-event variables in the user startup file to work around
this problem.  The drawback here is that either the startup
file/customization is specialized to ns/w32 (and the same startup file
cannot be used on X), or the variable has to be set in the .emacs file
based on the operating system (which is a problem if the user has both X
and NS versions of emacs on Mac OS).

Hence my suggestion that a better long-term solution is to pick one or
the other representation of the mouse-wheel as "standard" (either
mouse-4 and mouse-5 as in X or wheel-up and wheel-down as in NS and W32)
and have the term init files set up the appropriate mapping from native
events to the standard events.



In any case, it's clear that this is a problem in mwheel, and I do have
a short-term workaround.

Thanks very much,

John.



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4124; Package emacs. (Tue, 11 Aug 2009 18:30:04 GMT) Full text and rfc822 format available.

Message #16 received at 4124 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: John Prevost <prevost1 <at> cert.org>
Cc: "4124\@debbugs.gnu.org" <4124 <at> debbugs.gnu.org>
Subject: Re: bug#4124: 23.1; mwheel in --daemon mode
Date: Tue, 11 Aug 2009 11:22:51 -0700 (PDT)
John Prevost <prevost1 <at> cert.org> writes:

  > Dan Nicolaescu <dann <at> ics.uci.edu> writes:
  > 
  > > In emacs-23 uses of window-system to initialize variables are most of
  > > the time bugs because window-system is not a constant anymore.  Its
  > > value depends of the frame it is used in, and we can have TTY and GUI
  > > frames in the same emacs sessions, so...
  > 
  > That was my assumption, yup.
  > 
  > > w32 does not use the daemon mode, nor can it use TTY and w32 frames at
  > > the same time, so it should not matter.
  > 
  > Hmm.  Is it not possible to start emacs in --daemon mode and use
  > emacsclient to open a file in w32?  I thought I had tested this and that
  > it had worked. 

No, it does not, from emacs/src/emacs.c:

#else /* DOS_NT */
      fprintf (stderr, "This platform does not support the -daemon  flag.\n");
      exit (1);
#endif /* DOS_NT */

  > In any case, it's clear that this is a problem in mwheel, and I do have
  > a short-term workaround.

It would be good if someone would look at mwheel.el and fix it
properly... 



Merged 4124 4127. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Tue, 11 Aug 2009 19:35:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4124; Package emacs. (Thu, 13 Aug 2009 17:55:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 13 Aug 2009 17:55:06 GMT) Full text and rfc822 format available.

Message #23 received at 4124 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: John Prevost <prevost1 <at> cert.org>
Cc: 4124 <at> debbugs.gnu.org, Dan Nicolaescu <dann <at> ics.uci.edu>
Subject: Re: bug#4124: 23.1; mwheel in --daemon mode
Date: Thu, 13 Aug 2009 13:49:49 -0400
> No.  The essential problem is that in 'x', the mouse wheel events are
> 'mouse-4' and 'mouse-5', while in 'ns' and 'w32', the mouse wheel events
> are 'wheel-up' and 'wheel-down'.  The defcustom sets the default for the

Indeed.  We should remap mouse-4/5 to wheel-up/down in term/x-win.el via
function-key-map.  The only reason why I haven't done that yet is that
it is also needed for C-mouse-4/5, M-mouse-4/5, C-M-mouse-4/5 and on and
on for all combinations of modifiers (2^5).  64 additional entries in
function-key-map is not that bad, but for those users whose mouse-4/5 is
not a wheel mouse, it can be a serious pain in the rear to remove them.

So basically, I'd like to extend the function-key-map facilities so that
you can have entries that remap a whole set of events, but it's still on
the todo list.


        Stefan



Reply sent to Chong Yidong <cyd <at> stupidchicken.com>:
You have taken responsibility. (Sun, 16 Aug 2009 06:00:04 GMT) Full text and rfc822 format available.

Notification sent to John Prevost <prevost1 <at> cert.org>:
bug acknowledged by developer. (Sun, 16 Aug 2009 06:00:04 GMT) Full text and rfc822 format available.

Message #28 received at 4124-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: John Prevost <prevost1 <at> cert.org>, 4124-done <at> debbugs.gnu.org,
        Dan Nicolaescu <dann <at> ics.uci.edu>
Subject: Re: bug#4124: 23.1; mwheel in --daemon mode
Date: Sun, 16 Aug 2009 01:56:19 -0400
> > No.  The essential problem is that in 'x', the mouse wheel events are
> > 'mouse-4' and 'mouse-5', while in 'ns' and 'w32', the mouse wheel
> > events are 'wheel-up' and 'wheel-down'. 
>
> Indeed.  We should remap mouse-4/5 to wheel-up/down in term/x-win.el
> via function-key-map... So basically, I'd like to extend the
> function-key-map facilities so that you can have entries that remap a
> whole set of events, but it's still on the todo list.

In the meantime, we can just test for the `ns-win' and `w32-win'
features (or, equivalently, the system-type variable, but I think the
former are more to the point).  I checked in a fix to mwheel.el along
these lines.



Reply sent to Chong Yidong <cyd <at> stupidchicken.com>:
You have taken responsibility. (Sun, 16 Aug 2009 06:00:05 GMT) Full text and rfc822 format available.

Notification sent to John Prevost <prevost1 <at> cert.org>:
bug acknowledged by developer. (Sun, 16 Aug 2009 06:00:05 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Sun, 13 Sep 2009 14:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 277 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.