GNU bug report logs - #41522
26.3; Narrowing can prevent syntax propertization

Previous Next

Package: emacs;

Reported by: Ikumi Keita <ikumi <at> ikumi.que.jp>

Date: Mon, 25 May 2020 08:43:02 UTC

Severity: normal

Found in version 26.3

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


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

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 41522 <at> debbugs.gnu.org
Subject: Re: bug#41522: 26.3; Narrowing can prevent syntax propertization
Date: Tue, 26 May 2020 02:02:15 +0900
Hi Dmitry, thanks for your reply.

>>>>> Dmitry Gutov <dgutov <at> yandex.ru> writes:
> Our current stance on the matter is that, in the simple case, code
> should call syntax-ppss from "widened" state.

I suppose that this means that the code should call syntax-ppss (or
something like it) "before" narrowing is done, right? This code works
for me
----------------------------------------------------------------------
(progn (goto-char (point-max))
       (syntax-propertize (point)) ; <-
       (narrow-to-region (point) (- (point) 50))
       (syntax-ppss)
       (widen))
----------------------------------------------------------------------
while these don't:
----------------------------------------------------------------------
(progn (goto-char (point-max))
       (narrow-to-region (point) (- (point) 50))
       (syntax-ppss)
       (widen)
       (syntax-ppss) ; <-
)
----------------------------------------------------------------------
----------------------------------------------------------------------
(progn (goto-char (point-max))
       (narrow-to-region (point) (- (point) 50))
       (syntax-ppss)
       (widen)
       (syntax-propertize (point)) ; <-
)
----------------------------------------------------------------------

> And the code which doesn't should be fixed. Or if it really need to do
> that (for some reason), it should take care to handle any undesired
> sife-effects itself.

Hmm, then elisp programmers have to check whether each function used in
the code uses narrowing+syntactic functions inside it if this kind of
problem happens. I feel it a bit troublesome but at the same time I
understand it is very difficult to solve this problem cleanly.

OK, I try to be aware of this matter afterwards. Thanks for your
advice!

Regards,
Ikumi Keita




This bug report was last modified 5 years ago.

Previous Next


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