all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to change the keyboard mapping?
@ 2016-08-12 22:11 Sharon Kimble
  2016-08-13  0:02 ` John Mastro
  2016-08-13 14:16 ` B.V. Raghav
  0 siblings, 2 replies; 10+ messages in thread
From: Sharon Kimble @ 2016-08-12 22:11 UTC (permalink / raw
  To: help-emacs

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


How can I map my alpha-ENTER to be the same as my numerical-ENTER please?

I'm using a 'standard usb keyboard' (that's what it says on the
underside anyway) and I'm finding that when using emacs as normal I can
only accept entries on my dropdown word-prompt (I type in 3-4 letters
and it pops up a list of possible solutions) using the numerical-ENTER.
Also if it shows a possible one-word solution for auto-complete by the
grey letters to finish the word, I can only accept using the
numerical-ENTER key again.

Hence my need for changing the keyboard mapping, but how please?

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
Debian 8.4, fluxbox 1.3.7, emacs 25.1.1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

* Re: How to change the keyboard mapping?
  2016-08-12 22:11 How to change the keyboard mapping? Sharon Kimble
@ 2016-08-13  0:02 ` John Mastro
  2016-08-13  0:35   ` Sharon Kimble
  2016-08-13 14:16 ` B.V. Raghav
  1 sibling, 1 reply; 10+ messages in thread
From: John Mastro @ 2016-08-13  0:02 UTC (permalink / raw
  To: help-emacs; +Cc: Sharon Kimble

Sharon Kimble <boudiccas@skimble.plus.com> wrote:
> How can I map my alpha-ENTER to be the same as my numerical-ENTER please?
>
> I'm using a 'standard usb keyboard' (that's what it says on the
> underside anyway) and I'm finding that when using emacs as normal I can
> only accept entries on my dropdown word-prompt (I type in 3-4 letters
> and it pops up a list of possible solutions) using the numerical-ENTER.
> Also if it shows a possible one-word solution for auto-complete by the
> grey letters to finish the word, I can only accept using the
> numerical-ENTER key again.

What package are you using for completion (i.e. the thing offering
candidates via the dropdown)? I suspect the best solution will involve
adding something to that package's mode map rather than remapping the
key at a lower level in Emacs.

If it's auto-complete, try this:

(with-eval-after-load 'auto-complete
  (define-key ac-completing-map [return] #'ac-complete))

I don't have a keyboard with that key handy to test it, so I'm not sure
it will help. The reason for the suggestion is that I noticed that
auto-complete only binds `ac-complete' to "\r" (aka RET), whereas
company binds both that and [return]. [return] is normally translated to
RET, but it's possible for them to have different bindings.

Out of curiosity I tried something like the below (which was my first
thought for how to translate the "normal" enter key to the one on the
numeric keypad) but the result is not good.

(define-key key-translation-map (kbd "RET") [kp-enter])

        John



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

* Re: How to change the keyboard mapping?
  2016-08-13  0:02 ` John Mastro
@ 2016-08-13  0:35   ` Sharon Kimble
  2016-08-13  2:10     ` John Mastro
  0 siblings, 1 reply; 10+ messages in thread
From: Sharon Kimble @ 2016-08-13  0:35 UTC (permalink / raw
  To: John Mastro; +Cc: help-emacs

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

John Mastro <john.b.mastro@gmail.com> writes:

> Sharon Kimble <boudiccas@skimble.plus.com> wrote:
>> How can I map my alpha-ENTER to be the same as my numerical-ENTER please?
>>
>> I'm using a 'standard usb keyboard' (that's what it says on the
>> underside anyway) and I'm finding that when using emacs as normal I can
>> only accept entries on my dropdown word-prompt (I type in 3-4 letters
>> and it pops up a list of possible solutions) using the numerical-ENTER.
>> Also if it shows a possible one-word solution for auto-complete by the
>> grey letters to finish the word, I can only accept using the
>> numerical-ENTER key again.
>
> What package are you using for completion (i.e. the thing offering
> candidates via the dropdown)? I suspect the best solution will involve
> adding something to that package's mode map rather than remapping the
> key at a lower level in Emacs.
>
> If it's auto-complete, try this:
>
> (with-eval-after-load 'auto-complete
>   (define-key ac-completing-map [return] #'ac-complete))
>
> I don't have a keyboard with that key handy to test it, so I'm not sure
> it will help. The reason for the suggestion is that I noticed that
> auto-complete only binds `ac-complete' to "\r" (aka RET), whereas
> company binds both that and [return]. [return] is normally translated to
> RET, but it's possible for them to have different bindings.
>
> Out of curiosity I tried something like the below (which was my first
> thought for how to translate the "normal" enter key to the one on the
> numeric keypad) but the result is not good.
>
> (define-key key-translation-map (kbd "RET") [kp-enter])
>
Thanks John.

The programme is 'flyspell-popup'.

When I say 'alpha-ENTER' I mean the enter key immediately next to the
alphabetical section of the keyboard, and the 'numerical-ENTER' key is
immediately next to the numerical section of the keyboard.

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
Debian 8.4, fluxbox 1.3.7, emacs 25.1.1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

