Inserting the plus minus unicode symbol ± as a keyboard macro












4














I insert the plus minus symbol ± frequently enough that I want to bind it to a key.



From emacs -Q, I've tried this:



(global-set-key (kbd "C-c m") "±")


However, when I enter C-c m, the minibuffer displays C-u 1-, suggesting it's waiting for me to finish entering a sequence.



I can bind C-c m to other symbols:



(global-set-key (kbd "C-c m") "⇔")


This works as expected: C-c m inserts the double-arrow .



I've tried other keys as well, e.g.



(global-set-key (kbd "C-c a") "±")


This gives the same result: emacs interprets it as C-u 1-.



Is there something special about the plus-minus glyph that makes Emacs intepret it as a prefix argument? Why can't I insert it as I would other characters?



I have solved the immediate problem by defining an abbrev to insert the plus-minus glyph, but I would like to know why the keybindings above don't work.



Update:



Inserting the character via (insert ) does work:



(global-set-key (kbd "C-c m") (lambda () (interactive) (insert "±")))









share|improve this question
























  • Weird. Out of curiosity, try binding the key to a call to insert wrapped in a lambda.
    – Dan
    Dec 21 '18 at 15:58










  • done! That does work.
    – Tyler
    Dec 21 '18 at 16:15






  • 1




    This looks like a bug, to me.
    – Drew
    Dec 21 '18 at 16:47










  • I agree with @Drew. And bugs can be reported with M-x report-emacs-bug. More information is here.
    – zck
    Dec 21 '18 at 16:52










  • I submitted Emacs bug #33829 for this. It might not be considered a bug. Probably has to do with what's allowed in the string value for a keyboard macro, and how such a string is interpreted as a macro.
    – Drew
    Dec 21 '18 at 16:53


















4














I insert the plus minus symbol ± frequently enough that I want to bind it to a key.



From emacs -Q, I've tried this:



(global-set-key (kbd "C-c m") "±")


However, when I enter C-c m, the minibuffer displays C-u 1-, suggesting it's waiting for me to finish entering a sequence.



I can bind C-c m to other symbols:



(global-set-key (kbd "C-c m") "⇔")


This works as expected: C-c m inserts the double-arrow .



I've tried other keys as well, e.g.



(global-set-key (kbd "C-c a") "±")


This gives the same result: emacs interprets it as C-u 1-.



Is there something special about the plus-minus glyph that makes Emacs intepret it as a prefix argument? Why can't I insert it as I would other characters?



I have solved the immediate problem by defining an abbrev to insert the plus-minus glyph, but I would like to know why the keybindings above don't work.



Update:



Inserting the character via (insert ) does work:



(global-set-key (kbd "C-c m") (lambda () (interactive) (insert "±")))









share|improve this question
























  • Weird. Out of curiosity, try binding the key to a call to insert wrapped in a lambda.
    – Dan
    Dec 21 '18 at 15:58










  • done! That does work.
    – Tyler
    Dec 21 '18 at 16:15






  • 1




    This looks like a bug, to me.
    – Drew
    Dec 21 '18 at 16:47










  • I agree with @Drew. And bugs can be reported with M-x report-emacs-bug. More information is here.
    – zck
    Dec 21 '18 at 16:52










  • I submitted Emacs bug #33829 for this. It might not be considered a bug. Probably has to do with what's allowed in the string value for a keyboard macro, and how such a string is interpreted as a macro.
    – Drew
    Dec 21 '18 at 16:53
















4












4








4







I insert the plus minus symbol ± frequently enough that I want to bind it to a key.



From emacs -Q, I've tried this:



(global-set-key (kbd "C-c m") "±")


However, when I enter C-c m, the minibuffer displays C-u 1-, suggesting it's waiting for me to finish entering a sequence.



I can bind C-c m to other symbols:



(global-set-key (kbd "C-c m") "⇔")


This works as expected: C-c m inserts the double-arrow .



