From: Noam Postavsky <npostavs@gmail.com>
To: Amai Kinono <amaikinono@gmail.com>
Cc: 37452@debbugs.gnu.org
Subject: bug#37452: 26.3; skip-syntax-forward doesn't work in python-mode
Date: Wed, 18 Sep 2019 18:37:39 -0400 [thread overview]
Message-ID: <877e659qoc.fsf@gmail.com> (raw)
In-Reply-To: <CAPu3fz0hF0POJH7dXGWxRxt2MR7bpPQzUykDTtTCm7FGa=bOPg@mail.gmail.com> (Amai Kinono's message of "Thu, 19 Sep 2019 03:07:48 +0800")
Amai Kinono <amaikinono@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).
next prev parent reply other threads:[~2019-09-18 22:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-18 19:07 bug#37452: 26.3; skip-syntax-forward doesn't work in python-mode Amai Kinono
2019-09-18 22:37 ` Noam Postavsky [this message]
[not found] ` <CAPu3fz1rsjqMTg73u7SA33so0Zq4OWU_TZ-V8TJ2DwWs4WjGdw@mail.gmail.com>
2019-09-22 13:37 ` bug#37452: Fwd: " Amai Kinono
2021-06-15 14:51 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877e659qoc.fsf@gmail.com \
--to=npostavs@gmail.com \
--cc=37452@debbugs.gnu.org \
--cc=amaikinono@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).