GNU bug report logs - #50646
28.0.50; narrow-to-defun sometimes narrows to wrong defun

Previous Next

Package: emacs;

Reported by: arthur.miller <at> live.com

Date: Fri, 17 Sep 2021 17:07:02 UTC

Severity: normal

Tags: moreinfo

Found in version 28.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #34 received at 50646 <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: Arthur Miller <arthur.miller <at> live.com>
Cc: 50646 <at> debbugs.gnu.org
Subject: Re: bug#50646: 28.0.50; narrow-to-defun sometimes narrows to wrong
 defun
Date: Sun, 19 Sep 2021 22:56:03 +1200
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





This bug report was last modified 3 years and 329 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.