unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: martin rudalics <rudalics@gmx.at>
Cc: era+emacsbugs@iki.fi, 4030@emacsbugs.donarmstrong.com
Subject: bug#4030: forward-sexp parses character literal ?; as comment
Date: Mon, 10 Aug 2009 15:59:39 -0400	[thread overview]
Message-ID: <jwvab27la0d.fsf-monnier+emacsbugreports@gnu.org> (raw)
In-Reply-To: <4A7C25A7.6000900@gmx.at> (martin rudalics's message of "Fri, 07 Aug 2009 15:01:27 +0200")

>>> We could try to mark any `?;' or `?"' sequences appropriately when
>>> fontifying though.
>> We could/should/will improve the syntax parsing to handle those
>> things properly.  But it's a non-trivial amount of work, especially
>> since every major mode has similar issues but needs different
>> extra functionality.
> But fontification is mode-specific.  So it would be sufficient to look
> for ?s that are not within strings or comments and followed by a
> semicolon, paren or double-quote and mark that appropriately (obviously
> the parser is derailed at that time but it still might help people spot
> the bug).

Yes, but we need to do that even on chunks of code that have not yet
been (and may never be) displayed and in buffers where font-lock
is disabled.  IOW I'm not talking about fontification but about parsing.

>>>> I'll also point out that an "Unbalanced parentheses" error from deep
>>>> inside Customize is not a very helpful error message (especially as it
>>>> does not indicate in which buffer the unbalanced parentheses were
>>>> found); but perhaps Customize should be adapted to cope if forward-sexp
>>>> cannot easily be fixed.
>>> Getting good diagnostics after a parsing error is hard.
>> 
>> Agreed, but that doesn't mean we shouldn't intend to do better: the
>> current behavior (signalling an internal error to the user) is a bug
>> that needs to be fixed.

> If the problem comes from the unprotected

>       (save-excursion (forward-sexp (buffer-size)))) ; Test for scan errors.

> call in `custom-save-delete' we could simply wrap it as in the patch
> below.

Pretty much, yes, tho the error message should give more info (the OP
complained about lack of info in the error message).

> But do we really have to scan the buffer in the first place?

Don't know.  Maybe not, indeed.  Maybe it's just to detect the "too many
closing parens" case as well (i.e. rather than silently ignore trailing
code).


        Stefan





  reply	other threads:[~2009-08-10 19:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-04 12:07 bug#4030: forward-sexp parses character literal ?; as comment era+emacsbugs
2009-08-04 12:43 ` martin rudalics
2009-08-05  8:17   ` era+emacsbugs
2009-08-05 14:29     ` martin rudalics
2009-08-06  8:55       ` era+emacsbugs
2009-08-06 18:51       ` Stefan Monnier
2009-08-07 13:01         ` martin rudalics
2009-08-10 19:59           ` Stefan Monnier [this message]
2009-08-11  9:17             ` martin rudalics
2016-06-18  3:47               ` Andrew Hyatt
2016-06-18  4:31                 ` Stefan Monnier
2017-05-13  2:55                   ` npostavs

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=jwvab27la0d.fsf-monnier+emacsbugreports@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=4030@emacsbugs.donarmstrong.com \
    --cc=era+emacsbugs@iki.fi \
    --cc=rudalics@gmx.at \
    /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).