I've tried other keys as well, e.g.



(global-set-key (kbd "C-c a") "±")


This gives the same result: emacs interprets it as C-u 1-.



Is there something special about the plus-minus glyph that makes Emacs intepret it as a prefix argument? Why can't I insert it as I would other characters?



I have solved the immediate problem by defining an abbrev to insert the plus-minus glyph, but I would like to know why the keybindings above don't work.



Update:



Inserting the character via (insert ) does work:



(global-set-key (kbd "C-c m") (lambda () (interactive) (insert "±")))









share|improve this question















I insert the plus minus symbol ± frequently enough that I want to bind it to a key.



From emacs -Q, I've tried this:



(global-set-key (kbd "C-c m") "±")


However, when I enter C-c m, the minibuffer displays C-u 1-, suggesting it's waiting for me to finish entering a sequence.



I can bind C-c m to other symbols:



(global-set-key (kbd "C-c m") "⇔")


This works as expected: C-c m inserts the double-arrow .



I've tried other keys as well, e.g.



(global-set-key (kbd "C-c a") "±")


This gives the same result: emacs interprets it as C-u 1-.



Is there something special about the plus-minus glyph that makes Emacs intepret it as a prefix argument? Why can't I insert it as I would other characters?



I have solved the immediate problem by defining an abbrev to insert the plus-minus glyph, but I would like to know why the keybindings above don't work.



Update:



Inserting the character via (insert ) does work:



(global-set-key (kbd "C-c m") (lambda () (interactive) (insert "±")))






unicode keyboard-macros






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 21 '18 at 19:12









Drew

47k462104




47k462104










asked Dec 21 '18 at 15:42









Tyler

11.3k12049




11.3k12049












  • Weird. Out of curiosity, try binding the key to a call to insert wrapped in a lambda.
    – Dan
    Dec 21 '18 at 15:58










  • done! That does work.
    – Tyler
    Dec 21 '18 at 16:15






  • 1




    This looks like a bug, to me.
    – Drew
    Dec 21 '18 at 16:47










  • I agree with @Drew. And bugs can be reported with M-x report-emacs-bug. More information is here.
    – zck
    Dec 21 '18 at 16:52










  • I submitted Emacs bug #33829 for this. It might not be considered a bug. Probably has to do with what's allowed in the string value for a keyboard macro, and how such a string is interpreted as a macro.
    – Drew
    Dec 21 '18 at 16:53




















  • Weird. Out of curiosity, try binding the key to a call to insert wrapped in a lambda.
    – Dan
    Dec 21 '18 at 15:58










  • done! That does work.
    – Tyler
    Dec 21 '18 at 16:15






  • 1




    This looks like a bug, to me.
    – Drew
    Dec 21 '18 at 16:47










  • I agree with @Drew. And bugs can be reported with M-x report-emacs-bug. More information is here.
    – zck
    Dec 21 '18 at 16:52










  • I submitted Emacs bug #33829 for this. It might not be considered a bug. Probably has to do with what's allowed in the string value for a keyboard macro, and how such a string is interpreted as a macro.
    – Drew
    Dec 21 '18 at 16:53


















Weird. Out of curiosity, try binding the key to a call to insert wrapped in a lambda.
– Dan
Dec 21 '18 at 15:58




Weird. Out of curiosity, try binding the key to a call to insert wrapped in a lambda.
– Dan
Dec 21 '18 at 15:58












done! That does work.
– Tyler
Dec 21 '18 at 16:15




done! That does work.
– Tyler
Dec 21 '18 at 16:15




1




1




This looks like a bug, to me.
– Drew
Dec 21 '18 at 16:47




This looks like a bug, to me.
– Drew
Dec 21 '18 at 16:47












I agree with @Drew. And bugs can be reported with M-x report-emacs-bug. More information is here.
– zck
Dec 21 '18 at 16:52




I agree with @Drew. And bugs can be reported with M-x report-emacs-bug. More information is here.
– zck
Dec 21 '18 at 16:52












