unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* C-u with mouse event is ignored?
@ 2005-01-07 18:03 Drew Adams
  2005-01-08 15:34 ` Richard Stallman
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2005-01-07 18:03 UTC (permalink / raw)


I'm probably missing something simple, but it looks like C-u followed by a
mouse event is ignored.

1) Is this by design or a bug?
2) If by design, shouldn't this be mentioned somewhere (e.g. node Prefix
Command Arguments of Emacs manual)?

Example:

(global-set-key [S-mouse-1] 'test)
(global-set-key [S-down-mouse-1] 'ignore) ; Get rid of `mouse-set-font'.

(defun test (arg) (interactive "P") (message "pref: %s" arg))

C-u followed by S-mouse-1 shows "arg: nil".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: C-u with mouse event is ignored?
  2005-01-07 18:03 C-u with mouse event is ignored? Drew Adams
@ 2005-01-08 15:34 ` Richard Stallman
  2005-01-08 19:15   ` Drew Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Stallman @ 2005-01-08 15:34 UTC (permalink / raw)
  Cc: emacs-devel

    I'm probably missing something simple, but it looks like C-u followed by a
    mouse event is ignored.

    1) Is this by design or a bug?

I don't know, but it seems rather silly to use mouse clicks
with keyboard arguments.

    2) If by design, shouldn't this be mentioned somewhere (e.g. node Prefix
    Command Arguments of Emacs manual)?

Certainly not there.  It isn't necessary to document that a certain
combination of inputs is meaningless.  We simply don't tell people
to use it.

However, it might make sense to document this in the Lisp manual
where `interactive' is described, since it is a limitation on
the documented constructs.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: C-u with mouse event is ignored?
  2005-01-08 15:34 ` Richard Stallman
@ 2005-01-08 19:15   ` Drew Adams
  2005-01-09  0:03     ` Stefan
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2005-01-08 19:15 UTC (permalink / raw)
  Cc: emacs-devel

        I'm probably missing something simple, but it looks like
        C-u followed by a mouse event is ignored.
        Is this by design or a bug?

I _was_ missing something. You can use `C-u' with mouse key sequences with
no problem. (You can also use it with menu key sequences, which are usually
accessed by mouse.)

It turns out that in the example I gave, `C-u' didn't work because of the
binding (global-set-key [S-down-mouse-1] 'ignore), which I used to get rid
of the default binding to `mouse-set-font'. It turns out that if you use,
instead, (global-set-key [S-down-mouse-1] nil) there is no problem - the
prefix arg is passed to function test.

IOW, the following works (the `C-u' arg is displayed correctly), but it does
not work with nil replaced by 'ignore:

 (defun test (arg) (interactive "P") (message "pref: %s" arg))
 (global-set-key [S-mouse-1] 'test)
 (global-set-key [S-down-mouse-1] nil) ; Get rid of `mouse-set-font'.

I suppose that this is because the `C-u' arg is passed to command `ignore',
rather than to command `test'. This didn't occur to me - this is the first
time I've noticed a difference between 'ignore and nil as a key binding (the
latter being actually an unbinding).

    I don't know, but it seems rather silly to use mouse clicks
    with keyboard arguments.

Why? because it requires using both keyboard and mouse? I use the mouse with
one hand and the keyboard with another all the time. Do you ever use Control
or Meta with a mouse button?

`C-u' might be a stretch for a single hand, depending on the keyboard, but
one can always bind `universal-argument' to a different key sequence that's
less of a stretch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: C-u with mouse event is ignored?
  2005-01-08 19:15   ` Drew Adams
@ 2005-01-09  0:03     ` Stefan
  2005-01-09  0:36       ` Drew Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan @ 2005-01-09  0:03 UTC (permalink / raw)
  Cc: rms, emacs-devel

> rather than to command `test'. This didn't occur to me - this is the first
> time I've noticed a difference between 'ignore and nil as a key binding (the
> latter being actually an unbinding).

There are other cases where nil and `ignore' behave differently: an `ignore'
in a buffer-local map will shadow a global binding where a nil will not.

There are also cases where a nil binding is not the same as no-binding
at all.  IIRC the difference is that a nil binding shadows a binding in
a parent map.


        Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: C-u with mouse event is ignored?
  2005-01-09  0:03     ` Stefan
@ 2005-01-09  0:36       ` Drew Adams
  0 siblings, 0 replies; 5+ messages in thread
From: Drew Adams @ 2005-01-09  0:36 UTC (permalink / raw)
  Cc: rms, emacs-devel

    > rather than to command `test'. This didn't occur to me - this
    > is the first time I've noticed a difference between 'ignore
    > and nil as a key binding (the latter being actually an unbinding).

    There are other cases where nil and `ignore' behave
    differently: an `ignore'
    in a buffer-local map will shadow a global binding where a nil will not.

    There are also cases where a nil binding is not the same as no-binding
    at all.  IIRC the difference is that a nil binding shadows a binding in
    a parent map.

Thanks. I later figured out the part about ignore shadowing a global
binding, but I wasn't aware of the last part (nil shadowing a parent-map
binding).

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-01-09  0:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-07 18:03 C-u with mouse event is ignored? Drew Adams
2005-01-08 15:34 ` Richard Stallman
2005-01-08 19:15   ` Drew Adams
2005-01-09  0:03     ` Stefan
2005-01-09  0:36       ` Drew Adams

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).