all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: David Reitter <david.reitter@gmail.com>
Cc: Andrew Hyatt <ahyatt@gmail.com>, 5560@debbugs.gnu.org
Subject: bug#5560: 23.1.92; parens matching in c-mode broken
Date: Mon, 22 Feb 2016 10:35:55 +0000	[thread overview]
Message-ID: <20160222103555.GA1984@acm.fritz.box> (raw)
In-Reply-To: <00B53025-4477-4BBC-961A-0B8DF4234C19@gmail.com>

Hello, David.

On Sun, Feb 21, 2016 at 04:40:09PM -0500, David Reitter wrote:
> Alan,

> Your patch works as advertised for my test case.  It’s certainly
> better to error out than to do the wrong thing.

> I think you are catching the right situations, but my confidence is
> low because of the readability of the code (what is 4, 5?).

4 and 5 are the low level codes for "open paren" and "close paren"
syntax.  I don't like them much either, but `syntax-after' is the only
interface available which returns the syntax of a character in a buffer,
taking account of syntax-table text properties.  4 and 5 (or, more
precisely, (4 . ?\)), (5 . ?\()) are what we have to work with.

One way would be to create two constants with fancy names with values 4
and 5, but I don't think that helps much - anybody debugging and
suspicious of the values still has to find the page in the elisp manual
to check, but has an extra irritating indirection to cope with.

How would you feel about explanatory comments on the two lines -
something like:

+         (if (/= (car (syntax-after start)) 4) ; low-level code for ?\(

?

What we really need is a better interface.  Perhaps `char-syntax-after',
which would actually return ?\( and ?\).  In fact, I think I'll raise a
bug report for this.

> I think the question is whether that fix is appropriate for the 25.1
> release.  If you want to apply it there, I would probably test a whole
> lot of cases in modes that are derivates of c-mode.

I think the fix should go into 25.1.  I'm confident enough about the
mechanism of the bug that I'm not sure extensive testing is warranted.

> - David

-- 
Alan Mackenzie (Nuremberg, Germany).





  parent reply	other threads:[~2016-02-22 10:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-11  3:01 bug#5560: 23.1.92; parens matching in c-mode broken David Reitter
2016-02-17  3:56 ` Andrew Hyatt
2016-02-20 22:57   ` Alan Mackenzie
2016-02-21 12:35     ` Alan Mackenzie
2016-02-21 21:40       ` David Reitter
2016-02-21 23:21         ` John Wiegley
2016-02-22 10:51           ` Alan Mackenzie
2016-02-22 10:35         ` Alan Mackenzie [this message]
2016-02-22 12:09           ` David Reitter
2016-02-25  9:54             ` Alan Mackenzie

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160222103555.GA1984@acm.fritz.box \
    --to=acm@muc.de \
    --cc=5560@debbugs.gnu.org \
    --cc=ahyatt@gmail.com \
    --cc=david.reitter@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.