I submitted Emacs bug #33829 for this. It might not be considered a bug. Probably has to do with what's allowed in the string value for a keyboard macro, and how such a string is interpreted as a macro.
– Drew
Dec 21 '18 at 16:53






I submitted Emacs bug #33829 for this. It might not be considered a bug. Probably has to do with what's allowed in the string value for a keyboard macro, and how such a string is interpreted as a macro.
– Drew
Dec 21 '18 at 16:53












2 Answers
2






active

oldest

votes


















4














With respect to why you saw what you saw:



As Eli Zaretskii said in a reply to bug report #33829, the string is interpreted as a keyboard macro, and Emacs "interprets ±, which is a single byte with the 8th bit set, as a meta character".



It's interpreted as M-1, which is shown in the echo area as C-u 1-, as the beginning of a numeric prefix arg.



The mistake/gotcha is to expect that all bytes in a keyboard-macro string are interpreted as characters (which are just inserted). This is a byte that is interpreted as a key bound to a command. It just happens to be renderable also as a Unicode character, ±.



In the context of key-binding to a (keyboard-macro) string, as in the example -- especially since that is easily and commonly used to insert a Unicode character (or any char that is not so easy to type), it's easy to forget that keyboard-macro strings are command sequences.






share|improve this answer





















  • Great, thanks. That makes sense. Avoiding the gotcha seems to depend on you knowing when extended ascii stops and unicode starts, or otherwise distinguishing between single and multi-byte characters. In my case, I pulled the symbols from helm-unicode, which doesn't indicate which symbols are multi-byte (nor would I have expected it to, before now). Fun fact: ± is a single byte, but ∓ is multibyte :)
    – Tyler
    Dec 21 '18 at 22:35



















4














You can get what you want with



(global-set-key (kbd "C-c m") [177])


or if you prefer



(global-set-key (kbd "C-c m") [?±])


Another solution uses the package key-chord which allows you to assign commands to keys pressed simultaneously. After you have installed it, you can define



(key-chord-define-global "-=" [177])


and then pressing "-" and "=" at the same time does what you want.



Using vectors to represent unicode characters seems to be more reliable than keyboard macros. Emacs calls self-insert-command on the character C when it sees the key [C] where C is the character (the decimal repersentation) of the unicode character you want.






share|improve this answer























  • Interesting, thanks. I'm curious what the difference between a vector and the equivalent keyboard macro is. There are a few ascii codes that are used to represent modified numbers. ±²³´µ¶·¸¹° are used for M-1 through M-0, but this only effects keyboard macros, not vectors, as your solution demonstrates.
    – Tyler
    Dec 21 '18 at 21:14






  • 1




    I think what is happening is that M- is still thought of as changing one bit (presumably adding 128) to the ascii code for 1,2 etc. So it is that the keyboard macro "±" is interpreted as "M-1".
    – Aidan Schofield
    Dec 21 '18 at 21:31










  • that looks right, and applies to other characters too - the symbol î is ascii 238, or 110 + 128. n is ascii 110, so trying to use the keyboard macro "î" fails too - presumably because Emacs uses that code to represent M-n.
    – Tyler
    Dec 21 '18 at 21:42










  • Here's confirmation from Eli Z: debbugs.gnu.org/cgi/bugreport.cgi?bug=33829#11 I guess this is obvious to people who know which characters are single bytes and which are multibytes ;)
    – Tyler
    Dec 21 '18 at 21:45












  • Thanks Tyler for that reference.
    – Aidan Schofield
    Dec 21 '18 at 21:47











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "583"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f46713%2finserting-the-plus-minus-unicode-symbol-%25c2%25b1-as-a-keyboard-macro%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














With respect to why you saw what you saw:



As Eli Zaretskii said in a reply to bug report #33829, the string is interpreted as a keyboard macro, and Emacs "interprets ±, which is a single byte with the 8th bit set, as a meta character".



