unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Amai Kinono <amaikinono@gmail.com>
To: 37452@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	[thread overview]
Message-ID: <CAPu3fz2+3OqJ8LSDYtyCYP7R===hFiZGchz8_aLdPa5FRKW6bw@mail.gmail.com> (raw)
In-Reply-To: <CAPu3fz1rsjqMTg73u7SA33so0Zq4OWU_TZ-V8TJ2DwWs4WjGdw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1641 bytes --]

---------- Forwarded message ---------
发件人: Amai Kinono <amaikinono@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@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@gmail.com> 于2019年9月19日周四 上午6:37写道:

> 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).
>

[-- Attachment #2: Type: text/html, Size: 2443 bytes --]

  parent reply	other threads:[~2019-09-22 13: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
     [not found]   ` <CAPu3fz1rsjqMTg73u7SA33so0Zq4OWU_TZ-V8TJ2DwWs4WjGdw@mail.gmail.com>
2019-09-22 13:37     ` Amai Kinono [this message]
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='CAPu3fz2+3OqJ8LSDYtyCYP7R===hFiZGchz8_aLdPa5FRKW6bw@mail.gmail.com' \
    --to=amaikinono@gmail.com \
    --cc=37452@debbugs.gnu.org \
    /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).