Discussion:
numbers instead of accented letters...
Jean-Christophe Helary
2018-11-25 02:55:02 UTC
Permalink
What have I possibly done to have my .emacs.el display number sequences instead of accented letters ?

I just noticed that a few days ago...

for ex:

;; pour h\303\251riter du $PATH quand Emacs est lanc\303\251 hors de la ligne de commande

Also, it is not only a display issue, when I type such accented sequences I can only see the number sequences...

Other files (normal text files, etc.) are not affected by this behavior.

To make sure that I use UTF-8 everywhere I have this code:

;; UTF-8
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(when (display-graphic-p)
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))

It must be something trivial but I have no idea where to start.


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune
Eli Zaretskii
2018-11-25 03:38:48 UTC
Permalink
Date: Sun, 25 Nov 2018 11:55:02 +0900
What have I possibly done to have my .emacs.el display number sequences instead of accented letters ?
I just noticed that a few days ago...
;; pour h\303\251riter du $PATH quand Emacs est lanc\303\251 hors de la ligne de commande
Also, it is not only a display issue, when I type such accented sequences I can only see the number sequences...
Other files (normal text files, etc.) are not affected by this behavior.
;; UTF-8
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(when (display-graphic-p)
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))
On what OS is that?

Also, what other non-ASCII characters do you have in your .emacs.el?
(You can search for them with "N-: (skip-chars-forward "\000-\177") RET.)

And if you remove all of the above settings, does the problem go away?
Jean-Christophe Helary
2018-11-25 04:22:41 UTC
Permalink
Post by Eli Zaretskii
Date: Sun, 25 Nov 2018 11:55:02 +0900
What have I possibly done to have my .emacs.el display number sequences instead of accented letters ?
I just noticed that a few days ago...
;; pour h\303\251riter du $PATH quand Emacs est lanc\303\251 hors de la ligne de commande
Also, it is not only a display issue, when I type such accented sequences I can only see the number sequences...
Other files (normal text files, etc.) are not affected by this behavior.
;; UTF-8
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(when (display-graphic-p)
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))
On what OS is that?
macOS
Post by Eli Zaretskii
Also, what other non-ASCII characters do you have in your .emacs.el?
Most of my comments are written in French so there are a few others.
Post by Eli Zaretskii
(You can search for them with "N-: (skip-chars-forward "\000-\177") RET.)
And if you remove all of the above settings, does the problem go away?
I commented out the code and relaunched emacs. I get the same weird behavior in .emacs.el but not in other buffers (not even *scratch*)

Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune
Eli Zaretskii
2018-11-25 16:21:16 UTC
Permalink
Date: Sun, 25 Nov 2018 13:22:41 +0900
Post by Eli Zaretskii
Post by Jean-Christophe Helary
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(when (display-graphic-p)
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))
On what OS is that?
macOS
Then I'm not sure the above is right, and you should remove that.
Although it doesn't seem to be the root cause of your problem.
Post by Eli Zaretskii
Also, what other non-ASCII characters do you have in your .emacs.el?
Most of my comments are written in French so there are a few others.
I think you will have to review all of them. Look for those which are
shown as a single octal escape, not 2 octal escapes one after the
other.

If nothing else help, bisect your .emacs.el to find the part which
causes this, and if looking at it doesn't provide a clue, post that
part here.
Jean-Christophe Helary
2018-11-25 16:42:29 UTC
Permalink
Post by Eli Zaretskii
Post by Jean-Christophe Helary
Most of my comments are written in French so there are a few others.
I think you will have to review all of them. Look for those which are
shown as a single octal escape, not 2 octal escapes one after the
other.
If nothing else help, bisect your .emacs.el to find the part which
causes this, and if looking at it doesn't provide a clue, post that
part here.
I will.

Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune
Jean-Christophe Helary
2018-11-26 08:09:01 UTC
Permalink
Post by Eli Zaretskii
Post by Jean-Christophe Helary
Post by Eli Zaretskii
Also, what other non-ASCII characters do you have in your .emacs.el?
Most of my comments are written in French so there are a few others.
I think you will have to review all of them. Look for those which are
shown as a single octal escape, not 2 octal escapes one after the
other.
Now that you mention that, yesterday, when I received your mail, the 2 octal escapes that I used to see where transformed into 1 octal escape *and* I was able to enter accented letters. Then everything reverted to the messy state it was when I wrote (2 octal escapes + no input possible).

Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com <http://mac4translators.blogspot.com/> @brandelune
Stefan Monnier
2018-11-25 16:56:42 UTC
Permalink
Post by Jean-Christophe Helary
;; pour h\303\251riter du $PATH quand Emacs est lanc\303\251 hors de la ligne de commande
Do you also see it if you open the file with `emacs -Q`?
If so, try the following:

emacs -Q ~/.emacs.el
C-x RET r utf-8 RET

this should re-read the file, but forcing Emacs to interpret it as utf-8,
so presumably, "hériter" should now appear correctly. Also the left part of
the mode-line should say "U" to mean.
If that's indeed, the case, then try to save the file (after making
a trivial modification to it like `SPC DEL`).

If this works without complaint, check the "U" in the mode-line: is it
still there?


Stefan
Jean-Christophe Helary
2018-11-26 07:22:20 UTC
Permalink
On Nov 26, 2018, at 1:56, Stefan Monnier <[1]***@iro.umontreal.ca>
wrote:

;; pour h\303\251riter du $PATH quand Emacs est lanc\303\251 hors de
la ligne de commande