It's interpreted as M-1, which is shown in the echo area as C-u 1-, as the beginning of a numeric prefix arg.



The mistake/gotcha is to expect that all bytes in a keyboard-macro string are interpreted as characters (which are just inserted). This is a byte that is interpreted as a key bound to a command. It just happens to be renderable also as a Unicode character, ±.



In the context of key-binding to a (keyboard-macro) string, as in the example -- especially since that is easily and commonly used to insert a Unicode character (or any char that is not so easy to type), it's easy to forget that keyboard-macro strings are command sequences.






share|improve this answer





















  • Great, thanks. That makes sense. Avoiding the gotcha seems to depend on you knowing when extended ascii stops and unicode starts, or otherwise distinguishing between single and multi-byte characters. In my case, I pulled the symbols from helm-unicode, which doesn't indicate which symbols are multi-byte (nor would I have expected it to, before now). Fun fact: ± is a single byte, but ∓ is multibyte :)
    – Tyler
    Dec 21 '18 at 22:35
















4














With respect to why you saw what you saw:



As Eli Zaretskii said in a reply to bug report #33829, the string is interpreted as a keyboard macro, and Emacs "interprets ±, which is a single byte with the 8th bit set, as a meta character".



It's interpreted as M-1, which is shown in the echo area as C-u 1-, as the beginning of a numeric prefix arg.



The mistake/gotcha is to expect that all bytes in a keyboard-macro string are interpreted as characters (which are just inserted). This is a byte that is interpreted as a key bound to a command. It just happens to be renderable also as a Unicode character, ±.



In the context of key-binding to a (keyboard-macro) string, as in the example -- especially since that is easily and commonly used to insert a Unicode character (or any char that is not so easy to type), it's easy to forget that keyboard-macro strings are command sequences.






share|improve this answer





















  • Great, thanks. That makes sense. Avoiding the gotcha seems to depend on you knowing when extended ascii stops and unicode starts, or otherwise distinguishing between single and multi-byte characters. In my case, I pulled the symbols from helm-unicode, which doesn't indicate which symbols are multi-byte (nor would I have expected it to, before now). Fun fact: ± is a single byte, but ∓ is multibyte :)
    – Tyler
    Dec 21 '18 at 22:35














4












4








4






With respect to why you saw what you saw:



As Eli Zaretskii said in a reply to bug report #33829, the string is interpreted as a keyboard macro, and Emacs "interprets ±, which is a single byte with the 8th bit set, as a meta character".



It's interpreted as M-1, which is shown in the echo area as C-u 1-, as the beginning of a numeric prefix arg.



The mistake/gotcha is to expect that all bytes in a keyboard-macro string are interpreted as characters (which are just inserted). This is a byte that is interpreted as a key bound to a command. It just happens to be renderable also as a Unicode character, ±.



In the context of key-binding to a (keyboard-macro) string, as in the example -- especially since that is easily and commonly used to insert a Unicode character (or any char that is not so easy to type), it's easy to forget that keyboard-macro strings are command sequences.






share|improve this answer












With respect to why you saw what you saw:



As Eli Zaretskii said in a reply to bug report #33829, the string is interpreted as a keyboard macro, and Emacs "interprets ±, which is a single byte with the 8th bit set, as a meta character".



It's interpreted as M-1, which is shown in the echo area as C-u 1-, as the beginning of a numeric prefix arg.



The mistake/gotcha is to expect that all bytes in a keyboard-macro string are interpreted as characters (which are just inserted). This is a byte that is interpreted as a key bound to a command. It just happens to be renderable also as a Unicode character, ±.



In the context of key-binding to a (keyboard-macro) string, as in the example -- especially since that is easily and commonly used to insert a Unicode character (or any char that is not so easy to type), it's easy to forget that keyboard-macro strings are command sequences.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 21 '18 at 22:24









Drew

47k462104




