unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Some problems with key bindings on windows
@ 2017-03-21 12:25 germano carella
  2017-03-22 15:56 ` Eli Zaretskii
  2017-03-23  8:01 ` martin rudalics
  0 siblings, 2 replies; 5+ messages in thread
From: germano carella @ 2017-03-21 12:25 UTC (permalink / raw)
  To: emacs-devel

Hi to all,

I’m Germano from Italy.

I’m writing a simple application in elisp, and I need to assign some key 
bindings, using left window key as key modifier.

I hope this is the correct place for my question. If not, can you point 
me in some direction?

I tried some solutions found on internet, but none seem to work.

I’ve emacs 25.1.1 on Windows 10 64 bit.

I do:

(setq w32-pass-lwindow-to-system nil)

(setq w32-lwindow-modifier ‘super)

Now, pressing left window key doesn’t open cortana. This is ok.

I tried to set, for example, win+j to a simple function that display a 
message.

(global-set-key (kbd “s-j”) ‘hello)

Doesn’t work. Win+j is not assigned on Windows, so it should work fine.

I tried “s-f9” and it works!

I read on internet someone used autohotkey but I don’t know how to use it.

Some suggestions?

An other question: can be capslock and insert key be used as modifier Keys?

Thanks!




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

* Re: Some problems with key bindings on windows
  2017-03-21 12:25 Some problems with key bindings on windows germano carella
@ 2017-03-22 15:56 ` Eli Zaretskii
  2017-03-23  8:01 ` martin rudalics
  1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2017-03-22 15:56 UTC (permalink / raw)
  To: germano carella; +Cc: emacs-devel

> From: germano carella <germano.carella@gmail.com>
> Date: Tue, 21 Mar 2017 13:25:53 +0100
> 
> I’ve emacs 25.1.1 on Windows 10 64 bit.
> 
> I do:
> 
> (setq w32-pass-lwindow-to-system nil)
> 
> (setq w32-lwindow-modifier ‘super)
> 
> Now, pressing left window key doesn’t open cortana. This is ok.
> 
> I tried to set, for example, win+j to a simple function that display a 
> message.
> 
> (global-set-key (kbd “s-j”) ‘hello)
> 
> Doesn’t work. Win+j is not assigned on Windows, so it should work fine.

It works for me on Windows 7, so it's probably specific to Windows
10.  I think you will have to use Emacs 26 (from the master branch of
the development code), where Emacs can hook the keyboard at a lower
level, and thus intercept key combinations that Windows doesn't
otherwise let us see.  I think you will need to use
w32-register-hot-key, as explained in the manual.

> An other question: can be capslock and insert key be used as modifier Keys?

You will see in the manual that setting w32-enable-caps-lock to nil
will let CapsLock produce the symbol 'capslock', which you can then
bind as any other function key.  As for <insert>, you can make the
keypad Insert key produce 'kp-insert', if you turn off Num Lock.

(Sorry for delay in answering.)



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

* Re: Some problems with key bindings on windows
  2017-03-21 12:25 Some problems with key bindings on windows germano carella
  2017-03-22 15:56 ` Eli Zaretskii
@ 2017-03-23  8:01 ` martin rudalics
  2017-03-23 15:26   ` Eli Zaretskii
  1 sibling, 1 reply; 5+ messages in thread
From: martin rudalics @ 2017-03-23  8:01 UTC (permalink / raw)
  To: germano carella, emacs-devel

 > I’m writing a simple application in elisp, and I need to assign some key bindings, using left window key as key modifier.
 >
 > I hope this is the correct place for my question. If not, can you point me in some direction?
 >
 > I tried some solutions found on internet, but none seem to work.
 >
 > I’ve emacs 25.1.1 on Windows 10 64 bit.

As Eli suggested you will have to try Emacs 26.  Apparently, some things
have changed with key bindings on Windows 8/10 and Emacs 25 doesn't cope
with them any more.

 > I read on internet someone used autohotkey but I don’t know how to use it.

Unfortunately, for me Emacs 26 breaks autohotkey support on Windows XP.

martin




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

* Re: Some problems with key bindings on windows
  2017-03-23  8:01 ` martin rudalics
@ 2017-03-23 15:26   ` Eli Zaretskii
  2017-03-24  9:02     ` martin rudalics
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2017-03-23 15:26 UTC (permalink / raw)
  To: martin rudalics; +Cc: germano.carella, emacs-devel

> Date: Thu, 23 Mar 2017 09:01:33 +0100
> From: martin rudalics <rudalics@gmx.at>
> 
>  > I read on internet someone used autohotkey but I don’t know how to use it.
> 
> Unfortunately, for me Emacs 26 breaks autohotkey support on Windows XP.

Perhaps we should have a command-line option to turn off hooking the
keyboard at low level.  We already have the code to do that when Emacs
is started under a debugger (because the keyboard hook affects the
debugger as well), so we just need to do the same under that new
option.



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

* Re: Some problems with key bindings on windows
  2017-03-23 15:26   ` Eli Zaretskii
@ 2017-03-24  9:02     ` martin rudalics
  0 siblings, 0 replies; 5+ messages in thread
From: martin rudalics @ 2017-03-24  9:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: germano.carella, emacs-devel

 >> Unfortunately, for me Emacs 26 breaks autohotkey support on Windows XP.
 >
 > Perhaps we should have a command-line option to turn off hooking the
 > keyboard at low level.  We already have the code to do that when Emacs
 > is started under a debugger (because the keyboard hook affects the
 > debugger as well),

... which BTW breaks debugging code that does use w32 keys, something
which always worked in the past and the reason why I have not yet closed
bug#23163 ...

 > so we just need to do the same under that new
 > option.

Hooking the keyboard is tricky.  And Windows seems to have changed
policy a number of times in this regard.

martin



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

end of thread, other threads:[~2017-03-24  9:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-21 12:25 Some problems with key bindings on windows germano carella
2017-03-22 15:56 ` Eli Zaretskii
2017-03-23  8:01 ` martin rudalics
2017-03-23 15:26   ` Eli Zaretskii
2017-03-24  9:02     ` martin rudalics

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