* Re: How to change the keyboard mapping?
  2016-08-13  0:35   ` Sharon Kimble
@ 2016-08-13  2:10     ` John Mastro
  2016-08-14 12:28       ` Robert Thorpe
  2016-08-15 12:59       ` Sharon Kimble
  0 siblings, 2 replies; 10+ messages in thread
From: John Mastro @ 2016-08-13  2:10 UTC (permalink / raw
  To: help-emacs; +Cc: Sharon Kimble

Sharon Kimble <boudiccas@skimble.plus.com> wrote:
> The programme is 'flyspell-popup'.

Ah, I hadn't heard of that package. I installed it but wasn't able to
reproduce the issue you describe - for me, enter always accepts the
selected candidate.

However, you may as well give this a try anyway:

(with-eval-after-load 'popup
  (define-key popup-menu-keymap [return] #'popup-select))

> When I say 'alpha-ENTER' I mean the enter key immediately next to the
> alphabetical section of the keyboard, and the 'numerical-ENTER' key is
> immediately next to the numerical section of the keyboard.

Right. When I used a keyboard like that, Emacs called that enter key
[kp-enter] (kp is presumably for keypad). You can check that by typing
C-h k followed by the key.

        John



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

* Re: How to change the keyboard mapping?
  2016-08-12 22:11 How to change the keyboard mapping? Sharon Kimble
  2016-08-13  0:02 ` John Mastro
@ 2016-08-13 14:16 ` B.V. Raghav
  2016-08-15 13:01   ` Sharon Kimble
  1 sibling, 1 reply; 10+ messages in thread
From: B.V. Raghav @ 2016-08-13 14:16 UTC (permalink / raw
  To: Sharon Kimble; +Cc: help-emacs

Hi,

> How can I map my alpha-ENTER to be the same as my numerical-ENTER please?

I checked for the keycode using xev in my terminal

The two enter keys produce this line in their respective output:

state 0x0, keycode 36 (keysym 0xff0d, Return), same_screen YES,
state 0x0, keycode 104 (keysym 0xff8d, KP_Enter), same_screen YES,

`C-h k <kp-enter>' provides the key binding in current mode. Then I run
`M-: (local-set-key (kbd "<kp-enter>") (lambda () (interactive) (message
"KP Enter pressed")))' and press <kp-enter>. It works.

So I think there are two ways I should proceed

1. Explicitly map <kp-enter> to the same command as <return> in the
   particular mode I am talking about.

2. Or, use Xmodmap to simulate a return globally. I should append into
   the .Xmodmap file, and invoke it in the .xinitrc

   keycode 104 = Return

   For more details on xmodmap, `M-x man RET xmodmap RET', and
   https://wiki.archlinux.org/index.php/xmodmap


There should be more elegant ways to do the job, but this is FWIW.

HTH
r

-- 
(B.V. Raghav)
Ph.D. Student,
Design Programme, IIT Kanpur

Ph: +91-9450988137
Email: bvraghav@gmail.com



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

* Re: How to change the keyboard mapping?
  2016-08-13  2:10     ` John Mastro
@ 2016-08-14 12:28       ` Robert Thorpe
  2016-08-15 12:59         ` Sharon Kimble
  2016-08-15 12:59       ` Sharon Kimble
  1 sibling, 1 reply; 10+ messages in thread
From: Robert Thorpe @ 2016-08-14 12:28 UTC (permalink / raw
  To: Sharon Kimble; +Cc: John Mastro, help-gnu-emacs

John Mastro <john.b.mastro@gmail.com> writes:

> Sharon Kimble <boudiccas@skimble.plus.com> wrote:
>> The programme is 'flyspell-popup'.
>
> Ah, I hadn't heard of that package. I installed it but wasn't able to
> reproduce the issue you describe - for me, enter always accepts the
> selected candidate.

What John says here is suspicious.

Sharon, have you tried using Emacs -Q and then loading that mode?  It
may be a part of your init that's disturbing flyspell-popup.

BR,
Robert Thorpe



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

* Re: How to change the keyboard mapping?
  2016-08-13  2:10     ` John Mastro
  2016-08-14 12:28       ` Robert Thorpe
@ 2016-08-15 12:59       ` Sharon Kimble
  2016-08-15 17:37         ` John Mastro
  1 sibling, 1 reply; 10+ messages in thread
From: Sharon Kimble @ 2016-08-15 12:59 UTC (permalink / raw
  To: John Mastro; +Cc: help-emacs

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

John Mastro <john.b.mastro@gmail.com> writes:

> Sharon Kimble <boudiccas@skimble.plus.com> wrote:
>> The programme is 'flyspell-popup'.
>
> Ah, I hadn't heard of that package. I installed it but wasn't able to
> reproduce the issue you describe - for me, enter always accepts the
> selected candidate.
>
> However, you may as well give this a try anyway:
>
> (with-eval-after-load 'popup
>   (define-key popup-menu-keymap [return] #'popup-select))
>
>> When I say 'alpha-ENTER' I mean the enter key immediately next to the
>> alphabetical section of the keyboard, and the 'numerical-ENTER' key is
>> immediately next to the numerical section of the keyboard.
>
> Right. When I used a keyboard like that, Emacs called that enter key
> [kp-enter] (kp is presumably for keypad). You can check that by typing
> C-h k followed by the key.
>
Thanks John, this works perfectly.

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
Debian 8.4, fluxbox 1.3.7, emacs 25.1.1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

* Re: How to change the keyboard mapping?
  2016-08-14 12:28       ` Robert Thorpe
@ 2016-08-15 12:59         ` Sharon Kimble
  0 siblings, 0 replies; 10+ messages in thread
From: Sharon Kimble @ 2016-08-15 12:59 UTC (permalink / raw
  To: Robert Thorpe; +Cc: John Mastro, help-gnu-emacs

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

Robert Thorpe <rt@robertthorpeconsulting.com> writes:

> John Mastro <john.b.mastro@gmail.com> writes:
>
>> Sharon Kimble <boudiccas@skimble.plus.com> wrote:
>>> The programme is 'flyspell-popup'.
>>
>> Ah, I hadn't heard of that package. I installed it but wasn't able to
>> reproduce the issue you describe - for me, enter always accepts the
>> selected candidate.
>
> What John says here is suspicious.
>
> Sharon, have you tried using Emacs -Q and then loading that mode?  It
> may be a part of your init that's disturbing flyspell-popup.
>
Thanks Robert, but its all now working perfectly.

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
Debian 8.4, fluxbox 1.3.7, emacs 25.1.1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

* Re: How to change the keyboard mapping?
  2016-08-13 14:16 ` B.V. Raghav
@ 2016-08-15 13:01   ` Sharon Kimble
  0 siblings, 0 replies; 10+ messages in thread
From: Sharon Kimble @ 2016-08-15 13:01 UTC (permalink / raw
  To: B.V. Raghav; +Cc: help-emacs

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

bvraghav@iitk.ac.in (B.V. Raghav) writes:

> Hi,
>
>> How can I map my alpha-ENTER to be the same as my numerical-ENTER please?
>
> I checked for the keycode using xev in my terminal
>
> The two enter keys produce this line in their respective output:
>
> state 0x0, keycode 36 (keysym 0xff0d, Return), same_screen YES,
> state 0x0, keycode 104 (keysym 0xff8d, KP_Enter), same_screen YES,
>
> `C-h k <kp-enter>' provides the key binding in current mode. Then I run
> `M-: (local-set-key (kbd "<kp-enter>") (lambda () (interactive) (message
> "KP Enter pressed")))' and press <kp-enter>. It works.
>
> So I think there are two ways I should proceed
>
> 1. Explicitly map <kp-enter> to the same command as <return> in the
>    particular mode I am talking about.
>
> 2. Or, use Xmodmap to simulate a return globally. I should append into
>    the .Xmodmap file, and invoke it in the .xinitrc
>
>    keycode 104 = Return
>
>    For more details on xmodmap, `M-x man RET xmodmap RET', and
>    https://wiki.archlinux.org/index.php/xmodmap
>
>
> There should be more elegant ways to do the job, but this is FWIW.
>

Thanks for this fulsome reply BV. Its now all working perfectly.

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
Debian 8.4, fluxbox 1.3.7, emacs 25.1.1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

* Re: How to change the keyboard mapping?
  2016-08-15 12:59       ` Sharon Kimble
@ 2016-08-15 17:37         ` John Mastro
  0 siblings, 0 replies; 10+ messages in thread
From: John Mastro @ 2016-08-15 17:37 UTC (permalink / raw
  To: help-emacs; +Cc: Sharon Kimble

Sharon Kimble <boudiccas@skimble.plus.com> wrote:
> John Mastro <john.b.mastro@gmail.com> writes:
>> (with-eval-after-load 'popup
>>   (define-key popup-menu-keymap [return] #'popup-select))
> Thanks John, this works perfectly.

Glad I could help.

Here's what I suspect happened: Normally, [return] is translated to "\r"
(RET), but on a GUI Emacs it's possible for them to have separate
bindings.

You (either in your own configuration or in a mode you use) likely have
a binding for [return], which causes it not to be translated to "\r".
The popup package only creates a binding for "\r", so your [return]
wasn't triggering it. On the other hand, [kp-enter] did not have its own
bindings, so it was translated to "\r" and thus worked.

        John



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

end of thread, other threads:[~2016-08-15 17:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-12 22:11 How to change the keyboard mapping? Sharon Kimble
2016-08-13  0:02 ` John Mastro
2016-08-13  0:35   ` Sharon Kimble
2016-08-13  2:10     ` John Mastro
2016-08-14 12:28       ` Robert Thorpe
2016-08-15 12:59         ` Sharon Kimble
2016-08-15 12:59       ` Sharon Kimble
2016-08-15 17:37         ` John Mastro
2016-08-13 14:16 ` B.V. Raghav
2016-08-15 13:01   ` Sharon Kimble

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.