47k462104












  • Great, thanks. That makes sense. Avoiding the gotcha seems to depend on you knowing when extended ascii stops and unicode starts, or otherwise distinguishing between single and multi-byte characters. In my case, I pulled the symbols from helm-unicode, which doesn't indicate which symbols are multi-byte (nor would I have expected it to, before now). Fun fact: ± is a single byte, but ∓ is multibyte :)
    – Tyler
    Dec 21 '18 at 22:35


















  • Great, thanks. That makes sense. Avoiding the gotcha seems to depend on you knowing when extended ascii stops and unicode starts, or otherwise distinguishing between single and multi-byte characters. In my case, I pulled the symbols from helm-unicode, which doesn't indicate which symbols are multi-byte (nor would I have expected it to, before now). Fun fact: ± is a single byte, but ∓ is multibyte :)
    – Tyler
    Dec 21 '18 at 22:35
















Great, thanks. That makes sense. Avoiding the gotcha seems to depend on you knowing when extended ascii stops and unicode starts, or otherwise distinguishing between single and multi-byte characters. In my case, I pulled the symbols from helm-unicode, which doesn't indicate which symbols are multi-byte (nor would I have expected it to, before now). Fun fact: ± is a single byte, but ∓ is multibyte :)
– Tyler
Dec 21 '18 at 22:35




Great, thanks. That makes sense. Avoiding the gotcha seems to depend on you knowing when extended ascii stops and unicode starts, or otherwise distinguishing between single and multi-byte characters. In my case, I pulled the symbols from helm-unicode, which doesn't indicate which symbols are multi-byte (nor would I have expected it to, before now). Fun fact: ± is a single byte, but ∓ is multibyte :)
– Tyler
Dec 21 '18 at 22:35











4














You can get what you want with



(global-set-key (kbd "C-c m") [177])


or if you prefer



(global-set-key (kbd "C-c m") [?±])


Another solution uses the package key-chord which allows you to assign commands to keys pressed simultaneously. After you have installed it, you can define



(key-chord-define-global "-=" [177])


and then pressing "-" and "=" at the same time does what you want.



Using vectors to represent unicode characters seems to be more reliable than keyboard macros. Emacs calls self-insert-command on the character C when it sees the key [C] where C is the character (the decimal repersentation) of the unicode character you want.






share|improve this answer























  • Interesting, thanks. I'm curious what the difference between a vector and the equivalent keyboard macro is. There are a few ascii codes that are used to represent modified numbers. ±²³´µ¶·¸¹° are used for M-1 through M-0, but this only effects keyboard macros, not vectors, as your solution demonstrates.
    – Tyler
    Dec 21 '18 at 21:14






  • 1




    I think what is happening is that M- is still thought of as changing one bit (presumably adding 128) to the ascii code for 1,2 etc. So it is that the keyboard macro "±" is interpreted as "M-1".
    – Aidan Schofield
    Dec 21 '18 at 21:31










  • that looks right, and applies to other characters too - the symbol î is ascii 238, or 110 + 128. n is ascii 110, so trying to use the keyboard macro "î" fails too - presumably because Emacs uses that code to represent M-n.
    – Tyler
    Dec 21 '18 at 21:42










  • Here's confirmation from Eli Z: debbugs.gnu.org/cgi/bugreport.cgi?bug=33829#11 I guess this is obvious to people who know which characters are single bytes and which are multibytes ;)
    – Tyler
    Dec 21 '18 at 21:45












  • Thanks Tyler for that reference.
    – Aidan Schofield
    Dec 21 '18 at 21:47
















4














You can get what you want with



(global-set-key (kbd "C-c m") [177])


or if you prefer



(global-set-key (kbd "C-c m") [?±])


Another solution uses the package key-chord which allows you to assign commands to keys pressed simultaneously. After you have installed it, you can define



(key-chord-define-global "-=" [177])


and then pressing "-" and "=" at the same time does what you want.



