unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* backtick as key
@ 2016-04-28  9:28 Andreas Röhler
  2016-04-28 15:05 ` Kaushal Modi
  2016-04-28 15:20 ` Yuri Khan
  0 siblings, 2 replies; 7+ messages in thread
From: Andreas Röhler @ 2016-04-28  9:28 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hi,

wrote a couple of commands which transform delimited forms.
For the curious:
https://github.com/andreas-roehler/werkstatt/blob/master/thing-at-point-utils/thingatpt-transform-delimited.el

For example at

`find .  -maxdepth 1 -type f -name "*.txt"`

M-x ar-backticked2braced-atpt RET

would yield

{find .  -maxdepth 1 -type f -name "*.txt"}

Now let's have some mnemonic keys.

(global-set-key [(control \))(control \})] 'ar-parentized2braced-atpt)

works great.

Unfortunately

(global-set-key [(control \`)(control \})] 'ar-backticked2braced-atpt)

sends error:

<C-dead-grave> is undefined
C-} is undefined

While when running the command via M-x, messages:

You can run the command ‘ar-backticked2braced-atpt’ with C-` C-}

Any suggestions?

Thanks,

Andreas




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

* Re: backtick as key
       [not found] <mailman.1240.1461835581.7477.help-gnu-emacs@gnu.org>
@ 2016-04-28 10:12 ` Marco Wahl
  0 siblings, 0 replies; 7+ messages in thread
From: Marco Wahl @ 2016-04-28 10:12 UTC (permalink / raw)
  To: help-gnu-emacs

Hi!

> (global-set-key [(control \`)(control \})] 'ar-backticked2braced-atpt)
>
> sends error:
>
> <C-dead-grave> is undefined
> C-} is undefined
>
> While when running the command via M-x, messages:
>
> You can run the command ‘ar-backticked2braced-atpt’ with C-` C-}
>
> Any suggestions?

Use a keymap!

(global-set-key [(control \`) ]
 (let ((map (make-sparse-keymap)))
   (define-key map [(control \})] #'ar-backticked2braced-atpt)
 map))


HTH,
-- 
Marco Wahl
GPG: 0x49010A040A3AE6F2


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

* Re: backtick as key
  2016-04-28  9:28 backtick as key Andreas Röhler
@ 2016-04-28 15:05 ` Kaushal Modi
  2016-04-28 15:18   ` Andreas Röhler
  2016-04-28 15:20 ` Yuri Khan
  1 sibling, 1 reply; 7+ messages in thread
From: Kaushal Modi @ 2016-04-28 15:05 UTC (permalink / raw)
  To: Andreas Röhler, Help Gnu Emacs mailing list

Are you running "emacs -nw", or emacs GUI?

I evaluated the below:

(global-set-key (kbd "C-` C-}") (lambda() (interactive) (message "Hi")))

and it works fine.

C-h c C-` C-} prints

C-` C-} runs the command (lambda nil (interactive) (message "Hi"))

and typing C-` C-} displays Hi in the echo area.

On the latest build of emacs from emacs-25, in terminal mode (emacs -Q
-nw), C-` seems to be detected as C-@ which is bound to set-mark-command by
default.

So probably we cannot use C-` in terminal mode?

On Thu, Apr 28, 2016 at 5:26 AM Andreas Röhler <
andreas.roehler@easy-emacs.de> wrote:

> Hi,
>
> wrote a couple of commands which transform delimited forms.
> For the curious:
>
> https://github.com/andreas-roehler/werkstatt/blob/master/thing-at-point-utils/thingatpt-transform-delimited.el
>
> For example at
>
> `find .  -maxdepth 1 -type f -name "*.txt"`
>
> M-x ar-backticked2braced-atpt RET
>
> would yield
>
> {find .  -maxdepth 1 -type f -name "*.txt"}
>
> Now let's have some mnemonic keys.
>
> (global-set-key [(control \))(control \})] 'ar-parentized2braced-atpt)
>
> works great.
>
> Unfortunately
>
> (global-set-key [(control \`)(control \})] 'ar-backticked2braced-atpt)
>
> sends error:
>
> <C-dead-grave> is undefined
> C-} is undefined
>
> While when running the command via M-x, messages:
>
> You can run the command ‘ar-backticked2braced-atpt’ with C-` C-}
>
> Any suggestions?
>
> Thanks,
>
> Andreas
>
>
> --

-- 
Kaushal Modi


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

* Re: backtick as key
  2016-04-28 15:05 ` Kaushal Modi
@ 2016-04-28 15:18   ` Andreas Röhler
  2016-04-28 15:21     ` Kaushal Modi
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Röhler @ 2016-04-28 15:18 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list; +Cc: Kaushal Modi



On 28.04.2016 17:05, Kaushal Modi wrote:
> Are you running "emacs -nw", or emacs GUI?
>
> I evaluated the below:
>
> (global-set-key (kbd "C-` C-}") (lambda() (interactive) (message "Hi")))
>
> and it works fine.
>

Good news, thanks.

Here this forms issues the same error: <C-dead-grave> is undefined

The "dead" here..., maybe a keybord-issue?



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

* Re: backtick as key
  2016-04-28  9:28 backtick as key Andreas Röhler
  2016-04-28 15:05 ` Kaushal Modi
@ 2016-04-28 15:20 ` Yuri Khan
  2016-04-28 19:10   ` Andreas Röhler
  1 sibling, 1 reply; 7+ messages in thread
From: Yuri Khan @ 2016-04-28 15:20 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: Help Gnu Emacs mailing list

On Thu, Apr 28, 2016 at 3:28 PM, Andreas Röhler
<andreas.roehler@easy-emacs.de> wrote:

> (global-set-key [(control \`)(control \})] 'ar-backticked2braced-atpt)
>
> sends error:
>
> <C-dead-grave> is undefined
> C-} is undefined

Your key marked as ` does not send the ` character immediately but is
set up as a dead key for grave accent. That is, if you follow it with
a vowel, that vowel is changed to a precomposed letter with a grave
accent. Otherwise, a ` character is produced retroactively, followed
by the character for the key you pressed next.

Dead keys are common in layouts for languages which heavily use
diacritics, such as French, and in the so-called US International
layout which is designed to let users enter letters with diacritics
from many languages while still retaining the core US layout.

Try this instead:

    (global-set-key (kbd "<C-dead-grave> C-}") 'ar-backticked2braced-atpt)



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

* Re: backtick as key
  2016-04-28 15:18   ` Andreas Röhler
@ 2016-04-28 15:21     ` Kaushal Modi
  0 siblings, 0 replies; 7+ messages in thread
From: Kaushal Modi @ 2016-04-28 15:21 UTC (permalink / raw)
  To: Andreas Röhler, Help Gnu Emacs mailing list

>
> Here this forms issues the same error: <C-dead-grave> is undefined
>
> The "dead" here..., maybe a keybord-issue?
>

Looks like difference in the scan codes our keyboards send to the OS.

I am using a standard Dell English-US keyboard (
http://i.ebayimg.com/images/g/41UAAOSw-vlVnFOF/s-l500.jpg ).
-- 

-- 
Kaushal Modi


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

* Re: backtick as key
  2016-04-28 15:20 ` Yuri Khan
@ 2016-04-28 19:10   ` Andreas Röhler
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Röhler @ 2016-04-28 19:10 UTC (permalink / raw)
  To: Yuri Khan; +Cc: Help Gnu Emacs mailing list



On 28.04.2016 17:20, Yuri Khan wrote:
> (global-set-key (kbd "<C-dead-grave> C-}") 'ar-backticked2braced-atpt)

Great, thanks a lot all!

Finally got this working too:

(global-set-key [(control dead-grave)(control \})] 
'ar-backticked2braced-atpt)





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

end of thread, other threads:[~2016-04-28 19:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-28  9:28 backtick as key Andreas Röhler
2016-04-28 15:05 ` Kaushal Modi
2016-04-28 15:18   ` Andreas Röhler
2016-04-28 15:21     ` Kaushal Modi
2016-04-28 15:20 ` Yuri Khan
2016-04-28 19:10   ` Andreas Röhler
     [not found] <mailman.1240.1461835581.7477.help-gnu-emacs@gnu.org>
2016-04-28 10:12 ` Marco Wahl

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