GNU bug report logs - #37452
26.3; skip-syntax-forward doesn't work in python-mode

Previous Next

Package: emacs;

Reported by: Amai Kinono <amaikinono <at> gmail.com>

Date: Wed, 18 Sep 2019 20:20:02 UTC

Severity: normal

Found in version 26.3

Fixed in version 28.1

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Amai Kinono <amaikinono <at> gmail.com>
To: 37452 <at> debbugs.gnu.org
Subject: bug#37452: Fwd: bug#37452: 26.3; skip-syntax-forward doesn't work in python-mode
Date: Sun, 22 Sep 2019 21:37:45 +0800
[Message part 1 (text/plain, inline)]
---------- Forwarded message ---------
发件人: Amai Kinono <amaikinono <at> gmail.com>
Date: 2019年9月20日周五 下午9:39
Subject: Re: bug#37452: 26.3; skip-syntax-forward doesn't work in
python-mode
To: Noam Postavsky <npostavs <at> gmail.com>


I just found that the `forward-same-syntax` command in subr.el did the same
thing, so it doesn't work in my example too. Maybe this should be fixed?

Noam Postavsky <npostavs <at> gmail.com> 于2019年9月19日周四 上午6:37写道:

> Amai Kinono <amaikinono <at> gmail.com> writes:
>
> >   (defun skip-syntax ()
> >     (interactive)
> >     (skip-syntax-forward (char-to-string (char-syntax (char-after)))))
>
> If you look at char-syntax's docstring, you should see
>
>     If you’re trying to determine the syntax of characters in the buffer,
>     this is probably the wrong function to use, because it can’t take
>     ‘syntax-table’ text properties into account.  Consider using
>     ‘syntax-after’ instead.
>
> Which is exactly the situation you've encountered here: python-mode sets
> the syntax of the quote to string fence ("|") using a text property.
> This version of skip-syntax should work:
>
> (defun syntax-class-to-char (syntax-class)
>   (aref " .w_()'\"$\\/<>@!|" syntax-class))
>
> (defun skip-syntax ()
>   (interactive)
>   (skip-syntax-forward (char-to-string
>                         (syntax-class-to-char
>                          (syntax-class (syntax-after (point)))))))
>
> Although I'd say that the function syntax-class-to-char should be added
> to Emacs (in syntax.c, so that it can reuse syntax_code_spec).
>
[Message part 2 (text/html, inline)]

This bug report was last modified 4 years and 27 days ago.

Previous Next


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