unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Binding key to insert an non-spacing acute accent
@ 2024-01-21 16:16 Eric S Fraga
  2024-01-21 16:46 ` Rudolf Schlatte
  2024-01-22  3:59 ` Michael Heerdegen via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 7+ messages in thread
From: Eric S Fraga @ 2024-01-21 16:16 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I often mix English with other languages, such as Spanish, that have
accents.  I usually use the compose keyboard sequence to enter accented
characters.  However, I recently learned that you can insert a
non-spacing accent (e.g. acute) via C-x 8 RET.  Lovely!

Now, however, I would love to be able to bind that to a key, e.g. M-'
that I do not use for anything else normally, but I cannot seem to
figure out how.  I cannot see a way of definining any elisp to insert a
specific non-spacing character.  Any and all suggestions welcome!

Thank you,
eric

-- 
Eric S Fraga, https://profiles.ucl.ac.uk/5958-eric-fraga




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

* Re: Binding key to insert an non-spacing acute accent
  2024-01-21 16:16 Binding key to insert an non-spacing acute accent Eric S Fraga
@ 2024-01-21 16:46 ` Rudolf Schlatte
  2024-01-22 15:38   ` Eric S Fraga
  2024-01-22  3:59 ` Michael Heerdegen via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 7+ messages in thread
From: Rudolf Schlatte @ 2024-01-21 16:46 UTC (permalink / raw)
  To: help-gnu-emacs

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> Hello,
>
> I often mix English with other languages, such as Spanish, that have
> accents.  I usually use the compose keyboard sequence to enter accented
> characters.  However, I recently learned that you can insert a
> non-spacing accent (e.g. acute) via C-x 8 RET.  Lovely!

Not a direct answer to your question, but when I need a quick á I just
type C-x 8 ' a

For a list of all those key combinations, press C-x 8 C-h and then
expand the "> Key translations Starting With C-x 8:" line.

Hope that helps!




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

* Re: Binding key to insert an non-spacing acute accent
  2024-01-21 16:16 Binding key to insert an non-spacing acute accent Eric S Fraga
  2024-01-21 16:46 ` Rudolf Schlatte
@ 2024-01-22  3:59 ` Michael Heerdegen via Users list for the GNU Emacs text editor
  2024-01-22 15:37   ` Eric S Fraga
  1 sibling, 1 reply; 7+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-01-22  3:59 UTC (permalink / raw)
  To: help-gnu-emacs

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> Now, however, I would love to be able to bind that to a key, e.g. M-'
> that I do not use for anything else normally, but I cannot seem to
> figure out how.  I cannot see a way of definining any elisp to insert a
> specific non-spacing character.  Any and all suggestions welcome!

Nothing special - just call `insert' as usual.

When the character is bound to `self-insert-command', you can also use a
key translation - e.g.

  (define-key key-translation-map [(meta ?')] [?́])

or equivalent if you want to avoid unicode characters in your code:

  (define-key key-translation-map [(meta ?')] [#o1401])

where #oNNNN is the octal number representing the character.


Michael.




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

* Re: Binding key to insert an non-spacing acute accent
  2024-01-22  3:59 ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-01-22 15:37   ` Eric S Fraga
  2024-01-23 17:12     ` Leo Butler
  0 siblings, 1 reply; 7+ messages in thread
From: Eric S Fraga @ 2024-01-22 15:37 UTC (permalink / raw)
  To: help-gnu-emacs

On Monday, 22 Jan 2024 at 04:59, Michael Heerdegen via Users list for the GNU Emacs text editor wrote:
>   (define-key key-translation-map [(meta ?')] [#o1401])

Excellent.  Thank you.

Because, when using the character directly, I got ?́, I thought it would
insert the question mark as well (obviously should have actually tried
it).  Using unicode makes it less confusing as the accent on the
question mark is difficult to see, at least with the typeface I'm using.

-- 
Eric S Fraga via gnus (Emacs 30.0.50 2023-09-14) on Debian 12.2




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

* Re: Binding key to insert an non-spacing acute accent
  2024-01-21 16:46 ` Rudolf Schlatte
@ 2024-01-22 15:38   ` Eric S Fraga
  0 siblings, 0 replies; 7+ messages in thread
From: Eric S Fraga @ 2024-01-22 15:38 UTC (permalink / raw)
  To: help-gnu-emacs

On Sunday, 21 Jan 2024 at 17:46, Rudolf Schlatte wrote:
> Not a direct answer to your question, but when I need a quick á I just
> type C-x 8 ' a

Yes, thank you.  I always forget about this key sequence.  In any case,
I was looking for something that allows changing an existing character
easily as well so binding the non-spacing character does the job nicely
(now that I know how to do it)!

-- 
Eric S Fraga via gnus (Emacs 30.0.50 2023-09-14) on Debian 12.2




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

* Re: Binding key to insert an non-spacing acute accent
  2024-01-22 15:37   ` Eric S Fraga
@ 2024-01-23 17:12     ` Leo Butler
  2024-01-23 21:11       ` Eric S Fraga
  0 siblings, 1 reply; 7+ messages in thread
From: Leo Butler @ 2024-01-23 17:12 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: help-gnu-emacs@gnu.org

On Mon, Jan 22 2024, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:

> On Monday, 22 Jan 2024 at 04:59, Michael Heerdegen via Users list for the GNU Emacs text editor wrote:
>>   (define-key key-translation-map [(meta ?')] [#o1401])
>
> Excellent.  Thank you.
>
> Because, when using the character directly, I got ?́, I thought it would
> insert the question mark as well (obviously should have actually tried
> it).  Using unicode makes it less confusing as the accent on the
> question mark is difficult to see, at least with the typeface I'm using.

You can use the TeX input method to do what you want.

C-\ TeX RET   => change input method to use TeX-like syntax

Example, the key sequence \'a  produces á.

HTH, Leo.

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

* Re: Binding key to insert an non-spacing acute accent
  2024-01-23 17:12     ` Leo Butler
@ 2024-01-23 21:11       ` Eric S Fraga
  0 siblings, 0 replies; 7+ messages in thread
From: Eric S Fraga @ 2024-01-23 21:11 UTC (permalink / raw)
  To: help-gnu-emacs

On Tuesday, 23 Jan 2024 at 17:12, Leo Butler wrote:
> You can use the TeX input method to do what you want.
>
> C-\ TeX RET   => change input method to use TeX-like syntax

Yes, indeed.  Also, if I'm writing purely in Spanish (say), I can simply
change the input method to spanish-postfix (or another variant).

But the nice thing about the M-' binding inserting the non-spacing
accent is that it makes it possible to *change* the current character to
the accented version with a single keystroke.  Very useful when revising
what I have written as I sometimes forget the odd accent here and there.

Thank you,
eric

-- 
Eric S Fraga via gnus (Emacs 30.0.50 2023-06-19) on Debian 12.0




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

end of thread, other threads:[~2024-01-23 21:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-21 16:16 Binding key to insert an non-spacing acute accent Eric S Fraga
2024-01-21 16:46 ` Rudolf Schlatte
2024-01-22 15:38   ` Eric S Fraga
2024-01-22  3:59 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-01-22 15:37   ` Eric S Fraga
2024-01-23 17:12     ` Leo Butler
2024-01-23 21:11       ` Eric S Fraga

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