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

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

bug#4030: forward-sexp parses character literal ?; as comment


From: era+emacsbugs
Subject: bug#4030: forward-sexp parses character literal ?; as comment
Date: Wed, 05 Aug 2009 11:17:50 +0300

On Tue, 04 Aug 2009 14:43 +0200, "martin rudalics" <address@hidden>
wrote:
>  > It seems that forward-sexp (and its underlying C implementation) does
>  > not cope correctly with a character literal semicolon, seeing instead
>  > (effectively) end of line.
>  >
>  > In the *scratch* buffer if you write (insert ?;) you can evaluate this
>  > Lisp code and it behaves as intended (inserts a semicolon in the current
>  > buffer) but doing M-x forward-sexp just before the expression results in
>  > an "Unbalanced parentheses" error.
> 
> A similar thing happens with (insert ?") so why don't you escape such a
> character by writing (insert ?\;) instead?

While the workaround is good (and documented in the Ubuntu bug as well),
the ability of Customize depends on this code working correctly, and it
should handle any nominally well-formed .emacs file.  Perhaps there are
other pieces of code which rely on forward-sexp et alii for Emacs Lisp
parsing as well.

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.

It appears that src/syntax.c could perhaps be adapted to take into
account character literals as well as quoted strings, but I am not
familiar enough with Emacs internals to tell whether this is really a
feasible approach.





reply via email to

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