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#22884: 25.0.92; C/l mode editing takes waaaayy too long Date: Mon, 14 Mar 2016 23:07:58 -0400 Message-ID: References: <56D72C35.4090708@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1458011364 14544 80.91.229.3 (15 Mar 2016 03:09:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 15 Mar 2016 03:09:24 +0000 (UTC) Cc: 22884@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 15 04:09:13 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1affM7-0002rv-Ll for geb-bug-gnu-emacs@m.gmane.org; Tue, 15 Mar 2016 04:09:11 +0100 Original-Received: from localhost ([::1]:45133 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1affM6-00076d-S1 for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Mar 2016 23:09:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1affM2-00072g-1l for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2016 23:09:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1affLy-0000NE-0y for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2016 23:09:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51223) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1affLx-0000NA-TF; Mon, 14 Mar 2016 23:09:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1affLx-0000tk-Kd; Mon, 14 Mar 2016 23:09:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Tue, 15 Mar 2016 03:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22884 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 22884-submit@debbugs.gnu.org id=B22884.14580112873387 (code B ref 22884); Tue, 15 Mar 2016 03:09:01 +0000 Original-Received: (at 22884) by debbugs.gnu.org; 15 Mar 2016 03:08:07 +0000 Original-Received: from localhost ([127.0.0.1]:48350 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1affL5-0000sZ-Hu for submit@debbugs.gnu.org; Mon, 14 Mar 2016 23:08:07 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:58285) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1affL2-0000s4-TV for 22884@debbugs.gnu.org; Mon, 14 Mar 2016 23:08:06 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A7FgA731xV/wr0d0tcDoMChAKFVcA+gk0EAgKBPDwRAQEBAQEBAYEKQQWDXQEBAwFWIwULCzQSFBgNJIg3CM8jAQEBAQEBBAEBAQEeizqFBQeELQWzP4FFI4FmJByBFFoigngBAQE X-IPAS-Result: A0A7FgA731xV/wr0d0tcDoMChAKFVcA+gk0EAgKBPDwRAQEBAQEBAYEKQQWDXQEBAwFWIwULCzQSFBgNJIg3CM8jAQEBAQEBBAEBAQEeizqFBQeELQWzP4FFI4FmJByBFFoigngBAQE X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="196231104" Original-Received: from 75-119-244-10.dsl.teksavvy.com (HELO ceviche.home) ([75.119.244.10]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 14 Mar 2016 23:07:59 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id DE1A5661AA; Mon, 14 Mar 2016 23:07:58 -0400 (EDT) In-Reply-To: <56D72C35.4090708@cs.ucla.edu> (Paul Eggert's message of "Wed, 2 Mar 2016 10:08:53 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:114921 Archived-At: [ Just to clarify and keep it in the corresponding bug, rather than in some side-thread in emacs-devel. ] > emacs -Q config.h > M-x goto-line RET 1661 RET / / The patch below seems to fix this pathological case, making the "/ /" instantaneous again. Stefan diff --git a/src/syntax.c b/src/syntax.c index 8e14bf3..b712e45 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -597,6 +597,26 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte) && MODIFF == find_start_modiff) return find_start_value; + if (!NILP (Vcomment_use_syntax_ppss)) + { + EMACS_INT modiffs = CHARS_MODIFF; + Lisp_Object ppss = call1 (Qsyntax_ppss, make_number (pos)); + if (modiffs != CHARS_MODIFF) + error ("syntax-ppss modified the buffer!"); + TEMP_SET_PT_BOTH (opoint, opoint_byte); + Lisp_Object boc = Fnth (make_number (8), ppss); + if (NUMBERP (boc)) + { + find_start_value = XINT (boc); + find_start_value_byte = CHAR_TO_BYTE (find_start_value); + } + else + { + find_start_value = pos; + find_start_value_byte = pos_byte; + } + goto found; + } if (!open_paren_in_column_0_is_defun_start) { find_start_value = BEGV; @@ -864,6 +884,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, case Sopen: /* Assume a defun-start point is outside of strings. */ if (open_paren_in_column_0_is_defun_start + && NILP (Vcomment_use_syntax_ppss) && (from == stop || (temp_byte = dec_bytepos (from_byte), FETCH_CHAR (temp_byte) == '\n'))) @@ -3647,6 +3668,11 @@ void syms_of_syntax (void) { DEFSYM (Qsyntax_table_p, "syntax-table-p"); + DEFSYM (Qsyntax_ppss, "syntax-ppss"); + DEFVAR_LISP ("comment-use-syntax-ppss", + Vcomment_use_syntax_ppss, + doc: /* Non-nil means `forward-comment' can use `syntax-ppss' internally. */); + Vcomment_use_syntax_ppss = Qt; staticpro (&Vsyntax_code_object);