unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
Cc: bug-gnu-emacs@gnu.org, rms@gnu.org, Emacs-Devel <emacs-devel@gnu.org>
Subject: RE: read-key-sequence(-vector) on Shift left/right gives[left]/[right], not [S-left]/[S-right] ?
Date: Tue, 7 Sep 2004 07:32:50 -0700	[thread overview]
Message-ID: <FDELKNEBLPKKDCEBEJCBCEECCHAA.drew.adams@oracle.com> (raw)
In-Reply-To: <86isaqqonn.fsf@ketchup.de.uu.net>

From: Kai Grossjohann:

> > (defun foo ()
> >  (interactive)
> >  (let ((foo (read-key-sequence-vector "" )))
> >  (message "foo: %s" foo)))
> >
> > Execute foo, press Shift+[left] or Shift+[right]. The message ([left] or
> > [right]) shows that the Shift modifier is lost.

> If S-<foo> is unbound, Emacs looks up the binding of <foo>.  So are
> S-<up> and S-<down> bound but S-<left> and S-<right> are unbound?

> The reason for this is such that you can use most keybindings even
> when caps lock is on.

------------8<-----------------------

Thanks, Kai. That was the answer I couldn't find (S-left/right weren't
bound).

However:

1) Where is this (perhaps handy but inconsistent/exceptional) behavior
documented? I haven't been able to find it in either the Emacs manual or the
Emacs Lisp manual. Perhaps this should be mentioned in the Emacs manual at
node Kinds of User Input?

2) Shouldn't it at least be documented in the doc strings of
read-key-sequence and read-key-sequence-vector? The doc string mentions that
button-down events are dropped, but it says nothing about dropping the shift
modifier. Are these two functions the only ones affected by this exceptional
convention?

3) The Emacs manual says, in node Window Handling Convenience Features and
Customization: "Not all terminals support shifted arrow keys". Without
knowing that the read-key-* functions drop the shift modifier if that key
sequence is currently unbound, someone could easily think that the terminal
just doesn't support shifted arrow keys. Convenience or confusion?

4) Is this really a good thing, anyway? If I want a command that reads key
sequences, should I really have to pre-bind (and later unbind, to clean up)
such "exceptional" keys, just to be able to read the input key sequence
correctly (to see what the user pressed)? At the least, shouldn't there be
an option in read-key-sequence and read-key-sequence-vector to _not_ ignore
the shift modifier?

5) What does key binding have to do with reading key input? Shouldn't code
be able to read user input without paying attention to key bindings (and
whether or not keys are bound)?

6) This is inconsistent (also) with read-event, which DTRT in this regard. I
guess that's what I would need to do in this case: read-event and then test
for modifiers. But that seems heavy-handed if what I really want to do is
just read a key sequence (read-key-sequence, read-key-sequence-vector).

7) If this is for the convenience of being able to use the keys with
caps-lock on, as the manual says, then why not just pre-bind shift-* to the
same binding as * (*= any key)? And let users know to do the same thing if
they rebind keys. The current approach seems like the wrong way to deal with
this.

Thanks,

  Drew

       reply	other threads:[~2004-09-07 14:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <86isaqqonn.fsf@ketchup.de.uu.net>
2004-09-07 14:32 ` Drew Adams [this message]
2004-09-07 14:47   ` read-key-sequence(-vector) on Shift left/right gives[left]/[right], not [S-left]/[S-right] ? Stefan
2004-09-07 15:47     ` Drew Adams
2004-09-08  0:22   ` Richard Stallman
2004-09-08  0:47     ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FDELKNEBLPKKDCEBEJCBCEECCHAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).