unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Completion keys and rectangles
@ 2009-11-16 19:58 Per Starbäck
  2009-11-16 21:29 ` Drew Adams
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Per Starbäck @ 2009-11-16 19:58 UTC (permalink / raw)
  To: emacs-devel

M-TAB is very often used by the window manager. "(emacs) Symbol
Completion" therefore advices to use ESC TAB
or C-M-i instead to avoid that when using a completion command in Emacs.

nxml-mode avoids the problem by binding C-RET as well to
nxml-complete, and only that when Emacs is used under
a window system. (See nxml-bind-meta-tab-to-complete-flag.)

But there is an unfortunate collision in that cua-mode uses C-RET for
cua-set-rectangle-mark, so cua-mode people don't
get any binding at all for nxml-complete.

What do you think is the best solution to the window mangers vs.
completion in emacs problem? Would it be better if
key-description described M-TAB as ESC TAB or C-M-i if there is reason
to think M-TAB won't work? Would it be good to have an
alternative key for M-TAB? Is C-RET OK for that, or should that be
used by rectangle commands?

At least I think nxml-mode shouldn't have its own solution, but behave
like other modes with a corresponding completion
command, however that should be.




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

* RE: Completion keys and rectangles
  2009-11-16 19:58 Completion keys and rectangles Per Starbäck
@ 2009-11-16 21:29 ` Drew Adams
  2009-11-16 21:32 ` Stefan Monnier
  2009-11-16 21:34 ` David De La Harpe Golden
  2 siblings, 0 replies; 6+ messages in thread
From: Drew Adams @ 2009-11-16 21:29 UTC (permalink / raw)
  To: 'Per Starbäck', emacs-devel

This doesn't respond directly to your question, but I wonder if other platforms,
in addition to MS Windows, couldn't have something similar to
`w32-register-hot-key'? I use that to let Emacs handle `M-tab' on Windows. For
years I just used `ESC-TAB', until I (somehow) stumbled upon
`w32-register-hot-key'.





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

* Re: Completion keys and rectangles
  2009-11-16 19:58 Completion keys and rectangles Per Starbäck
  2009-11-16 21:29 ` Drew Adams
@ 2009-11-16 21:32 ` Stefan Monnier
  2009-11-17  4:32   ` Miles Bader
  2009-11-16 21:34 ` David De La Harpe Golden
  2 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2009-11-16 21:32 UTC (permalink / raw)
  To: Per Starbäck; +Cc: emacs-devel

> M-TAB is very often used by the window manager. "(emacs) Symbol
> Completion" therefore advices to use ESC TAB
> or C-M-i instead to avoid that when using a completion command in Emacs.

> nxml-mode avoids the problem by binding C-RET as well to
> nxml-complete, and only that when Emacs is used under
> a window system. (See nxml-bind-meta-tab-to-complete-flag.)

