From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Phil Sainty Newsgroups: gmane.emacs.bugs Subject: bug#50646: 28.0.50; narrow-to-defun sometimes narrows to wrong defun Date: Sun, 19 Sep 2021 22:56:03 +1200 Message-ID: References: <3a6fa91859db00e5c382752ddedfbdd0@webmail.orcon.net.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14887"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Orcon Webmail Cc: 50646@debbugs.gnu.org To: Arthur Miller Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 19 12:57:26 2021 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 1mRuVi-0003eV-RZ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Sep 2021 12:57:26 +0200 Original-Received: from localhost ([::1]:57984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRuVb-0001he-Se for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Sep 2021 06:57:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRuVK-0001hW-5X for bug-gnu-emacs@gnu.org; Sun, 19 Sep 2021 06:57:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54232) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRuVJ-00075N-Th for bug-gnu-emacs@gnu.org; Sun, 19 Sep 2021 06:57:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mRuVJ-0001V0-RW for bug-gnu-emacs@gnu.org; Sun, 19 Sep 2021 06:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Sep 2021 10:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50646 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 50646-submit@debbugs.gnu.org id=B50646.16320489715696 (code B ref 50646); Sun, 19 Sep 2021 10:57:01 +0000 Original-Received: (at 50646) by debbugs.gnu.org; 19 Sep 2021 10:56:11 +0000 Original-Received: from localhost ([127.0.0.1]:37545 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mRuUV-0001To-4O for submit@debbugs.gnu.org; Sun, 19 Sep 2021 06:56:11 -0400 Original-Received: from smtp-1.orcon.net.nz ([60.234.4.34]:46925) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mRuUP-0001Tb-NT for 50646@debbugs.gnu.org; Sun, 19 Sep 2021 06:56:09 -0400 Original-Received: from [10.253.37.70] (port=48121 helo=webmail.orcon.net.nz) by smtp-1.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1mRuUO-0003QP-14; Sun, 19 Sep 2021 22:56:04 +1200 Original-Received: from ip-203-94-48-127.kinect.net.nz ([203.94.48.127]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Sun, 19 Sep 2021 22:56:03 +1200 In-Reply-To: X-Sender: psainty@orcon.net.nz X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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:214701 Archived-At: On 2021-09-19 18:36, Arthur Miller wrote: > My question is though, why it happens only with 'when'? I haven't > found any other form to show same behaviour. There probably are > some, I just haven't found them by manually testing. Now that you've narrowed this down to a code conversion issue, that part was simple to debug (by comparing the buffer in its literal and non-literal forms), and the reason is that subr.el contains multi-byte characters. This included a documentation bug, as the docstring for `setq-local' had this paragraph in the source: The second VALUE is not computed until after the first VARIABLE is set, and so on; each VALUE can use the new value of variables set earlier in the ‘setq-local’. The return value of the ‘setq-local’ form is the value of the last VALUE. Note the incorrect unicode quote characters. I've just pushed a fix for that, but there's also a more intentional INVERTED EXCLAMATION MARK unicode character in one of the comments, though, and I've left this alone. ;; ¡Beware! when I tried to edebug this code, Emacs got into a weird state ;; where all the keys were unbound (i.e. it somehow got triggered ;; within read-key, apparently). I had to kill it. In short, you don't want to be making assumptions about the encoding of elisp files. Tangentially, the commit message related to those quote characters says "expand the doc string by taking some text from `setq'", so I believe those fancy unicode quote characters were accidentally copied and pasted from a *Help* buffer rendering of the `setq' docstring. I think it's a good idea to set `text-quoting-style' to 'grave to ensure that can never happen. -Phil