Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recommended outline-minor-mode-prefix creates Pound Sterling in Emacs 26.2 #69

Open
GregDavidson opened this issue Jun 12, 2019 · 1 comment

Comments

@GregDavidson
Copy link

When I use the recommended
(defvar outline-minor-mode-prefix "\M-#")
I discover that outline-minor-mode-prefix is "£" (British pound sterling symbol) which string-bytes says is a 1-byte string! This was a surprise to me and is also interfering with my using outshine commands. I'm using Emacs 26.2 and I am not familiar with whatever exotic feature I've stumbled upon! If I double the backslash I then get a 4-byte string starting with a literal backslash - is this what is desired for Outshine?

@alphapapa
Copy link
Owner

Hi Greg,

This is interesting. As you may know, I'm not the author of Outshine, just the current maintainer. I had never noticed the backslash in that code.

In my own config, I have the same code, which is in the :config section of a (use-package outshine form. After starting Emacs, I evaluated this code with the results in comments (on Emacs 26.1):

outline-minor-mode-prefix  ;;=> "�@" (GitHub renders this differently; in Emacs, it looks like "^C@")

(defvar outline-minor-mode-prefix "\M-#")  ;;=> outline-minor-mode-prefix
outline-minor-mode-prefix  ;;=> "\243"

(defvar what "\M-#")
what   ;;=> "\243"

(defvar what* "M-#")
what*  ;;=> "M-#"

I see that in outline.el, outline-minor-mode-prefix is also defined, like this:

(defcustom outline-minor-mode-prefix "\C-c@"
  "Prefix key to use for Outline commands in Outline minor mode.
The value of this variable is checked as part of loading Outline mode.
After that, changing the prefix key requires manipulating keymaps."
  :type 'string
  :group 'outlines)

So the initial value of it in my config was that default value.

Of course, that variable probably shouldn't be redefined in this package. Long-term, that's something we should fix.

Anyway, about your issue: I don't know why you're seeing it as "£". Looking at the Elisp manual, section 2.3.8.3, it says:

   Properly speaking, strings cannot hold meta characters; but when a
string is to be used as a key sequence, there is a special convention
that provides a way to represent meta versions of ASCII characters in a
string.  If you use the ‘\M-’ syntax to indicate a meta character in a
string constant, this sets the 2**7 bit of the character in the string.
If the string is used in ‘define-key’ or ‘lookup-key’, this numeric code
is translated into the equivalent meta character.  *Note Character
Type::.

If I understand correctly, it could also be written with kbd without using a backslash like:

(defvar outline-minor-mode-prefix (kbd "M-#"))

I don't know of anyone else reporting a problem with this. How is it interfering with your usage? Can you reproduce it with emacs -q? Maybe there's something else in your config causing the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants