From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#7053: [AUCTeX-devel] Re: bug#7053: Reftex is fully broken Date: Tue, 21 Sep 2010 01:40:19 +0200 Message-ID: References: <1284716487.5481.61.camel@piko.site> <83pqwc1t9p.fsf@gnu.org> <1284731388.5452.8.camel@piko.site> <83eics1guw.fsf@gnu.org> <1284783571.3343.8.camel@piko.site> <83mxrfz9se.fsf@gnu.org> <87vd635bfi.fsf@caeruleus.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1285027886 18591 80.91.229.12 (21 Sep 2010 00:11:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 21 Sep 2010 00:11:26 +0000 (UTC) Cc: auctex-devel@gnu.org, =?UTF-8?Q?Alp=C3=A1r_?= =?UTF-8?Q?J=C3=BCttner?= , Carsten Dominik To: Ralf Angeli Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 21 02:11:24 2010 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.69) (envelope-from ) id 1OxqS7-0007cm-3T for geb-bug-gnu-emacs@m.gmane.org; Tue, 21 Sep 2010 02:11:19 +0200 Original-Received: from localhost ([127.0.0.1]:55530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OxqS6-0007Mb-BS for geb-bug-gnu-emacs@m.gmane.org; Mon, 20 Sep 2010 20:11:18 -0400 Original-Received: from [140.186.70.92] (port=58121 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OxqRz-0007Lb-3a for bug-gnu-emacs@gnu.org; Mon, 20 Sep 2010 20:11:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OxqRx-0006wU-0a for bug-gnu-emacs@gnu.org; Mon, 20 Sep 2010 20:11:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58629) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxqRw-0006wM-Sd for bug-gnu-emacs@gnu.org; Mon, 20 Sep 2010 20:11:08 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Oxq5a-0001N5-9T for bug-gnu-emacs@gnu.org; Mon, 20 Sep 2010 19:48:02 -0400 Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Sep 2010 23:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 7053 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Mail-Followup-To: 7053@debbugs.gnu.org, monnier@IRO.UMontreal.CA Original-Received: via spool by 7053-done@debbugs.gnu.org id=D7053.12850264765264 (code D ref 7053); Mon, 20 Sep 2010 23:48:02 +0000 Original-Received: (at 7053-done) by debbugs.gnu.org; 20 Sep 2010 23:47:56 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxq5T-0001Mr-G6 for submit@debbugs.gnu.org; Mon, 20 Sep 2010 19:47:56 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxpvy-0001Id-J4 for 7053-done@debbugs.gnu.org; Mon, 20 Sep 2010 19:38:07 -0400 Original-Received: from fmsmemgm.homelinux.net (vpn-132-204-232-179.acd.umontreal.ca [132.204.232.179]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id o8KNeKOl027105; Mon, 20 Sep 2010 19:40:21 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 8D0F46618D; Tue, 21 Sep 2010 01:40:19 +0200 (CEST) In-Reply-To: (Stefan Monnier's message of "Sat, 18 Sep 2010 18:11:59 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3626=0 X-Mailman-Approved-At: Mon, 20 Sep 2010 19:47:54 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 20 Sep 2010 19:48:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org 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:40336 Archived-At: >> bothered to follow the switch to Bazaar. It might take a while to make >> myself acquainted with it. And unfortunately I failed to find a web >> interface to the current Emacs sources in order to find out if somebody >> has changed the RefTeX files, or in which way. > I suspect the change is not in the reftex file but in the behavior of > up-list which now obeys forward-sexp-function, which means that under > latex-mode, it will now move from > \begin{foo} >> here< > \end{foo} > to just before the \begin. So if the reftex code does not expect that > (and/or for performance reason doesn't want that), it should protect > against it by binding forward-sexp-function around calls to up-list > and friends. I think in the end, the core reason for the problem was a bug in the new up-list code (it just silently did nothing when reaching BOB), which I've just fixed. I also additionally installed the patch below which circumvents the bug and also avoids slowing things down unnecessarily. Stefan === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-09-20 21:45:09 +0000 +++ lisp/ChangeLog 2010-09-20 22:35:46 +0000 @@ -1,5 +1,9 @@ 2010-09-20 Stefan Monnier + * textmodes/reftex-parse.el (reftex-what-macro) + (reftex-context-substring): Let-bind forward-sexp-function to nil + since we don't need/want to treat \begin...\end as a block. + * emacs-lisp/lisp.el (up-list): Don't do nothing silently. * simple.el (blink-matching-open): Use syntax-class. === modified file 'lisp/textmodes/reftex-parse.el' --- lisp/textmodes/reftex-parse.el 2010-09-20 13:27:59 +0000 +++ lisp/textmodes/reftex-parse.el 2010-09-20 22:35:33 +0000 @@ -385,7 +385,7 @@ (defun reftex-section-info (file) ;; Return a section entry for the current match. - ;; Carefull: This function expects the match-data to be still in place! + ;; Careful: This function expects the match-data to be still in place! (let* ((marker (set-marker (make-marker) (1- (match-beginning 3)))) (macro (reftex-match-string 3)) (prefix (save-match-data @@ -778,13 +778,15 @@ (narrow-to-region (max (point-min) bound) (point-max)) ;; move back out of the current parenthesis (while (condition-case nil - (progn (up-list -1) t) + (let ((forward-sexp-function nil)) + (up-list -1) t) (error nil)) (setq cnt 1 cnt-opt 0) ;; move back over any touching sexps (while (and (reftex-move-to-previous-arg bound) (condition-case nil - (progn (backward-sexp) t) + (let ((forward-sexp-function nil)) + (backward-sexp) t) (error nil))) (if (eq (following-char) ?\[) (incf cnt-opt)) (incf cnt)) @@ -965,15 +967,14 @@ (if (re-search-forward "\\\\end{" nil t) (match-beginning 0) (point-max)))))) - ((or (= (preceding-char) ?\{) - (= (preceding-char) ?\[)) + ((memq (preceding-char) '(?\{ ?\[)) ;; Inside a list - get only the list. (buffer-substring-no-properties (point) (min (+ (point) 150) (point-max) (condition-case nil - (progn + (let ((forward-sexp-function nil)) ;Unneeded fanciness. (up-list 1) (1- (point))) (error (point-max))))))