Do you also see it if you open the file with `emacs -Q`?
If so, try the following:
emacs -Q ~/.emacs.el
C-x RET r utf-8 RET
this should re-read the file, but forcing Emacs to interpret it as
utf-8,
so presumably, "heriter" should now appear correctly. Also the left
part of
the mode-line should say "U" to mean.
If that's indeed, the case, then try to save the file (after making
a trivial modification to it like `SPC DEL`).
If this works without complaint, check the "U" in the mode-line: is it
still there?

Everything worked as you said and indeed the U is still there.
When I first open the file I get an = where the U should be.
(emacs manual: "`=' means no conversion whatsoever, and is usually used
for files containing non-textual data"...)
So, should I interpret that as emacs is, for some reason, not using
UTF-8 to read the file ?
Jean-Christophe Helary
-----------------------------------------------
[2]http://mac4translators.blogspot.com @brandelune

References

1. mailto:***@iro.umontreal.ca
2. http://mac4translators.blogspot.com/
Jean-Christophe Helary
2018-11-26 08:10:01 UTC
Permalink
Post by Stefan Monnier
Post by Jean-Christophe Helary
;; pour h\303\251riter du $PATH quand Emacs est lanc\303\251 hors de la ligne de commande
Do you also see it if you open the file with `emacs -Q`?
emacs -Q ~/.emacs.el
C-x RET r utf-8 RET
this should re-read the file, but forcing Emacs to interpret it as utf-8,
so presumably, "hériter" should now appear correctly. Also the left part of
the mode-line should say "U" to mean.
If that's indeed, the case, then try to save the file (after making
a trivial modification to it like `SPC DEL`).
If this works without complaint, check the "U" in the mode-line: is it
still there?
Everything worked as you said and indeed the U is still there.

When I first open the file I get an = where the U should be.

(emacs manual: "‘=’ means no conversion whatsoever, and is usually used for files containing non-textual data"...)

So, should I interpret that as emacs is, for some reason, not using UTF-8 to read the file ?


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com <http://mac4translators.blogspot.com/> @brandelune
Stefan Monnier
2018-11-26 13:20:51 UTC
Permalink
Post by Jean-Christophe Helary
Post by Stefan Monnier
If this works without complaint, check the "U" in the mode-line: is it
still there?
Everything worked as you said and indeed the U is still there.
And if you now try `emacs -Q ~/.emacs.el` anew, you again see the \NNN
and the "=" in the modeline?

Does the file have file-local variables as in

-*- ... -*-

on the first line or

Local Variables:
...
End:

on the last few lines?
Post by Jean-Christophe Helary
So, should I interpret that as Emacs is, for some reason, not using
UTF-8 to read the file ?
Yes, the `=` means that Emacs decided that this file should be treated
as binary data rather than utf-8 text, basically.

Could you also try to search for a 0-byte? E.g. with

C-s C-q 0 C-s C-s

?


Stefan
Jean-Christophe Helary
2018-11-26 14:09:48 UTC
Permalink
Post by Stefan Monnier
Post by Jean-Christophe Helary
Post by Stefan Monnier
If this works without complaint, check the "U" in the mode-line: is it
still there?
Everything worked as you said and indeed the U is still there.
And if you now try `emacs -Q ~/.emacs.el` anew, you again see the \NNN
and the "=" in the modeline?
That's correct.
Post by Stefan Monnier
Does the file have file-local variables as in
-*- ... -*-
on the first line or
I have the blurb added by Package.el at the top:

; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
Post by Stefan Monnier
...
on the last few lines?
And custom-set-faces at the end.
Post by Stefan Monnier
Post by Jean-Christophe Helary
So, should I interpret that as Emacs is, for some reason, not using
UTF-8 to read the file ?
Yes, the `=` means that Emacs decided that this file should be treated
as binary data rather than utf-8 text, basically.
Could you also try to search for a 0-byte? E.g. with
C-s C-q 0 C-s C-s
?
I have one. I created a keyboard macro the other day to have Cmd+A do a (home made) select all, because I did not know that emacs had a select-all command already. The macro is:

;;; Select All : Cmd+A (Meta+A)
(fset 'selectAll
(lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item '("\274^@\276" 0 "%d") arg)))
(global-set-key (kbd "M-a") 'selectAll)

If I remove that code, the file behaves properly...


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune
Stefan Monnier
2018-11-26 14:20:12 UTC
Permalink
Post by Jean-Christophe Helary
;;; Select All : Cmd+A (Meta+A)
(fset 'selectAll
(lambda (&optional arg) "Keyboard macro." (interactive "p")
(global-set-key (kbd "M-a") 'selectAll)
If I remove that code, the file behaves properly...
Aha!

Then the fix for you is to write \0 instead of the 0 byte:

(kmacro-exec-ring-item '("\274^@\0\276" 0 "%d") arg)))

Now, could you open a bug report about that: creating a keyboard macro
shouldn't cause that kind of trouble!


Stefan
Jean-Christophe Helary
2018-11-26 14:46:21 UTC
Permalink
Post by Stefan Monnier
Post by Jean-Christophe Helary
;;; Select All : Cmd+A (Meta+A)
(fset 'selectAll
(lambda (&optional arg) "Keyboard macro." (interactive "p")
(global-set-key (kbd "M-a") 'selectAll)
If I remove that code, the file behaves properly...
Aha!
Now, could you open a bug report about that: creating a keyboard macro
shouldn't cause that kind of trouble!
:) Yep, that's what I thought too. Although I'll also probably just remap mark-whole-buffer to Cmd-A.


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune

Continue reading on narkive:
Loading...