unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* OS X Lion and "ApplePressAndHoldEnabled"
@ 2011-06-15 20:58 Tim Harper
  2011-06-18 16:29 ` Chong Yidong
  2011-06-20 18:06 ` Stefan Monnier
  0 siblings, 2 replies; 12+ messages in thread
From: Tim Harper @ 2011-06-15 20:58 UTC (permalink / raw)
  To: emacs-devel

In the latest version of OS X Apple has introduced "Press and Hold".  In Emacs, it's on by default.  This translates to in Emacs, any alphanumeric key, when held down not in combination of any key modifiers, only one key press is emitted, in contrast with the previous behavior where the key is repeated as fast as your system repeat rate is set.

This is especially troublesome for key bindings that use the home-row keys for navigation, such as viper mode.  No longer can you hold down "J" to go down several lines…

Fortunately, there is a workaround, shown to me by hober of #emacs.  If this is added at the top of your emacs config file (such that it is executed before the frame is fully initialized):

(ns-set-resource nil "ApplePressAndHoldEnabled" "NO")

… then the previous behavior is restored, making viper users and the like happy once again.

I recommend that this should be set by default.

Thanks,

Tim


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

* RE: OS X Lion and "ApplePressAndHoldEnabled"
@ 2011-06-17 21:01 Donald Ephraim Curtis
  2011-06-17 21:29 ` Edward O'Connor
  2011-06-17 21:36 ` Tim Harper
  0 siblings, 2 replies; 12+ messages in thread
From: Donald Ephraim Curtis @ 2011-06-17 21:01 UTC (permalink / raw)
  To: timcharper; +Cc: Emacs-Devel devel

Does this happen when you are holding a modifier also?

This sounds like it should be a modifier for viper-mode but not necessarily for normal Emacs bindings which require a modifier.


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

* Re: OS X Lion and "ApplePressAndHoldEnabled"
  2011-06-17 21:01 Donald Ephraim Curtis
@ 2011-06-17 21:29 ` Edward O'Connor
  2011-06-17 21:36 ` Tim Harper
  1 sibling, 0 replies; 12+ messages in thread
From: Edward O'Connor @ 2011-06-17 21:29 UTC (permalink / raw)
  To: Donald Ephraim Curtis; +Cc: timcharper, Emacs-Devel devel

> This sounds like it should be a modifier for viper-mode but not necessarily for normal Emacs bindings which require a modifier.

There are many other modes that need this too (Gnus, for one).


Ted



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

* Re: OS X Lion and "ApplePressAndHoldEnabled"
  2011-06-17 21:01 Donald Ephraim Curtis
  2011-06-17 21:29 ` Edward O'Connor
@ 2011-06-17 21:36 ` Tim Harper
  1 sibling, 0 replies; 12+ messages in thread
From: Tim Harper @ 2011-06-17 21:36 UTC (permalink / raw)
  To: Donald Ephraim Curtis; +Cc: Emacs-Devel devel


On Jun 17, 2011, at 15:01 , Donald Ephraim Curtis wrote:

> Does this happen when you are holding a modifier also?
> 
> This sounds like it should be a modifier for viper-mode but not necessarily for normal Emacs bindings which require a modifier.

No, it doesn't happen when holding a modifier.

It seems there is little to no value to have the value remain YES.  Vowels (aeiou and sometimes y) all repeat, but constants (except y) do not.  No menu is presented to choose vowel accent or anything.

Tim


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

* Re: OS X Lion and "ApplePressAndHoldEnabled"
  2011-06-15 20:58 OS X Lion and "ApplePressAndHoldEnabled" Tim Harper
@ 2011-06-18 16:29 ` Chong Yidong
  2011-06-18 18:54   ` Tim Harper
  2011-06-20 18:06 ` Stefan Monnier
  1 sibling, 1 reply; 12+ messages in thread
From: Chong Yidong @ 2011-06-18 16:29 UTC (permalink / raw)
  To: Tim Harper; +Cc: emacs-devel

Tim Harper <timcharper@gmail.com> writes:

> In the latest version of OS X Apple has introduced "Press and Hold".
> In Emacs, it's on by default.  This translates to in Emacs, any
> alphanumeric key, when held down not in combination of any key
> modifiers, only one key press is emitted, in contrast with the
> previous behavior where the key is repeated as fast as your system
> repeat rate is set.

Is this documented anywhere?  I find it difficult to imagine that they
will impose such an incompatible default on all programs.



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

* Re: OS X Lion and "ApplePressAndHoldEnabled"
  2011-06-18 16:29 ` Chong Yidong
@ 2011-06-18 18:54   ` Tim Harper
  2011-06-20 16:22     ` Tim Harper
  0 siblings, 1 reply; 12+ messages in thread
From: Tim Harper @ 2011-06-18 18:54 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel


On Jun 18, 2011, at 10:29 , Chong Yidong wrote:

> Tim Harper <timcharper@gmail.com> writes:
> 
>> In the latest version of OS X Apple has introduced "Press and Hold".
>> In Emacs, it's on by default.  This translates to in Emacs, any
>> alphanumeric key, when held down not in combination of any key
>> modifiers, only one key press is emitted, in contrast with the
>> previous behavior where the key is repeated as fast as your system
>> repeat rate is set.
> 
> Is this documented anywhere?  I find it difficult to imagine that they
> will impose such an incompatible default on all programs.


I can't find any documentation around the setting, any where. I received the tip from a kind gentlemen on IRC (who then invited me to champion the change myself, because for employer related reasons he's unable to). 

I do know that press and hold is a new feature of OS X Lion.  If I hold the letter i, for example, I get a popup prompting to insert one of the following: "î ï í ī į ì" .

Terminal.app / MacVim.app don't inherit the new default (maybe the MacVim developers knew it was coming? I don't know).  I guess the apple developers figured you don't really need to hold down a letter and have it repeat a whole ton of times, which probably in 99% of use cases, they're right.

Tim


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

* Re: OS X Lion and "ApplePressAndHoldEnabled"
  2011-06-18 18:54   ` Tim Harper
@ 2011-06-20 16:22     ` Tim Harper
  0 siblings, 0 replies; 12+ messages in thread
From: Tim Harper @ 2011-06-20 16:22 UTC (permalink / raw)
  To: Tim Harper; +Cc: Chong Yidong, emacs-devel

> I can't find any documentation around the setting, any where. I received the tip from a kind gentlemen on IRC (who then invited me to champion the change myself, because for employer related reasons he's unable to). 
> 
> I do know that press and hold is a new feature of OS X Lion.  If I hold the letter i, for example, I get a popup prompting to insert one of the following: "î ï í ī į ì" .
> 
> Terminal.app / MacVim.app don't inherit the new default (maybe the MacVim developers knew it was coming? I don't know).  I guess the apple developers figured you don't really need to hold down a letter and have it repeat a whole ton of times, which probably in 99% of use cases, they're right.
> 
> Tim

I've added the work-around to the wiki.  I suppose it can saturate there until the community decides to include it.  I speculate there will be a whole wave of Emacs users asking this question once OS X Lion is released.

http://www.emacswiki.org/emacs/MacOSTweaks#toc7

Tim


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

* Re: OS X Lion and "ApplePressAndHoldEnabled"
  2011-06-15 20:58 OS X Lion and "ApplePressAndHoldEnabled" Tim Harper
  2011-06-18 16:29 ` Chong Yidong
@ 2011-06-20 18:06 ` Stefan Monnier
  2011-06-20 18:26   ` Tim Harper
  1 sibling, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2011-06-20 18:06 UTC (permalink / raw)
  To: Tim Harper; +Cc: emacs-devel

> In the latest version of OS X Apple has introduced "Press and Hold".
> In Emacs, it's on by default.  This translates to in Emacs, any alphanumeric
> key, when held down not in combination of any key modifiers, only one key
> press is emitted, in contrast with the previous behavior where the key is
> repeated as fast as your system repeat rate is set.

IIUC this is because "press and hold" is then interpreted as "choose
among various chars" instead of "auto-repeat".  This feature makes sense
when the key is bound to self-insert-command (whether you like it or
not is another issue, but at least I don't see a reason why Emacs
should necessarily disable it rather than obey the user's system-wide
preference for it), but it clearly makes no sense when the key is bound
to some unrelated command.

Not sure how/if Emacs can enable/disable it selectively depending on the
current binding of the key.

> Fortunately, there is a workaround, shown to me by hober of #emacs.  If this
> is added at the top of your emacs config file (such that it is executed
> before the frame is fully initialized):

> (ns-set-resource nil "ApplePressAndHoldEnabled" "NO")

Maybe we should include it in lisp/term/mac-win.el for now?


        Stefan



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

* Re: OS X Lion and "ApplePressAndHoldEnabled"
  2011-06-20 18:06 ` Stefan Monnier
