bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22765: Missing interfaces for syntax of characters in buffers.


From: npostavs
Subject: bug#22765: Missing interfaces for syntax of characters in buffers.
Date: Wed, 05 Apr 2017 20:43:44 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Alan Mackenzie <address@hidden> writes:

> We have `char-syntax', but that takes no account of syntax-table text
> properties which might be on a buffer position, and so shouldn't really
> be used any more in buffers.  There are still around 160 uses of
> `char-syntax' in our sources.

I'm afraid I added another one in my recent `indent-sexp' changes.  We
should at least add a warning about this to the docstring.

> We have `syntax-after', but this returns a raw syntax descriptor (like
> (4 . 41)), and we have no means of extracting ?\( from this.
>
> I propose adding the two functions `syntax-class-to-char' which would
> convert 4 to ?\(, and `char-syntax-after', which would return ?\(
> directly, given a buffer position with such a character under it.

We do have string-to-syntax which can be used to convert in the other
direction, although code using it would end up a bit more verbose.

    (eq (char-syntax-after POS) ?\()
vs
    (eq (syntax-class (syntax-after POS)) (car (string-to-syntax "(")))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]