From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Dima Kogan <dima@secretsauce.net>
Cc: "Štěpán Němec" <stepnem@gmail.com>, 40702@debbugs.gnu.org
Subject: bug#40702: 28.0.50; (what-cursor-position) barfs on non-ASCII char
Date: Sun, 19 Apr 2020 12:44:33 -0400 [thread overview]
Message-ID: <jwvy2qr4f4w.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87pnc4tox6.fsf@secretsauce.net> (Dima Kogan's message of "Sat, 18 Apr 2020 15:22:13 -0700")
>> I can't reproduce this on current master
> Thanks for checking. It's very consistent on my end. I poked at it a
> little bit just now.
> I see that buffer-file-coding-system is nil
It would be worth looking into how/why you get a nil value here.
> It ends up evaluating
> (encoded-string-description "é" nil)
This seems to point to a bug in `encode-coding-char`:
M-: (encode-coding-char ?\é nil) RET
returns "é" which is not a unibyte string and hence is not a valid
encoded string. Note that
M-: (encode-coding-char ?\é 'no-conversion) RET
does not suffer from the same problem. This comes from
`encode-coding-string` which also returns a multibyte string when its
coding arg is nil.
I'm not sure if `encode-coding-string/char` should accept a nil argument
nor how it should treat it, so maybe it's a bug in `what-char-position`
which should not pass a nil argument here. So maybe the patch below
is a good fix?
Stefan
diff --git a/lisp/simple.el b/lisp/simple.el
index 8bc84a9dfa..e5180119e8 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1470,7 +1470,11 @@ what-cursor-position
encoded encoding-msg display-prop under-display)
(if (or (not coding)
(eq (coding-system-type coding) t))
- (setq coding (default-value 'buffer-file-coding-system)))
+ (setq coding (or (default-value 'buffer-file-coding-system)
+ ;; A nil value of `buffer-file-coding-system'
+ ;; means "no conversion" which means each byte
+ ;; is a char and vice versa.
+ 'binary)))
(if (eq (char-charset char) 'eight-bit)
(setq encoding-msg
(format "(%d, #o%o, #x%x%s, raw-byte)" char char char char-name-fmt))
next prev parent reply other threads:[~2020-04-19 16:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-18 21:27 bug#40702: 28.0.50; (what-cursor-position) barfs on non-ASCII char Dima Kogan
2020-04-18 21:53 ` Štěpán Němec
2020-04-18 22:22 ` Dima Kogan
2020-04-19 13:02 ` Štěpán Němec
2020-04-19 15:22 ` Eli Zaretskii
2020-04-19 16:18 ` Štěpán Němec
2020-04-19 16:50 ` Eli Zaretskii
2020-04-19 19:39 ` Štěpán Němec
2020-04-19 16:44 ` Stefan Monnier [this message]
2020-04-20 4:16 ` Dima Kogan
2020-04-20 13:27 ` Stefan Monnier
2020-04-20 21:44 ` Dima Kogan
2020-09-30 3:45 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvy2qr4f4w.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=40702@debbugs.gnu.org \
--cc=dima@secretsauce.net \
--cc=stepnem@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.