Using vectors to represent unicode characters seems to be more reliable than keyboard macros. Emacs calls self-insert-command on the character C when it sees the key [C] where C is the character (the decimal repersentation) of the unicode character you want.






share|improve this answer























  • Interesting, thanks. I'm curious what the difference between a vector and the equivalent keyboard macro is. There are a few ascii codes that are used to represent modified numbers. ±²³´µ¶·¸¹° are used for M-1 through M-0, but this only effects keyboard macros, not vectors, as your solution demonstrates.
    – Tyler
    Dec 21 '18 at 21:14






  • 1




    I think what is happening is that M- is still thought of as changing one bit (presumably adding 128) to the ascii code for 1,2 etc. So it is that the keyboard macro "±" is interpreted as "M-1".
    – Aidan Schofield
    Dec 21 '18 at 21:31










  • that looks right, and applies to other characters too - the symbol î is ascii 238, or 110 + 128. n is ascii 110, so trying to use the keyboard macro "î" fails too - presumably because Emacs uses that code to represent M-n.
    – Tyler
    Dec 21 '18 at 21:42










  • Here's confirmation from Eli Z: debbugs.gnu.org/cgi/bugreport.cgi?bug=33829#11 I guess this is obvious to people who know which characters are single bytes and which are multibytes ;)
    – Tyler
    Dec 21 '18 at 21:45












  • Thanks Tyler for that reference.
    – Aidan Schofield
    Dec 21 '18 at 21:47














4












4








4






You can get what you want with



(global-set-key (kbd "C-c m") [177])


or if you prefer



(global-set-key (kbd "C-c m") [?±])


Another solution uses the package key-chord which allows you to assign commands to keys pressed simultaneously. After you have installed it, you can define



(key-chord-define-global "-=" [177])


and then pressing "-" and "=" at the same time does what you want.



Using vectors to represent unicode characters seems to be more reliable than keyboard macros. Emacs calls self-insert-command on the character C when it sees the key [C] where C is the character (the decimal repersentation) of the unicode character you want.






share|improve this answer














You can get what you want with



(global-set-key (kbd "C-c m") [177])


or if you prefer



(global-set-key (kbd "C-c m") [?±])


Another solution uses the package key-chord which allows you to assign commands to keys pressed simultaneously. After you have installed it, you can define



(key-chord-define-global "-=" [177])


and then pressing "-" and "=" at the same time does what you want.



Using vectors to represent unicode characters seems to be more reliable than keyboard macros. Emacs calls self-insert-command on the character C when it sees the key [C] where C is the character (the decimal repersentation) of the unicode character you want.







share|improve this answer














share|improve this answer



share|improve this answer








edited Dec 22 '18 at 9:54

























answered Dec 21 '18 at 20:15









Aidan Schofield

513




