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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Alan Mackenzie <acm@HIDDEN>; dated Mon, 22 Feb 2016 11:10:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 22765 <at> debbugs.gnu.org:


Received: (at 22765) by debbugs.gnu.org; 6 Apr 2017 00:42:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 05 20:42:28 2017
Received: from localhost ([127.0.0.1]:34208 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cvvVM-0001Bn-9P
	for submit <at> debbugs.gnu.org; Wed, 05 Apr 2017 20:42:28 -0400
Received: from mail-it0-f51.google.com ([209.85.214.51]:36293)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1cvvVK-0001BQ-AW
 for 22765 <at> debbugs.gnu.org; Wed, 05 Apr 2017 20:42:27 -0400
Received: by mail-it0-f51.google.com with SMTP id e75so92846797itd.1
 for <22765 <at> debbugs.gnu.org>; Wed, 05 Apr 2017 17:42:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=yNY0nNnSKb7kh+hE6v98XQi227evdo8tVQf+ib75zk0=;
 b=e/yI7oeCSICB5Pl+BE+eugb3xEx0M8Fn6BaZ2SI0bJm29n3bXCbN4IeDNEytKcClDK
 KBtC1601yA8OJpxM70ULE8PTbQSlZVpd0tGKCAoYjz37rRtSn0Z1thMJWDeNawUS2TeC
 Tjw53alAz9YbpUhZPebP5dVuK8m4faokyJvuu07J3GuFh0M72oa9qr+LQvgvEu89bLGD
 ndycIXFWX0N6lK9pbzq5AHbQvn5/xT4CqDESPxoQxsnweZL3dWTqpdFio5ECROtANdAk
 C6pHUKiOEpwvzoYP6hDlK/i+/eQnG0a59j1QjkjCeQLm00JW67z5oMFOrOW2cxp7rqTQ
 v2lw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:from:to:cc:subject:references:date
 :in-reply-to:message-id:user-agent:mime-version;
 bh=yNY0nNnSKb7kh+hE6v98XQi227evdo8tVQf+ib75zk0=;
 b=BMQkYfKFzN+dzBbGYPMtfY82jEjXChMCWMdrN5ctgTWGB40bLditWhlJswibOeLgsu
 yFrCI3DhG4Lo/N4g8Sho9it6gSHHUG1qFMf+z2dCmwR01QFl3X7fBJb8LlBE+grj/OEs
 WBDP9C8XeP/nmeRtOEXuXTsO+N36rUSWjdb7FXiqKPMLQzngOmRVBjQjPbzdTJ8qiZt4
 eLeGj2CT+Zu6PrUYi5tw4srtKwl4uNi4WpyRH0GW7vGsJ5i3+L4QimzOb6zXPiFfXkdO
 xii+6mM4rYIYLGM+Bsr8lx41TgRQlu+Cz8UfarcgCEPTe/7r1dCGoAyw11ABbdF7ymUy
 rdug==
X-Gm-Message-State: AFeK/H2v8FfbdbfL2Bn0C5UpsWQQ/k4eRs/WrKIhwYPfOUvPo363dtWo
 omlr8rfn61TbfQ==
X-Received: by 10.36.40.81 with SMTP id h78mr23868453ith.44.1491439340608;
 Wed, 05 Apr 2017 17:42:20 -0700 (PDT)
Received: from zony ([45.2.7.65])
 by smtp.googlemail.com with ESMTPSA id s194sm153176ita.12.2017.04.05.17.42.19
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 05 Apr 2017 17:42:20 -0700 (PDT)
From: npostavs@HIDDEN
To: Alan Mackenzie <acm@HIDDEN>
Subject: Re: bug#22765: Missing interfaces for syntax of characters in buffers.
References: <20160222111212.GC1984@HIDDEN>
Date: Wed, 05 Apr 2017 20:43:44 -0400
In-Reply-To: <20160222111212.GC1984@HIDDEN> (Alan Mackenzie's message
 of "Mon, 22 Feb 2016 11:12:12 +0000")
Message-ID: <87wpayuzzz.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 22765
Cc: 22765 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.7 (/)

Alan Mackenzie <acm@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 "(")))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#22765; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 22 Feb 2016 11:10:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 22 06:10:00 2016
Received: from localhost ([127.0.0.1]:36863 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1aXoNL-0001zL-Q0
	for submit <at> debbugs.gnu.org; Mon, 22 Feb 2016 06:09:59 -0500
Received: from eggs.gnu.org ([208.118.235.92]:34030)
 by debbugs.gnu.org with esmtp (Exim 4.84)
 (envelope-from <acm@HIDDEN>) id 1aXoNL-0001z8-5d
 for submit <at> debbugs.gnu.org; Mon, 22 Feb 2016 06:09:59 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <acm@HIDDEN>) id 1aXoNF-0000lx-1n
 for submit <at> debbugs.gnu.org; Mon, 22 Feb 2016 06:09:53 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:40443)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <acm@HIDDEN>)
 id 1aXoNE-0000lr-VJ
 for submit <at> debbugs.gnu.org; Mon, 22 Feb 2016 06:09:52 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:53199)
 by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <acm@HIDDEN>)
 id 1aXoNE-0006bH-2R
 for bug-gnu-emacs@HIDDEN; Mon, 22 Feb 2016 06:09:52 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <acm@HIDDEN>) id 1aXoN9-0000jS-3n
 for bug-gnu-emacs@HIDDEN; Mon, 22 Feb 2016 06:09:52 -0500
Received: from mail.muc.de ([193.149.48.3]:52206)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <acm@HIDDEN>)
 id 1aXoN8-0000gc-QF
 for bug-gnu-emacs@HIDDEN; Mon, 22 Feb 2016 06:09:47 -0500
Received: (qmail 19983 invoked by uid 3782); 22 Feb 2016 11:09:45 -0000
Received: from acm.muc.de (p548A53D7.dip0.t-ipconnect.de [84.138.83.215]) by
 colin.muc.de (tmda-ofmipd) with ESMTP;
 Mon, 22 Feb 2016 12:09:44 +0100
Received: (qmail 2750 invoked by uid 1000); 22 Feb 2016 11:12:12 -0000
Date: Mon, 22 Feb 2016 11:12:12 +0000
To: bug-gnu-emacs@HIDDEN
Subject: Missing interfaces for syntax of characters in buffers.
Message-ID: <20160222111212.GC1984@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.24 (2015-08-30)
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.4 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.4 (----)

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




Acknowledgement sent to Alan Mackenzie <acm@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#22765; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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