@ 2011-06-20 18:26   ` Tim Harper
  2011-06-20 18:33     ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Tim Harper @ 2011-06-20 18:26 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1888 bytes --]

On Mon, Jun 20, 2011 at 12:06 PM, Stefan Monnier
<monnier@iro.umontreal.ca>wrote:

> > In the latest version of OS X Apple has introduced "Press and Hold".
> > In Emacs, it's on by default.  This translates to in Emacs, any
> alphanumeric
> > key, when held down not in combination of any key modifiers, only one key
> > press is emitted, in contrast with the previous behavior where the key is
> > repeated as fast as your system repeat rate is set.
>
> IIUC this is because "press and hold" is then interpreted as "choose
> among various chars" instead of "auto-repeat".  This feature makes sense
> when the key is bound to self-insert-command (whether you like it or
> not is another issue, but at least I don't see a reason why Emacs
> should necessarily disable it rather than obey the user's system-wide
> preference for it), but it clearly makes no sense when the key is bound
> to some unrelated command.
>

If it did something useful, I'd agree with you.  However, in it's current
state, even bound to self-insert-command, it appears to do nothing useful
and everything harmful.  AEIOUY are repeated according to system repeat
rate, all other alphanumeric keys are not repeated (although, when pressing
a keyboard modifier, even shift, all press-and-hold incur repeated
keystrokes).

Not sure how/if Emacs can enable/disable it selectively depending on the
> current binding of the key.
>

I'm not sure either... unfortunately this is not a setting that can be
changed after Emacs has started.

>
> > Fortunately, there is a workaround, shown to me by hober of #emacs.  If
> this
> > is added at the top of your emacs config file (such that it is executed
> > before the frame is fully initialized):
>
> > (ns-set-resource nil "ApplePressAndHoldEnabled" "NO")
>
> Maybe we should include it in lisp/term/mac-win.el for now?
>

That sounds good... but do you mean ns-win.el?

Tim

[-- Attachment #2: Type: text/html, Size: 2702 bytes --]

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

* Re: OS X Lion and "ApplePressAndHoldEnabled"
  2011-06-20 18:26   ` Tim Harper
@ 2011-06-20 18:33     ` Stefan Monnier
  2011-06-20 18:35       ` [PATCH] Default to disable PressAndHold in Mac OS X Lion Tim Harper
  2011-06-21 18:50       ` OS X Lion and "ApplePressAndHoldEnabled" David Reitter
  0 siblings, 2 replies; 12+ messages in thread
From: Stefan Monnier @ 2011-06-20 18:33 UTC (permalink / raw)
  To: Tim Harper; +Cc: emacs-devel

>> Maybe we should include it in lisp/term/mac-win.el for now?
> That sounds good... but do you mean ns-win.el?

Oh yes, of course, sorry.
Can some MacOSX guy install this change?


        Stefan



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

* [PATCH] Default to disable PressAndHold in Mac OS X Lion
  2011-06-20 18:33     ` Stefan Monnier
@ 2011-06-20 18:35       ` Tim Harper
  2011-06-21 18:50       ` OS X Lion and "ApplePressAndHoldEnabled" David Reitter
  1 sibling, 0 replies; 12+ messages in thread
From: Tim Harper @ 2011-06-20 18:35 UTC (permalink / raw)
  To: emacs-devel, Stefan Monnier; +Cc: Tim Harper

---
 lisp/term/ns-win.el |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 712929e..a54c849 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -916,6 +916,11 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
   ;; FIXME: This will surely lead to "MODIFIED OUTSIDE CUSTOM" warnings.
   (menu-bar-mode (if (get-lisp-resource nil "Menus") 1 -1))
 
+  ;; OS X Lion introduces PressAndHold and it is currently broken. See this
+  ;; thread for more details:
+  ;; http://lists.gnu.org/archive/html/emacs-devel/2011-06/msg00505.html
+  (ns-set-resource nil "ApplePressAndHoldEnabled" "NO")
+
   (setq ns-initialized t))
 
 (add-to-list 'handle-args-function-alist '(ns . x-handle-args))
-- 
1.7.4.4




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

* Re: OS X Lion and "ApplePressAndHoldEnabled"
  2011-06-20 18:33     ` Stefan Monnier
  2011-06-20 18:35       ` [PATCH] Default to disable PressAndHold in Mac OS X Lion Tim Harper
@ 2011-06-21 18:50       ` David Reitter
  1 sibling, 0 replies; 12+ messages in thread
From: David Reitter @ 2011-06-21 18:50 UTC (permalink / raw)
  To: Tim Harper, Stefan Monnier; +Cc: Emacs devel

On Jun 20, 2011, at 11:33 AM, Stefan Monnier wrote:
> 
> Can some MacOSX guy install this change?
> 

Done.
Thanks for the patch, Tim.  

Let's look into making it work properly once people decide to install Lion.



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

end of thread, other threads:[~2011-06-21 18:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-15 20:58 OS X Lion and "ApplePressAndHoldEnabled" Tim Harper
2011-06-18 16:29 ` Chong Yidong
2011-06-18 18:54   ` Tim Harper
2011-06-20 16:22     ` Tim Harper
2011-06-20 18:06 ` Stefan Monnier
2011-06-20 18:26   ` Tim Harper
2011-06-20 18:33     ` Stefan Monnier
2011-06-20 18:35       ` [PATCH] Default to disable PressAndHold in Mac OS X Lion Tim Harper
2011-06-21 18:50       ` OS X Lion and "ApplePressAndHoldEnabled" David Reitter
  -- strict thread matches above, loose matches on Subject: below --
2011-06-17 21:01 Donald Ephraim Curtis
2011-06-17 21:29 ` Edward O'Connor
2011-06-17 21:36 ` Tim Harper

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