From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#4030: forward-sexp parses character literal ?; as comment Date: Fri, 07 Aug 2009 15:01:27 +0200 Message-ID: <4A7C25A7.6000900@gmx.at> References: <1249387642.18128.1328220453@webmail.messagingengine.com> <4A782D00.4040808@gmx.at> <1249460270.18460.1328376993@webmail.messagingengine.com> <4A799766.9050304@gmx.at> Reply-To: martin rudalics , 4030@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1249651632 4865 80.91.229.12 (7 Aug 2009 13:27:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 7 Aug 2009 13:27:12 +0000 (UTC) Cc: era+emacsbugs@iki.fi, 4030@emacsbugs.donarmstrong.com To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 07 15:27:05 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MZPTM-0004Ss-NM for geb-bug-gnu-emacs@m.gmane.org; Fri, 07 Aug 2009 15:27:05 +0200 Original-Received: from localhost ([127.0.0.1]:47073 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MZPTM-0007wl-47 for geb-bug-gnu-emacs@m.gmane.org; Fri, 07 Aug 2009 09:27:04 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MZPTF-0007wS-De for bug-gnu-emacs@gnu.org; Fri, 07 Aug 2009 09:26:57 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MZPTB-0007uq-3J for bug-gnu-emacs@gnu.org; Fri, 07 Aug 2009 09:26:56 -0400 Original-Received: from [199.232.76.173] (port=39817 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MZPTA-0007ug-O3 for bug-gnu-emacs@gnu.org; Fri, 07 Aug 2009 09:26:52 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:57153) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MZPTA-0004rv-6Z for bug-gnu-emacs@gnu.org; Fri, 07 Aug 2009 09:26:52 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n77DQmmQ022414; Fri, 7 Aug 2009 06:26:48 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n77DA669020832; Fri, 7 Aug 2009 06:10:06 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: martin rudalics Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Fri, 07 Aug 2009 13:10:06 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 4030 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 4030-submit@emacsbugs.donarmstrong.com id=B4030.124965010219385 (code B ref 4030); Fri, 07 Aug 2009 13:10:06 +0000 Original-Received: (at 4030) by emacsbugs.donarmstrong.com; 7 Aug 2009 13:01:42 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with SMTP id n77D1ekQ019380 for <4030@emacsbugs.donarmstrong.com>; Fri, 7 Aug 2009 06:01:41 -0700 Original-Received: (qmail invoked by alias); 07 Aug 2009 13:01:30 -0000 Original-Received: from 62-47-54-134.adsl.highway.telekom.at (EHLO [62.47.54.134]) [62.47.54.134] by mail.gmx.net (mp071) with SMTP; 07 Aug 2009 15:01:30 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX191DCRdEaF14PiPEtFkylVyy0yG2tH1AGn4ip38+L 6z0rc/urXeB7m8 User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) In-Reply-To: X-Y-GMX-Trusted: 0 X-FuHaFi: 0.54 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Fri, 07 Aug 2009 09:26:56 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:29960 Archived-At: >> 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). >>> 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. But do we really have to scan the buffer in the first place? martin *** cus-edit.el.~1.364.~ 2009-07-27 08:09:05.997162900 +0200 --- cus-edit.el 2009-08-07 14:49:22.890625000 +0200 *************** *** 4341,4347 **** ;; Skip all whitespace and comments. (while (forward-comment 1)) (or (eobp) ! (save-excursion (forward-sexp (buffer-size)))) ; Test for scan errors. (let (first) (catch 'found (while t ;; We exit this loop only via throw. --- 4341,4349 ---- ;; Skip all whitespace and comments. (while (forward-comment 1)) (or (eobp) ! (condition-case nil ! (save-excursion (forward-sexp (buffer-size))) ; Test for scan errors. ! (scan-error (error "Scan error, watch out for ... ")))) (let (first) (catch 'found (while t ;; We exit this loop only via throw.