GNU bug report logs - #22765
Missing interfaces for syntax of characters in buffers.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Mon, 22 Feb 2016 11:10:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 22765 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#22765; Package emacs. (Mon, 22 Feb 2016 11:10:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alan Mackenzie <acm <at> muc.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 22 Feb 2016 11:10:02 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Missing interfaces for syntax of characters in buffers.
Date: Mon, 22 Feb 2016 11:12:12 +0000
Hello, Emacs.

In all versions of Emacs to date, we are missing an interface to return
the syntax of a character in a buffer in a "nice" form.  By a "nice"
form, I mean the characters ?\ , ?., ?w, ?\(, ?\), etc., which programs
should be able to use.

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.

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.

This would greatly aid in the conversion of these old `char-syntax'
calls.

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22765; Package emacs. (Thu, 06 Apr 2017 00:43:01 GMT) Full text and rfc822 format available.

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

From: npostavs <at> users.sourceforge.net
To: Alan Mackenzie <acm <at> muc.de>
Cc: 22765 <at> debbugs.gnu.org
Subject: Re: bug#22765: Missing interfaces for syntax of characters in buffers.
Date: Wed, 05 Apr 2017 20:43:44 -0400
Alan Mackenzie <acm <at> muc.de> 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 "(")))




This bug report was last modified 8 years and 71 days ago.

Previous Next


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