Quotation marks and other special characters

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Quotation marks and other special characters

Carl Winbäck
I’m not able to use ”alt codes” to insert special characters when using Emacs 25.1.1 on Windows 10 Pro 64-bit.

E.g. if I press Alt+0147 in order to insert an opening double quote (”), Emacs just displays C-u 147- in the mode line. This keyboard shortcut works fine in other applications such as Notepad.

Any ideas how to solve this?


Best regards,
Carl Winbäck
Reply | Threaded
Open this post in threaded view
|

Re: Quotation marks and other special characters

Carl Winbäck
PS. Sorry about the HTML formatting. I thought Gmail defaulted to
plain text, but apparently not.

On 14 June 2017 at 13:13, Carl Winbäck <[hidden email]> wrote:

> I’m not able to use ”alt codes” to insert special characters when using
> Emacs 25.1.1 on Windows 10 Pro 64-bit.
>
> E.g. if I press Alt+0147 in order to insert an opening double quote (”),
> Emacs just displays C-u 147- in the mode line. This keyboard shortcut works
> fine in other applications such as Notepad.
>
> Any ideas how to solve this?
>
>
> Best regards,
> Carl Winbäck

Reply | Threaded
Open this post in threaded view
|

Re: Quotation marks and other special characters

Rob Davenport-2
Hi Carl,

I see the same behavior on my 25.1.1 on Windows 7 64-bit.  So I checked the Emacs manual:
https://www.gnu.org/software/emacs/manual/html_node/emacs/Inserting-Text.html :

-----
To insert a non-graphic character, or a character that your keyboard does not support, first quote it by typing C-q (quoted-insert). There are two ways to use C-q:
- C-q followed by any non-graphic character (even C-g) inserts that character. For instance, C-q <DEL> inserts a literal ‘DEL’ character.
- C-q followed by a sequence of octal digits inserts the character with the specified octal character code. You can use any number of octal digits; any non-digit terminates the sequence. If the terminating character is <RET>, that <RET> serves only to terminate the sequence. Any other non-digit terminates the sequence and then acts as normal input—thus, C-q 1 0 1 B inserts ‘AB’.

The use of octal sequences is disabled in ordinary non-binary Overwrite mode, to give you a convenient way to insert a digit instead of overwriting with it.

To use decimal or hexadecimal instead of octal, set the variable read-quoted-char-radix to 10 or 16. If the radix is 16, the letters a to f serve as part of a character code, just like digits. Case is ignored.