C-RET doesn't sound like a good choice to me, both because it's
counter-intuitive (I expect C-RET to "terminate" something like RET
terminates a line or terminates minibuffer input), and because it's not
available in xterms (which also can't use M-TAB).

I agree that Emacs should choose a binding for it.

Personally, I've been using TAB for that purpose.  It's convenient and
natural since TAB is already used for completion in many other contexts,
but it's also kind of tricky since TAB is also used for indentation.
I resolve this problem by first trying indentation and if indentation
did not do anything, then I try completion.  It works for me, but I'm
not that thrilled about it.


        Stefan




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

* Re: Completion keys and rectangles
  2009-11-16 19:58 Completion keys and rectangles Per Starbäck
  2009-11-16 21:29 ` Drew Adams
  2009-11-16 21:32 ` Stefan Monnier
@ 2009-11-16 21:34 ` David De La Harpe Golden
  2009-11-16 22:14   ` Per Starbäck
  2 siblings, 1 reply; 6+ messages in thread
From: David De La Harpe Golden @ 2009-11-16 21:34 UTC (permalink / raw)
  To: Per Starbäck; +Cc: emacs-devel

Per Starbäck wrote:
> M-TAB is very often used by the window manager. 

True, or at least M-<tab> is (what? See below),  but that's typically an 
easily reconfigured option in the window manager preferences (except on 
windows).   I move all common window manager meta+key operations to 
super+key anyway (which after all has a stylised window printed on it 
thanks to microsoft. Super isn't used by default emacs bindings as a 
matter of policy)

> What do you think is the best solution to the window mangers vs.
> completion in emacs problem? Would it be better if
> key-description described M-TAB as ESC TAB or C-M-i if there is reason
> to think M-TAB won't work?

M-TAB pretty much /is/ emacs saying M-C-i

A "real tab key only" binding  says "<tab>" instead of "TAB"

See manual Customization > Key Bindings > Named ASCII Chars
notes about TAB and C-i being the same thing.

I guess it may still not be obvious to modern users that therefore C-M-i 
is a direct alternative to M-TAB though.

try:
C-h c then C-i :
"TAB runs the command indent-for-tab-command"

C-h c then tab key :
"TAB (translated from <tab>) runs the command indent-for-tab-command"


> Would it be good to have an  alternative key for M-TAB? 

I tend to view C-M-i (M- C-i) /as/ the memorable alternative to M-TAB.

Showing my age I guess, but this was once something "everyone knew" in 
computing:

ASCII TAB = 9.   9 + 64 = 73. 73 = ASCII I
ASCII BS  = 8.   8 + 64 = 72. 72 = ASCII H
ASCII ESC = 27. 27 + 64 = 91. 91 = ASCII [

So, ^I for TAB, ^H for backspace, ^[ for escape etc.










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

* Re: Completion keys and rectangles
  2009-11-16 21:34 ` David De La Harpe Golden
@ 2009-11-16 22:14   ` Per Starbäck
  0 siblings, 0 replies; 6+ messages in thread
From: Per Starbäck @ 2009-11-16 22:14 UTC (permalink / raw)
  To: David De La Harpe Golden; +Cc: emacs-devel

2009/11/16 David De La Harpe Golden <david@harpegolden.net>:
> Per Starbäck wrote:
>>
>> M-TAB is very often used by the window manager.
>
> True, or at least M-<tab> is (what? See below),  but that's typically an
> easily reconfigured option in the window manager preferences (except on
> windows).

Yes, but most people don't change that. And certainly most new Emacs users
wouldn't want to change something they already are used to just to accomodate
to a "new" program they are trying out.

>> What do you think is the best solution to the window mangers vs.
>> completion in emacs problem? Would it be better if
>> key-description described M-TAB as ESC TAB or C-M-i if there is reason
>> to think M-TAB won't work?
>
> M-TAB pretty much /is/ emacs saying M-C-i

Yes, but how key-description describes it can change what keys users
actually press.
OK. I should have written "there is reason to think <M-tab> won't work".

>> Would it be good to have an  alternative key for M-TAB?
>
> I tend to view C-M-i (M- C-i) /as/ the memorable alternative to M-TAB.

It's not memorable for most new users. But maybe there is nothing
better left to use.
Then I think it would be good if key-description avoided description
that might lead
people to press combinations of keys that won't work at least. (Just
like it's good that

  backward-kill-sexp is on ESC <C-delete>, ESC <C-backspace>

doesn't mention <C-M-delete> or <C-M-backspace>...

> Showing my age I guess, but this was once something "everyone knew" in
> computing:
>
> ASCII TAB = 9.   9 + 64 = 73. 73 = ASCII I
> ASCII BS  = 8.   8 + 64 = 72. 72 = ASCII H
> ASCII ESC = 27. 27 + 64 = 91. 91 = ASCII [
>
> So, ^I for TAB, ^H for backspace, ^[ for escape etc.

Sure, but I don't like that to be prerequisite knowledge for using Emacs.




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

* Re: Completion keys and rectangles
  2009-11-16 21:32 ` Stefan Monnier
@ 2009-11-17  4:32   ` Miles Bader
  0 siblings, 0 replies; 6+ messages in thread
From: Miles Bader @ 2009-11-17  4:32 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Per Starbäck, emacs-devel

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:
> Personally, I've been using TAB for that purpose.  It's convenient and
> natural since TAB is already used for completion in many other contexts,
> but it's also kind of tricky since TAB is also used for indentation.
> I resolve this problem by first trying indentation and if indentation
> did not do anything, then I try completion.  It works for me, but I'm
> not that thrilled about it.

There are many modes where this would be a good "first line" binding,
but obviously (er, I think :) there should be a globally usable
secondary binding too...

How about just binding as many xx-TAB keys as we can... M-TAB, C-TAB,
C-M-TAB, Alt-TAB, ..... that way, there's probably _something_ which
will work in any given situation (even terminal users can use ESC TAB),
and the technique for discovering it is simple..... just keep trying
different modifiers until something does something :)

-Miles

-- 
Christian, n. One who follows the teachings of Christ so long as they are not
inconsistent with a life of sin.




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

end of thread, other threads:[~2009-11-17  4:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-16 19:58 Completion keys and rectangles Per Starbäck
2009-11-16 21:29 ` Drew Adams
2009-11-16 21:32 ` Stefan Monnier
2009-11-17  4:32   ` Miles Bader
2009-11-16 21:34 ` David De La Harpe Golden
2009-11-16 22:14   ` Per Starbäck

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