all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* M-[
@ 2003-04-04 22:57 greg jednaszewski
  2003-04-04 23:59 ` M-[ Barry Margolin
  0 siblings, 1 reply; 18+ messages in thread
From: greg jednaszewski @ 2003-04-04 22:57 UTC (permalink / raw)


Hi,

I use swbuff.el for cycling through buffers, and I'd like to be able to
bind M-[ to swbuff-switch-to-previous-buffer like so:

(global-set-key (kbd "M-[") 'swbuff-switch-to-previous-buffer)

However, I can't seem to be able to bind anything to simply M-[.  When I
do describe-key on M-[, it expects another keypress, in the same way
that C-x expects another keypress.

What is the reasoning behind this, and is there any way around it?

Thanks,
Greg

-- 
Greg Jednaszewski
greg@attenuated.org

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

* Re: M-[
  2003-04-04 22:57 M-[ greg jednaszewski
@ 2003-04-04 23:59 ` Barry Margolin
  2003-04-07 17:40   ` M-[ Peter Lee
  2003-04-07 18:14   ` M-[ Kevin Rodgers
  0 siblings, 2 replies; 18+ messages in thread
From: Barry Margolin @ 2003-04-04 23:59 UTC (permalink / raw)


In article <b6l2k3$t5l$1@news-int.gatech.edu>,
greg jednaszewski  <greg@attenuated.org> wrote:
>I use swbuff.el for cycling through buffers, and I'd like to be able to
>bind M-[ to swbuff-switch-to-previous-buffer like so:
>
>(global-set-key (kbd "M-[") 'swbuff-switch-to-previous-buffer)
>
>However, I can't seem to be able to bind anything to simply M-[.  When I
>do describe-key on M-[, it expects another keypress, in the same way
>that C-x expects another keypress.
>
>What is the reasoning behind this, and is there any way around it?

On most ASCII terminals, special function keys (like arrow keys) send
sequences that begin with ESC [.

-- 
Barry Margolin, barry.margolin@level3.com
Genuity Managed Services, a Level(3) Company, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

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

* Re: M-[
  2003-04-04 23:59 ` M-[ Barry Margolin
@ 2003-04-07 17:40   ` Peter Lee
  2003-04-07 18:14   ` M-[ Kevin Rodgers
  1 sibling, 0 replies; 18+ messages in thread
From: Peter Lee @ 2003-04-07 17:40 UTC (permalink / raw)


Barry Margolin <barry.margolin@level3.com> writes:

> In article <b6l2k3$t5l$1@news-int.gatech.edu>,
> greg jednaszewski  <greg@attenuated.org> wrote:
> >I use swbuff.el for cycling through buffers, and I'd like to be able to
> >bind M-[ to swbuff-switch-to-previous-buffer like so:
> >
> >(global-set-key (kbd "M-[") 'swbuff-switch-to-previous-buffer)
> >
> >However, I can't seem to be able to bind anything to simply M-[.  When I
> >do describe-key on M-[, it expects another keypress, in the same way
> >that C-x expects another keypress.
> >
> >What is the reasoning behind this, and is there any way around it?
> 
> On most ASCII terminals, special function keys (like arrow keys) send
> sequences that begin with ESC [.

I have the following in my .emacs:

(global-set-key "\M-[" 'curly-brace-region)

It's always worked fine for me.  Perhaps it is an OS issue.  I'm on
XP.

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

* Re: M-[
  2003-04-04 23:59 ` M-[ Barry Margolin
  2003-04-07 17:40   ` M-[ Peter Lee
@ 2003-04-07 18:14   ` Kevin Rodgers
  1 sibling, 0 replies; 18+ messages in thread
From: Kevin Rodgers @ 2003-04-07 18:14 UTC (permalink / raw)


Barry Margolin wrote:

> On most ASCII terminals, special function keys (like arrow keys) send
> sequences that begin with ESC [.

The point being, those sequences are bound in function-key-map, which I
think of as an inverted keymap.  If the OP insists on using M-[, he
would have to run Emacs under a window system, or disable
function-key-map somehow.

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

* M-=
@ 2012-07-24  7:57 Ulrich Mueller
  2012-07-24  9:37 ` M-= Tassilo Horn
  2012-07-27  4:05 ` M-= Chong Yidong
  0 siblings, 2 replies; 18+ messages in thread
From: Ulrich Mueller @ 2012-07-24  7:57 UTC (permalink / raw)
  To: emacs-devel

I've noticed that M-= is no longer operating on the region but on the
whole buffer (i.e. it is bound to count-words instead of
count-words-region).

The old behaviour was established for decades and I found it much more
useful. Can we please have it back?

Ulrich



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

* Re: M-=
@ 2012-07-24  9:03 Dmitry Gutov
  2012-07-24  9:24 ` M-= Ulrich Mueller
  0 siblings, 1 reply; 18+ messages in thread
From: Dmitry Gutov @ 2012-07-24  9:03 UTC (permalink / raw)
  To: ulm; +Cc: emacs-devel

Ulrich Mueller <ulm@gentoo.org> writes:

 > I've noticed that M-= is no longer operating on the region but on the
 > whole buffer (i.e. it is bound to count-words instead of
 > count-words-region).

Are you sure `count-words' doesn't do what you want? If the region is
active, it uses the region, otherwise, the whole buffer.

--Dmitry



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

* Re: M-=
  2012-07-24  9:03 M-= Dmitry Gutov
@ 2012-07-24  9:24 ` Ulrich Mueller
  0 siblings, 0 replies; 18+ messages in thread
From: Ulrich Mueller @ 2012-07-24  9:24 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

>>>>> On Tue, 24 Jul 2012, Dmitry Gutov wrote:

>> I've noticed that M-= is no longer operating on the region but on
>> the whole buffer (i.e. it is bound to count-words instead of
>> count-words-region).

> Are you sure `count-words' doesn't do what you want? If the region
> is active, it uses the region, otherwise, the whole buffer.

M-= used to operate on the region, regardless if the region is active
or not. Now it can only be used in that way if transient-mark-mode is
(permanently or temporarily) enabled.

Ulrich



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

* Re: M-=
  2012-07-24  7:57 M-= Ulrich Mueller
@ 2012-07-24  9:37 ` Tassilo Horn
  2012-07-24 10:13   ` M-= Ulrich Mueller
  2012-07-27  4:05 ` M-= Chong Yidong
  1 sibling, 1 reply; 18+ messages in thread
From: Tassilo Horn @ 2012-07-24  9:37 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: emacs-devel

Ulrich Mueller <ulm@gentoo.org> writes:

> I've noticed that M-= is no longer operating on the region but on the
> whole buffer (i.e. it is bound to count-words instead of
> count-words-region).
>
> The old behaviour was established for decades and I found it much more
> useful. Can we please have it back?

It still acts on active regions.  Do you have transient-mark-mode
disabled explicitly?

Bye,
Tassilo



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

* Re: M-=
  2012-07-24  9:37 ` M-= Tassilo Horn
@ 2012-07-24 10:13   ` Ulrich Mueller
  2012-07-24 10:28     ` M-= Tassilo Horn
  0 siblings, 1 reply; 18+ messages in thread
From: Ulrich Mueller @ 2012-07-24 10:13 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: emacs-devel

>>>>> On Tue, 24 Jul 2012, Tassilo Horn wrote:

>> I've noticed that M-= is no longer operating on the region but on
>> the whole buffer (i.e. it is bound to count-words instead of
>> count-words-region).
>> 
>> The old behaviour was established for decades and I found it much
>> more useful. Can we please have it back?

> It still acts on active regions.  Do you have transient-mark-mode
> disabled explicitly?

I do. Is this no longer a supported configuration?

Ulrich



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

* Re: M-=
  2012-07-24 10:13   ` M-= Ulrich Mueller
@ 2012-07-24 10:28     ` Tassilo Horn
  0 siblings, 0 replies; 18+ messages in thread
From: Tassilo Horn @ 2012-07-24 10:28 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: emacs-devel

Ulrich Mueller <ulm@gentoo.org> writes:

>>> I've noticed that M-= is no longer operating on the region but on
>>> the whole buffer (i.e. it is bound to count-words instead of
>>> count-words-region).
>>> 
>>> The old behaviour was established for decades and I found it much
>>> more useful. Can we please have it back?
>
>> It still acts on active regions.  Do you have transient-mark-mode
>> disabled explicitly?
>
> I do. Is this no longer a supported configuration?

I wouldn't go that far, but there are some commands that act differently
depending on the "activeness" of a region.  Other examples are `undo'
and `ispell' which undo/spell-check selectively in active regions
defaulting to the complete buffer if there's none.

Bye,
Tassilo



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

* Re: M-=
  2012-07-24  7:57 M-= Ulrich Mueller
  2012-07-24  9:37 ` M-= Tassilo Horn
@ 2012-07-27  4:05 ` Chong Yidong
  2012-07-27 10:59   ` M-= Ulrich Mueller
  2012-07-27 17:30   ` M-= James Cloos
  1 sibling, 2 replies; 18+ messages in thread
From: Chong Yidong @ 2012-07-27  4:05 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: emacs-devel

Ulrich Mueller <ulm@gentoo.org> writes:

> I've noticed that M-= is no longer operating on the region but on the
> whole buffer (i.e. it is bound to count-words instead of
> count-words-region).
>
> The old behaviour was established for decades and I found it much more
> useful. Can we please have it back?

I made the change because it seemed like a fairly straightforward
improvement, but if the old behavior is generally preferred or the
change is found to be too disruptive, we can certainly revert it.

The rule of thumb is that when transient mark mode is enabled, commands
that are bound to convenient keys ought to act on the region if it is
active, and some other convenient unit of text otherwise.  Examples of
this behavior are M-; and M-$.  There are exceptions: C-w and M-w always
act on the region, because yanking the whole buffer is a relatively rare
operation, and has annoying results if you accidentally trigger it.

Counting words seems like it should fall in the former category
(together with M-; and M-$) rather than the latter (with C-w and M-w).
But maybe you can explain otherwise?

Another possibility is to keep M-= for count-words-region and assign
another convenient key to count-words.  The obvious candidate is C-=,
but unfortunately it is not typable on text terminals.



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

* Re: M-=
  2012-07-27  4:05 ` M-= Chong Yidong
@ 2012-07-27 10:59   ` Ulrich Mueller
  2012-07-27 14:57     ` M-= Tassilo Horn
  2012-07-29  3:33     ` M-= Chong Yidong
  2012-07-27 17:30   ` M-= James Cloos
  1 sibling, 2 replies; 18+ messages in thread
From: Ulrich Mueller @ 2012-07-27 10:59 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

>>>>> On Fri, 27 Jul 2012, Chong Yidong wrote:

> Ulrich Mueller <ulm@gentoo.org> writes:
>> I've noticed that M-= is no longer operating on the region but on the
>> whole buffer (i.e. it is bound to count-words instead of
>> count-words-region).
>> 
>> The old behaviour was established for decades and I found it much more
>> useful. Can we please have it back?

> I made the change because it seemed like a fairly straightforward
> improvement, but if the old behavior is generally preferred or the
> change is found to be too disruptive, we can certainly revert it.

> The rule of thumb is that when transient mark mode is enabled, commands
> that are bound to convenient keys ought to act on the region if it is
> active, and some other convenient unit of text otherwise.  Examples of
> this behavior are M-; and M-$.  There are exceptions: C-w and M-w always
> act on the region, because yanking the whole buffer is a relatively rare
> operation, and has annoying results if you accidentally trigger it.

C-x C-u is another example that unconditionally acts on the region.
(Please don't change this!)

> Counting words seems like it should fall in the former category
> (together with M-; and M-$) rather than the latter (with C-w and M-w).
> But maybe you can explain otherwise?

I certainly use M-= on the region much more often than on the whole
buffer. With transient-mark-mode switched off, I now find it rather
painful. Especially combinations like M-h M-= (i.e., mark-paragraph
followed by count-words-region) no longer work.

Also M-= was bound to count-lines-region (or later count-words-region)
since Emacs 18 at least. OTOH, during all that time there wasn't any
key that did this operation for the whole buffer. From that I conclude
that it wasn't missed, otherwise a key binding would have been added.

> Another possibility is to keep M-= for count-words-region and assign
> another convenient key to count-words.  The obvious candidate is C-=,
> but unfortunately it is not typable on text terminals.

I wouldn't mind that. But how about M-+ ?

Ulrich



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

* Re: M-=
  2012-07-27 10:59   ` M-= Ulrich Mueller
@ 2012-07-27 14:57     ` Tassilo Horn
  2012-07-27 16:24       ` M-= Ulrich Mueller
  2012-07-29  3:33     ` M-= Chong Yidong
  1 sibling, 1 reply; 18+ messages in thread
From: Tassilo Horn @ 2012-07-27 14:57 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: Chong Yidong, emacs-devel

Ulrich Mueller <ulm@gentoo.org> writes:

> I certainly use M-= on the region much more often than on the whole
> buffer. With transient-mark-mode switched off, I now find it rather
> painful. Especially combinations like M-h M-= (i.e., mark-paragraph
> followed by count-words-region) no longer work.

You could do C-SPC C-SPC M-h M-= to enable ttm just for that command.

In general, I really like that some commands act differently (very
conveniently IMHO) in transient-mark-mode.  So I'd rather prefer not to
change good keys to less capable commands.

Just my 2 cents,
Tassilo



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

* Re: M-=
  2012-07-27 14:57     ` M-= Tassilo Horn
@ 2012-07-27 16:24       ` Ulrich Mueller
  2012-07-27 17:32         ` M-= Tassilo Horn
  0 siblings, 1 reply; 18+ messages in thread
From: Ulrich Mueller @ 2012-07-27 16:24 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: Chong Yidong, emacs-devel

>>>>> On Fri, 27 Jul 2012, Tassilo Horn wrote:

>> I certainly use M-= on the region much more often than on the whole
>> buffer. With transient-mark-mode switched off, I now find it rather
>> painful. Especially combinations like M-h M-= (i.e., mark-paragraph
>> followed by count-words-region) no longer work.

> You could do C-SPC C-SPC M-h M-= to enable ttm just for that command.

That doesn't work: M-h marks the whole paragraph, whereas C-SPC C-SPC
M-h only marks from point to end of paragraph.

Ulrich



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

* Re: M-=
  2012-07-27  4:05 ` M-= Chong Yidong
  2012-07-27 10:59   ` M-= Ulrich Mueller
@ 2012-07-27 17:30   ` James Cloos
  2012-07-27 19:02     ` M-= Andreas Röhler
  1 sibling, 1 reply; 18+ messages in thread
From: James Cloos @ 2012-07-27 17:30 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Ulrich Mueller, emacs-devel

>>>>> "CY" == Chong Yidong <cyd@gnu.org> writes:

CY> Counting words seems like it should fall in the former category
CY> (together with M-; and M-$) rather than the latter (with C-w and M-w).
CY> But maybe you can explain otherwise?

Can we compromize?  A new function which acts like the old M-= when
transient-mark-mode is nil and like the new if t-m-m is t or lambda?

Perhaps by way of a generalized function which embodies that test, in
case there are other key commands which similarly could be improved.

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6



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

* Re: M-=
  2012-07-27 16:24       ` M-= Ulrich Mueller
@ 2012-07-27 17:32         ` Tassilo Horn
  0 siblings, 0 replies; 18+ messages in thread
From: Tassilo Horn @ 2012-07-27 17:32 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: Chong Yidong, emacs-devel

Ulrich Mueller <ulm@gentoo.org> writes:

>>> I certainly use M-= on the region much more often than on the whole
>>> buffer. With transient-mark-mode switched off, I now find it rather
>>> painful. Especially combinations like M-h M-= (i.e., mark-paragraph
>>> followed by count-words-region) no longer work.
>
>> You could do C-SPC C-SPC M-h M-= to enable ttm just for that command.
>
> That doesn't work: M-h marks the whole paragraph, whereas C-SPC C-SPC
> M-h only marks from point to end of paragraph.

Indeed, I tested that while point was at the beginning of a paragraph,
so that didn't make a difference.  But this works:

  M-h C-u C-x C-x M-=

Ok, probably not /that/ convenient, but how often do you check the
wordcount of a paragraph?

Bye,
Tassilo



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

* Re: M-=
  2012-07-27 17:30   ` M-= James Cloos
@ 2012-07-27 19:02     ` Andreas Röhler
  0 siblings, 0 replies; 18+ messages in thread
From: Andreas Röhler @ 2012-07-27 19:02 UTC (permalink / raw)
  To: emacs-devel

Am 27.07.2012 19:30, schrieb James Cloos:
>>>>>> "CY" == Chong Yidong <cyd@gnu.org> writes:
>
> CY> Counting words seems like it should fall in the former category
> CY> (together with M-; and M-$) rather than the latter (with C-w and M-w).
> CY> But maybe you can explain otherwise?
>
> Can we compromize?  A new function which acts like the old M-= when
> transient-mark-mode is nil and like the new if t-m-m is t or lambda?
>
> Perhaps by way of a generalized function which embodies that test, in
> case there are other key commands which similarly could be improved.
>
> -JimC
>

what about making that customizable - active-region-requires-t-m-m

Cheers,

Andreas




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

* Re: M-=
  2012-07-27 10:59   ` M-= Ulrich Mueller
  2012-07-27 14:57     ` M-= Tassilo Horn
@ 2012-07-29  3:33     ` Chong Yidong
  1 sibling, 0 replies; 18+ messages in thread
From: Chong Yidong @ 2012-07-29  3:33 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: emacs-devel

Ulrich Mueller <ulm@gentoo.org> writes:

> C-x C-u is another example that unconditionally acts on the region.
> (Please don't change this!)

Yes, upcase-region obviously falls in the category of commands which
would give annoying results if accidentally triggered on the whole
buffer.  Counting words, on the other hand, doesn't.

> Also M-= was bound to count-lines-region (or later count-words-region)
> since Emacs 18 at least. OTOH, during all that time there wasn't any
> key that did this operation for the whole buffer. From that I conclude
> that it wasn't missed, otherwise a key binding would have been added.

If I'm not mistaken, counting words in the buffer was one of the more
commonly-requested commands on gnu.emacs.help.

But your argument that the change might be disruptive, because of how
long M-= has been around, is a fair one.

>> Another possibility is to keep M-= for count-words-region and assign
>> another convenient key to count-words.  The obvious candidate is C-=,
>> but unfortunately it is not typable on text terminals.
>
> I wouldn't mind that. But how about M-+ ?

How about making C-u M-= (count-words-region with a prefix argument)
call count-words on the whole buffer?

This is a bit messy; as I said, it breaks consistency with the way other
commands handle active regions.  But I guess it is better to not switch
things around on users, if there are indeed people who frequently use
M-=.



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

end of thread, other threads:[~2012-07-29  3:33 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-24  7:57 M-= Ulrich Mueller
2012-07-24  9:37 ` M-= Tassilo Horn
2012-07-24 10:13   ` M-= Ulrich Mueller
2012-07-24 10:28     ` M-= Tassilo Horn
2012-07-27  4:05 ` M-= Chong Yidong
2012-07-27 10:59   ` M-= Ulrich Mueller
2012-07-27 14:57     ` M-= Tassilo Horn
2012-07-27 16:24       ` M-= Ulrich Mueller
2012-07-27 17:32         ` M-= Tassilo Horn
2012-07-29  3:33     ` M-= Chong Yidong
2012-07-27 17:30   ` M-= James Cloos
2012-07-27 19:02     ` M-= Andreas Röhler
  -- strict thread matches above, loose matches on Subject: below --
2012-07-24  9:03 M-= Dmitry Gutov
2012-07-24  9:24 ` M-= Ulrich Mueller
2003-04-04 22:57 M-[ greg jednaszewski
2003-04-04 23:59 ` M-[ Barry Margolin
2003-04-07 17:40   ` M-[ Peter Lee
2003-04-07 18:14   ` M-[ Kevin Rodgers

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.