A few common Unicode characters can be inserted via a command starting with C-x 8. For example, C-x 8 [ inserts ‘ which is Unicode code-point U+2018 LEFT SINGLE QUOTATION MARK, sometimes called a left single “curved quote” or “curly quote”. Similarly, C-x 8 ], C-x 8 { and C-x 8 } insert the curved quotes ’, “ and ”, respectively. Also, a working Alt key acts like C-x 8; e.g., A-[ acts like C-x 8 [ and inserts ‘. To see which characters have C-x 8 shorthands, type C-x 8 C-h.

Alternatively, you can use the command C-x 8 <RET> (insert-char). This prompts for the Unicode name or code-point of a character, using the minibuffer. If you enter a name, the command provides completion (see Completion). If you enter a code-point, it should be as a hexadecimal number (the convention for Unicode), or a number with a specified radix, e.g., #o23072 (octal); See Integer Basics. The command then inserts the corresponding character into the buffer.
----

And those worked nicely.   I could do C-x 8 <RET> and select the character code point I wanted by name with completion (using ivy) easily.
It's not exactly the same as the alt-codes, but I assume the Alt key on Windows builds is handled differently on Emacs than other programs, changing it to Meta but that might be circumventing whatever other code normally handles inserting the 'alt code'.  

(The Alt+0147 doesn't work for me in Notepad - but that may be due to other software (like xkeymacs that I'm running, even when I disabled it), but I have seen the Alt+numseq work before.)   Are you trying to enter Unicode characters, or upper ASCII characters?

If you set read-quoted-char-radix to 16, then do C-q <hexval>, Emacs inserts the hex character types (sort of - I'm not positive which - I'm sure it depends on the coding system of the buffer and other factors, maybe someone else will have better information).


For accented characters try C-x 8 ' <char> and C-x 8 C-h to see a list of characters to type.  C-x 8 ' seems to be for entering accented characters (I'm just guessing here - again someone else can probably provide more correct info).


Rob

-----Original Message-----
From: help-emacs-windows [mailto:help-emacs-windows-bounces+rob.davenport=[hidden email]] On Behalf Of Carl Winbäck
Sent: Wednesday, June 14, 2017 7:27 AM
To: [hidden email]
Subject: Re: [h-e-w] Quotation marks and other special characters

PS. Sorry about the HTML formatting. I thought Gmail defaulted to plain text, but apparently not.

On 14 June 2017 at 13:13, Carl Winbäck <[hidden email]> wrote:

> I’m not able to use ”alt codes” to insert special characters when
> using Emacs 25.1.1 on Windows 10 Pro 64-bit.
>
> E.g. if I press Alt+0147 in order to insert an opening double quote
> (”), Emacs just displays C-u 147- in the mode line. This keyboard
> shortcut works fine in other applications such as Notepad.
>
> Any ideas how to solve this?
>
>
> Best regards,
> Carl Winbäck

Reply | Threaded
Open this post in threaded view
|

Re: Quotation marks and other special characters

Eli Zaretskii
In reply to this post by Carl Winbäck
> From: Carl Winbäck <[hidden email]>
> Date: Wed, 14 Jun 2017 13:13:51 +0200
>
> I’m not able to use ”alt codes” to insert special characters when using Emacs 25.1.1 on Windows 10 Pro
> 64-bit.
>
> E.g. if I press Alt+0147 in order to insert an opening double quote (”), Emacs just displays C-u 147- in the
> mode line. This keyboard shortcut works fine in other applications such as Notepad.
>
> Any ideas how to solve this?

I don't think this has ever worked in Emacs.  You can use the other
methods for inserting characters by their codepoints, as pointed out
by Rob.

Reply | Threaded
Open this post in threaded view
|

Re: Quotation marks and other special characters

E. Caudex
I don't know if curly quotes are part of any Emacs input method but if
not, and depending on the layout of your keyboard you could have
something like this in your .emacs:


(setq w32-pass-lwindow-to-system nil
       w32-pass-rwindow-to-system nil
       w32-pass-apps-to-system    nil
       w32-lwindow-modifier       'super   ;; Left Windows
       w32-rwindow-modifier       'super   ;; Right Windows
       w32-apps-modifier          'hyper)  ;; App-Menu (key to right of
Right Windows)


and then

(global-set-key [(super \,)] (lambda () (interactive) (insert  ?« )))
(global-set-key [(super \.)] (lambda () (interactive) (insert  ?» )))
(global-set-key [(super \')] (lambda () (interactive) (insert  ?“ )))
(global-set-key [(super  \")] (lambda () (interactive) (insert  ?” )))

Ed


On 6/14/2017 07:46, Eli Zaretskii wrote:

>> From: Carl Winbäck <[hidden email]>
>> Date: Wed, 14 Jun 2017 13:13:51 +0200
>>
>> I’m not able to use ”alt codes” to insert special characters when using Emacs 25.1.1 on Windows 10 Pro
>> 64-bit.
>>
>> E.g. if I press Alt+0147 in order to insert an opening double quote (”), Emacs just displays C-u 147- in the
>> mode line. This keyboard shortcut works fine in other applications such as Notepad.
>>
>> Any ideas how to solve this?
> I don't think this has ever worked in Emacs.  You can use the other
> methods for inserting characters by their codepoints, as pointed out
> by Rob.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Quotation marks and other special characters

Carl Winbäck
Hi Ed,

This looks really interesting. However, I wonder if perhaps the code’s
formatting got mangled?

What made me doubtfoul was the ”insert” stanza. On my client it’s
displayed as (insert ?”) – the argument to the insert function is a
question mark followed by the special character, e.g. Right Double
Quotation Mark. (See also the screenshot in the attached file.)

Is that correct?


Best regards,
Carl


On 18 June 2017 at 07:24, T400 <[hidden email]> wrote:

> I don't know if curly quotes are part of any Emacs input method but if not,
> and depending on the layout of your keyboard you could have something like
> this in your .emacs:
>
>
> (setq w32-pass-lwindow-to-system nil
>       w32-pass-rwindow-to-system nil
>       w32-pass-apps-to-system    nil
>       w32-lwindow-modifier       'super   ;; Left Windows
>       w32-rwindow-modifier       'super   ;; Right Windows
>       w32-apps-modifier          'hyper)  ;; App-Menu (key to right of Right
> Windows)
>
>
> and then
>
> (global-set-key [(super \,)] (lambda () (interactive) (insert  ?« )))
> (global-set-key [(super \.)] (lambda () (interactive) (insert  ?» )))
> (global-set-key [(super \')] (lambda () (interactive) (insert  ?“ )))
> (global-set-key [(super  \")] (lambda () (interactive) (insert  ?” )))
>
> Ed
>
>
>
> On 6/14/2017 07:46, Eli Zaretskii wrote:
>>>
>>> From: Carl Winbäck <[hidden email]>
>>> Date: Wed, 14 Jun 2017 13:13:51 +0200
>>>
>>> I’m not able to use ”alt codes” to insert special characters when using
>>> Emacs 25.1.1 on Windows 10 Pro
>>> 64-bit.
>>>
>>> E.g. if I press Alt+0147 in order to insert an opening double quote (”),
>>> Emacs just displays C-u 147- in the
>>> mode line. This keyboard shortcut works fine in other applications such
>>> as Notepad.
>>>
>>> Any ideas how to solve this?
>>
>> I don't think this has ever worked in Emacs.  You can use the other
>> methods for inserting characters by their codepoints, as pointed out
>> by Rob.
>>
>>
>
>

screenshot.PNG (92K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Quotation marks and other special characters

Carl Winbäck
Nevermind! The issue that it didn’t work was that I had forgotten to
remove the ”and then” line (^_^)

Thank you again guys, this advice was really useful for me.

On 20 June 2017 at 09:07, Carl Winbäck <[hidden email]> wrote:

> Hi Ed,
>
> This looks really interesting. However, I wonder if perhaps the code’s
> formatting got mangled?
>
> What made me doubtfoul was the ”insert” stanza. On my client it’s
> displayed as (insert ?”) – the argument to the insert function is a
> question mark followed by the special character, e.g. Right Double
> Quotation Mark. (See also the screenshot in the attached file.)
>
> Is that correct?
>
>
> Best regards,
> Carl
>
>
> On 18 June 2017 at 07:24, T400 <[hidden email]> wrote:
>> I don't know if curly quotes are part of any Emacs input method but if not,
>> and depending on the layout of your keyboard you could have something like
>> this in your .emacs:
>>
>>
>> (setq w32-pass-lwindow-to-system nil
>>       w32-pass-rwindow-to-system nil
>>       w32-pass-apps-to-system    nil
>>       w32-lwindow-modifier       'super   ;; Left Windows
>>       w32-rwindow-modifier       'super   ;; Right Windows
>>       w32-apps-modifier          'hyper)  ;; App-Menu (key to right of Right
>> Windows)
>>
>>
>> and then
>>
>> (global-set-key [(super \,)] (lambda () (interactive) (insert  ?« )))
>> (global-set-key [(super \.)] (lambda () (interactive) (insert  ?» )))
>> (global-set-key [(super \')] (lambda () (interactive) (insert  ?“ )))
>> (global-set-key [(super  \")] (lambda () (interactive) (insert  ?” )))
>>
>> Ed
>>
>>
>>
>> On 6/14/2017 07:46, Eli Zaretskii wrote:
>>>>
>>>> From: Carl Winbäck <[hidden email]>
>>>> Date: Wed, 14 Jun 2017 13:13:51 +0200
>>>>
>>>> I’m not able to use ”alt codes” to insert special characters when using
>>>> Emacs 25.1.1 on Windows 10 Pro
>>>> 64-bit.
>>>>
>>>> E.g. if I press Alt+0147 in order to insert an opening double quote (”),
>>>> Emacs just displays C-u 147- in the
>>>> mode line. This keyboard shortcut works fine in other applications such
>>>> as Notepad.
>>>>
>>>> Any ideas how to solve this?
>>>
>>> I don't think this has ever worked in Emacs.  You can use the other
>>> methods for inserting characters by their codepoints, as pointed out
>>> by Rob.
>>>
>>>
>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: Quotation marks and other special characters

Carl Winbäck
PS. I just found some interesting info over at
https://www.emacswiki.org/emacs/AutoHotKey

A guy named Jonas Öster has created a hack for supporting Windows
Alt+keypad in Emacs. I haven’t tried it yet but it definitely looks
useful.

On 20 June 2017 at 09:27, Carl Winbäck <[hidden email]> wrote:

> Nevermind! The issue that it didn’t work was that I had forgotten to
> remove the ”and then” line (^_^)
>
> Thank you again guys, this advice was really useful for me.
>
> On 20 June 2017 at 09:07, Carl Winbäck <[hidden email]> wrote:
>> Hi Ed,
>>
>> This looks really interesting. However, I wonder if perhaps the code’s
>> formatting got mangled?
>>
>> What made me doubtfoul was the ”insert” stanza. On my client it’s
>> displayed as (insert ?”) – the argument to the insert function is a
>> question mark followed by the special character, e.g. Right Double
>> Quotation Mark. (See also the screenshot in the attached file.)
>>
>> Is that correct?
>>
>>
>> Best regards,
>> Carl
>>
>>
>> On 18 June 2017 at 07:24, T400 <[hidden email]> wrote:
>>> I don't know if curly quotes are part of any Emacs input method but if not,
>>> and depending on the layout of your keyboard you could have something like
>>> this in your .emacs:
>>>
>>>
>>> (setq w32-pass-lwindow-to-system nil
>>>       w32-pass-rwindow-to-system nil
>>>       w32-pass-apps-to-system    nil
>>>       w32-lwindow-modifier       'super   ;; Left Windows
>>>       w32-rwindow-modifier       'super   ;; Right Windows
>>>       w32-apps-modifier          'hyper)  ;; App-Menu (key to right of Right
>>> Windows)
>>>
>>>
>>> and then
>>>
>>> (global-set-key [(super \,)] (lambda () (interactive) (insert  ?« )))
>>> (global-set-key [(super \.)] (lambda () (interactive) (insert  ?» )))
>>> (global-set-key [(super \')] (lambda () (interactive) (insert  ?“ )))
>>> (global-set-key [(super  \")] (lambda () (interactive) (insert  ?” )))
>>>
>>> Ed
>>>
>>>
>>>
>>> On 6/14/2017 07:46, Eli Zaretskii wrote:
>>>>>
>>>>> From: Carl Winbäck <[hidden email]>
>>>>> Date: Wed, 14 Jun 2017 13:13:51 +0200
>>>>>
>>>>> I’m not able to use ”alt codes” to insert special characters when using
>>>>> Emacs 25.1.1 on Windows 10 Pro
>>>>> 64-bit.
>>>>>
>>>>> E.g. if I press Alt+0147 in order to insert an opening double quote (”),
>>>>> Emacs just displays C-u 147- in the
>>>>> mode line. This keyboard shortcut works fine in other applications such
>>>>> as Notepad.
>>>>>
>>>>> Any ideas how to solve this?
>>>>
>>>> I don't think this has ever worked in Emacs.  You can use the other
>>>> methods for inserting characters by their codepoints, as pointed out
>>>> by Rob.
>>>>
>>>>
>>>
>>>

Reply | Threaded
Open this post in threaded view
|

Re: Quotation marks and other special characters

E. Caudex
In reply to this post by Carl Winbäck
Carl:

I think it's right. It seems to work on ver 24.4

I have the insert left curly quote bound to super tick (single quote)

and

insert right curly quote bound to super double-quote.

Why do you suspect that it's mangled


Ed


On 6/20/2017 00:07, Carl Winbäck wrote:

> Hi Ed,
>
> This looks really interesting. However, I wonder if perhaps the code’s
> formatting got mangled?
>
> What made me doubtfoul was the ”insert” stanza. On my client it’s
> displayed as (insert ?”) – the argument to the insert function is a
> question mark followed by the special character, e.g. Right Double
> Quotation Mark. (See also the screenshot in the attached file.)
>
> Is that correct?
>
>
> Best regards,
> Carl
>
>
> On 18 June 2017 at 07:24, T400 <[hidden email]> wrote:
>> I don't know if curly quotes are part of any Emacs input method but if not,
>> and depending on the layout of your keyboard you could have something like
>> this in your .emacs:
>>
>>
>> (setq w32-pass-lwindow-to-system nil
>>        w32-pass-rwindow-to-system nil
>>        w32-pass-apps-to-system    nil
>>        w32-lwindow-modifier       'super   ;; Left Windows
>>        w32-rwindow-modifier       'super   ;; Right Windows
>>        w32-apps-modifier          'hyper)  ;; App-Menu (key to right of Right
>> Windows)
>>
>>
>> and then
>>
>> (global-set-key [(super \,)] (lambda () (interactive) (insert  ?« )))
>> (global-set-key [(super \.)] (lambda () (interactive) (insert  ?» )))
>> (global-set-key [(super \')] (lambda () (interactive) (insert  ?“ )))
>> (global-set-key [(super  \")] (lambda () (interactive) (insert  ?” )))
>>
>> Ed
>>
>>
>>
>> On 6/14/2017 07:46, Eli Zaretskii wrote:
>>>> From: Carl Winbäck <[hidden email]>
>>>> Date: Wed, 14 Jun 2017 13:13:51 +0200
>>>>
>>>> I’m not able to use ”alt codes” to insert special characters when using
>>>> Emacs 25.1.1 on Windows 10 Pro
>>>> 64-bit.
>>>>
>>>> E.g. if I press Alt+0147 in order to insert an opening double quote (”),
>>>> Emacs just displays C-u 147- in the
>>>> mode line. This keyboard shortcut works fine in other applications such
>>>> as Notepad.
>>>>
>>>> Any ideas how to solve this?
>>> I don't think this has ever worked in Emacs.  You can use the other
>>> methods for inserting characters by their codepoints, as pointed out
>>> by Rob.
>>>
>>>
>>


Reply | Threaded
Open this post in threaded view
|

Re: Quotation marks and other special characters

Carl Winbäck
Sorry about that Ed!

I was too quick when I pasted the code to my init file. When I removed the line containing ”and then” it worked just fine :)

Thank you!

On Wed, 21 Jun 2017 at 01:03, T400 <[hidden email]> wrote:
Carl:

I think it's right. It seems to work on ver 24.4

I have the insert left curly quote bound to super tick (single quote)

and

insert right curly quote bound to super double-quote.

Why do you suspect that it's mangled


Ed


On 6/20/2017 00:07, Carl Winbäck wrote:
> Hi Ed,
>
> This looks really interesting. However, I wonder if perhaps the code’s
> formatting got mangled?
>
> What made me doubtfoul was the ”insert” stanza. On my client it’s
> displayed as (insert ?”) – the argument to the insert function is a
> question mark followed by the special character, e.g. Right Double
> Quotation Mark. (See also the screenshot in the attached file.)
>
> Is that correct?
>
>
> Best regards,
> Carl
>
>
> On 18 June 2017 at 07:24, T400 <[hidden email]> wrote:
>> I don't know if curly quotes are part of any Emacs input method but if not,
>> and depending on the layout of your keyboard you could have something like
>> this in your .emacs:
>>
>>
>> (setq w32-pass-lwindow-to-system nil
>>        w32-pass-rwindow-to-system nil
>>        w32-pass-apps-to-system    nil
>>        w32-lwindow-modifier       'super   ;; Left Windows
>>        w32-rwindow-modifier       'super   ;; Right Windows
>>        w32-apps-modifier          'hyper)  ;; App-Menu (key to right of Right
>> Windows)
>>
>>
>> and then
>>
>> (global-set-key [(super \,)] (lambda () (interactive) (insert  ?« )))
>> (global-set-key [(super \.)] (lambda () (interactive) (insert  ?» )))
>> (global-set-key [(super \')] (lambda () (interactive) (insert  ?“ )))
>> (global-set-key [(super  \")] (lambda () (interactive) (insert  ?” )))
>>
>> Ed
>>
>>
>>
>> On 6/14/2017 07:46, Eli Zaretskii wrote:
>>>> From: Carl Winbäck <[hidden email]>
>>>> Date: Wed, 14 Jun 2017 13:13:51 +0200
>>>>
>>>> I’m not able to use ”alt codes” to insert special characters when using
>>>> Emacs 25.1.1 on Windows 10 Pro
>>>> 64-bit.
>>>>
>>>> E.g. if I press Alt+0147 in order to insert an opening double quote (”),
>>>> Emacs just displays C-u 147- in the
>>>> mode line. This keyboard shortcut works fine in other applications such
>>>> as Notepad.
>>>>
>>>> Any ideas how to solve this?
>>> I don't think this has ever worked in Emacs.  You can use the other
>>> methods for inserting characters by their codepoints, as pointed out
>>> by Rob.
>>>
>>>
>>