From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#40702: 28.0.50; (what-cursor-position) barfs on non-ASCII char Date: Sun, 19 Apr 2020 12:44:33 -0400 Message-ID: References: <87r1wktrg4.fsf@shorty.i-did-not-set--mail-host-address--so-tickle-me> <87lfms5ul0.fsf@gmail.com> <87pnc4tox6.fsf@secretsauce.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="22445"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= , 40702@debbugs.gnu.org To: Dima Kogan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 19 18:45:15 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jQD4E-0005hC-Eo for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Apr 2020 18:45:14 +0200 Original-Received: from localhost ([::1]:44200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQD4D-0007a0-BA for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Apr 2020 12:45:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45134 helo=eggs1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQD43-0007XS-0B for bug-gnu-emacs@gnu.org; Sun, 19 Apr 2020 12:45:03 -0400 Original-Received: from Debian-exim by eggs1p.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jQD42-00072T-H1 for bug-gnu-emacs@gnu.org; Sun, 19 Apr 2020 12:45:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34231) by eggs1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jQD42-00072H-4C for bug-gnu-emacs@gnu.org; Sun, 19 Apr 2020 12:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jQD41-0002aE-WD for bug-gnu-emacs@gnu.org; Sun, 19 Apr 2020 12:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Apr 2020 16:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40702 X-GNU-PR-Package: emacs Original-Received: via spool by 40702-submit@debbugs.gnu.org id=B40702.15873146859893 (code B ref 40702); Sun, 19 Apr 2020 16:45:01 +0000 Original-Received: (at 40702) by debbugs.gnu.org; 19 Apr 2020 16:44:45 +0000 Original-Received: from localhost ([127.0.0.1]:45777 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jQD3k-0002ZV-OG for submit@debbugs.gnu.org; Sun, 19 Apr 2020 12:44:45 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:27078) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jQD3i-0002ZG-SC for 40702@debbugs.gnu.org; Sun, 19 Apr 2020 12:44:43 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 54B2A450223; Sun, 19 Apr 2020 12:44:37 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id DE9C44501F7; Sun, 19 Apr 2020 12:44:34 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1587314674; bh=9Y5r+v1cOx9cRvkipWSJbMFD7EyyfoOYw1UmYloyz4w=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Hgn9+8dAQfV1sH5Eb0Wo9dxyOoTUV83SC/Lo/+MyWT08aaYGSBejm7Ex0UUhdfwyb bKA4Sual1IYWCTfs3/8yeieinZ7W1DxvrHpPR/llSK2DpGP/XO5+98BNJZY6BqGICh snK1nloywClfIMcE25Vyu4qOImvCU0UDi0fI9oFs5Y6StHzFKwJHmMYETIaL8LR6Ab myjvgg11D7zThmMCjMsEYetmFfFRu4puL+xtDjpnj09pDdWtU2xBPnpQw7oOLBwPSW Q04t3M77RDbnsn4G/53amHpANQqMtiFATfFENZwcSjv500RC/+IdHhKhD4Nl2CiV7D 25PWRdT7JvoqA== Original-Received: from alfajor (unknown [104.247.241.114]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 88C4E1201B0; Sun, 19 Apr 2020 12:44:34 -0400 (EDT) In-Reply-To: <87pnc4tox6.fsf@secretsauce.net> (Dima Kogan's message of "Sat, 18 Apr 2020 15:22:13 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:178653 Archived-At: >> 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 "=E9" nil) This seems to point to a bug in `encode-coding-char`: M-: (encode-coding-char ?\=E9 nil) RET returns "=E9" which is not a unibyte string and hence is not a valid encoded string. Note that M-: (encode-coding-char ?\=E9 '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))