513












  • Interesting, thanks. I'm curious what the difference between a vector and the equivalent keyboard macro is. There are a few ascii codes that are used to represent modified numbers. ±²³´µ¶·¸¹° are used for M-1 through M-0, but this only effects keyboard macros, not vectors, as your solution demonstrates.
    – Tyler
    Dec 21 '18 at 21:14






  • 1




    I think what is happening is that M- is still thought of as changing one bit (presumably adding 128) to the ascii code for 1,2 etc. So it is that the keyboard macro "±" is interpreted as "M-1".
    – Aidan Schofield
    Dec 21 '18 at 21:31










  • that looks right, and applies to other characters too - the symbol î is ascii 238, or 110 + 128. n is ascii 110, so trying to use the keyboard macro "î" fails too - presumably because Emacs uses that code to represent M-n.
    – Tyler
    Dec 21 '18 at 21:42










  • Here's confirmation from Eli Z: debbugs.gnu.org/cgi/bugreport.cgi?bug=33829#11 I guess this is obvious to people who know which characters are single bytes and which are multibytes ;)
    – Tyler
    Dec 21 '18 at 21:45












  • Thanks Tyler for that reference.
    – Aidan Schofield
    Dec 21 '18 at 21:47


















  • Interesting, thanks. I'm curious what the difference between a vector and the equivalent keyboard macro is. There are a few ascii codes that are used to represent modified numbers. ±²³´µ¶·¸¹° are used for M-1 through M-0, but this only effects keyboard macros, not vectors, as your solution demonstrates.
    – Tyler
    Dec 21 '18 at 21:14






  • 1




    I think what is happening is that M- is still thought of as changing one bit (presumably adding 128) to the ascii code for 1,2 etc. So it is that the keyboard macro "±" is interpreted as "M-1".
    – Aidan Schofield
    Dec 21 '18 at 21:31










  • that looks right, and applies to other characters too - the symbol î is ascii 238, or 110 + 128. n is ascii 110, so trying to use the keyboard macro "î" fails too - presumably because Emacs uses that code to represent M-n.
    – Tyler
    Dec 21 '18 at 21:42










  • Here's confirmation from Eli Z: debbugs.gnu.org/cgi/bugreport.cgi?bug=33829#11 I guess this is obvious to people who know which characters are single bytes and which are multibytes ;)
    – Tyler
    Dec 21 '18 at 21:45












  • Thanks Tyler for that reference.
    – Aidan Schofield
    Dec 21 '18 at 21:47
















Interesting, thanks. I'm curious what the difference between a vector and the equivalent keyboard macro is. There are a few ascii codes that are used to represent modified numbers. ±²³´µ¶·¸¹° are used for M-1 through M-0, but this only effects keyboard macros, not vectors, as your solution demonstrates.
– Tyler
Dec 21 '18 at 21:14




Interesting, thanks. I'm curious what the difference between a vector and the equivalent keyboard macro is. There are a few ascii codes that are used to represent modified numbers. ±²³´µ¶·¸¹° are used for M-1 through M-0, but this only effects keyboard macros, not vectors, as your solution demonstrates.
– Tyler
Dec 21 '18 at 21:14




1




1




I think what is happening is that M- is still thought of as changing one bit (presumably adding 128) to the ascii code for 1,2 etc. So it is that the keyboard macro "±" is interpreted as "M-1".
– Aidan Schofield
Dec 21 '18 at 21:31




I think what is happening is that M- is still thought of as changing one bit (presumably adding 128) to the ascii code for 1,2 etc. So it is that the keyboard macro "±" is interpreted as "M-1".
– Aidan Schofield
Dec 21 '18 at 21:31












that looks right, and applies to other characters too - the symbol î is ascii 238, or 110 + 128. n is ascii 110, so trying to use the keyboard macro "î" fails too - presumably because Emacs uses that code to represent M-n.
– Tyler
Dec 21 '18 at 21:42




that looks right, and applies to other characters too - the symbol î is ascii 238, or 110 + 128. n is ascii 110, so trying to use the keyboard macro "î" fails too - presumably because Emacs uses that code to represent M-n.
– Tyler
Dec 21 '18 at 21:42












Here's confirmation from Eli Z: debbugs.gnu.org/cgi/bugreport.cgi?bug=33829#11 I guess this is obvious to people who know which characters are single bytes and which are multibytes ;)
– Tyler
Dec 21 '18 at 21:45






Here's confirmation from Eli Z: debbugs.gnu.org/cgi/bugreport.cgi?bug=33829#11 I guess this is obvious to people who know which characters are single bytes and which are multibytes ;)
– Tyler
Dec 21 '18 at 21:45














Thanks Tyler for that reference.
– Aidan Schofield
Dec 21 '18 at 21:47




Thanks Tyler for that reference.
– Aidan Schofield
Dec 21 '18 at 21:47


















draft saved

draft discarded




















































Thanks for contributing an answer to Emacs Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f46713%2finserting-the-plus-minus-unicode-symbol-%25c2%25b1-as-a-keyboard-macro%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Morgemoulin

Scott Moir

Souastre