From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dirk Ullrich Newsgroups: gmane.emacs.bugs Subject: bug#13942: 24.3.50; `smie-auto-fill' loops Date: Thu, 14 Mar 2013 07:31:29 +0100 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1363242719 20725 80.91.229.3 (14 Mar 2013 06:31:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Mar 2013 06:31:59 +0000 (UTC) Cc: 13942@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 14 07:32:24 2013 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 1UG1iC-0007ir-AH for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Mar 2013 07:32:24 +0100 Original-Received: from localhost ([::1]:50928 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UG1hp-0003Tb-Pj for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Mar 2013 02:32:01 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:53700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UG1hl-0003TO-Ag for bug-gnu-emacs@gnu.org; Thu, 14 Mar 2013 02:32:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UG1hh-0001oc-Qw for bug-gnu-emacs@gnu.org; Thu, 14 Mar 2013 02:31:57 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48469) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UG1hh-0001oY-LW for bug-gnu-emacs@gnu.org; Thu, 14 Mar 2013 02:31:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UG1io-0006za-9P for bug-gnu-emacs@gnu.org; Thu, 14 Mar 2013 02:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dirk Ullrich Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Mar 2013 06:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13942 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13942-submit@debbugs.gnu.org id=B13942.136324277126861 (code B ref 13942); Thu, 14 Mar 2013 06:33:02 +0000 Original-Received: (at 13942) by debbugs.gnu.org; 14 Mar 2013 06:32:51 +0000 Original-Received: from localhost ([127.0.0.1]:52578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UG1ic-0006zB-2g for submit@debbugs.gnu.org; Thu, 14 Mar 2013 02:32:51 -0400 Original-Received: from mail-ie0-f178.google.com ([209.85.223.178]:35327) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UG1iX-0006yw-VW for 13942@debbugs.gnu.org; Thu, 14 Mar 2013 02:32:47 -0400 Original-Received: by mail-ie0-f178.google.com with SMTP id c13so2544099ieb.23 for <13942@debbugs.gnu.org>; Wed, 13 Mar 2013 23:31:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=Y6Zcq1eGv9awNo4gZYR2oZ3HbrkQPX33G/xLLh/a2EQ=; b=lJE5ZfFQb/MjkejnqLMW17i/0AZzwlFnSQzjb9Qamh4cKqI5P1eAe0MEHAyTC4bKBH n727fIqAPsTYMlXbzP7vZbzodzzYACQG9ndvXG3pR8kXleu4mTHJ1oblioANiRC4L6Wb zqHEGIbiVz4wEgrUwTSEQsgPkgSsZuT7ClSnYtfFn1e6U8tH2VdvWR64I/o+iVgCIt+s uWZ3fUheZNGRRE/siKAX6j6mVm7Vt+oUiUDtst49Gbqd2yC/Gh98lrAo2msjXOAkKJuo Zbt9w7xl5pF7MtpgKfHoclSfAao7zyXJyhyoGkHYtjWMG9/5yET9ByBd1fypAHDf3/g8 LEgA== X-Received: by 10.50.89.200 with SMTP id bq8mr1124974igb.58.1363242689876; Wed, 13 Mar 2013 23:31:29 -0700 (PDT) Original-Received: by 10.64.136.19 with HTTP; Wed, 13 Mar 2013 23:31:29 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.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:72449 Archived-At: Hello Stefan, I've just tested your patch. It works for me, too. Thank you for the quick solution! Dirk 2013/3/14 Stefan Monnier : >> 3. Load the Coq test file, and trigger auto-filling by placing the >> cursor just after a to-long comment line and hitting ENTER. -> Emacs >> loops. > > Aha! The trick was to hit enter *after* the end of the comment! > > I think the patch below fixes this problem, while still providing the > same auto-fill feature. Can you confirm it works well for you? > > > Stefan > > > === modified file 'lisp/emacs-lisp/smie.el' > --- lisp/emacs-lisp/smie.el 2013-01-01 09:11:05 +0000 > +++ lisp/emacs-lisp/smie.el 2013-03-14 00:49:52 +0000 > @@ -1631,21 +1631,23 @@ > (defun smie-auto-fill () > (let ((fc (current-fill-column))) > (while (and fc (> (current-column) fc)) > - (cond > - ((not (or (nth 8 (save-excursion > + (or (unless (or (nth 8 (save-excursion > (syntax-ppss (line-beginning-position)))) > - (nth 8 (syntax-ppss)))) > + (nth 8 (syntax-ppss))) > (save-excursion > - (beginning-of-line) > + (let ((end (point)) > + (bsf (progn (beginning-of-line) > (smie-indent-forward-token) > - (let ((bsf (point)) > + (point))) > (gain 0) > curcol) > - (while (<= (setq curcol (current-column)) fc) > + (while (and (<= (point) end) > + (<= (setq curcol (current-column)) fc)) > ;; FIXME? `smie-indent-calculate' can (and often will) > - ;; return a result that actually depends on the presence/absence > - ;; of a newline, so the gain computed here may not be accurate, > - ;; but in practice it seems to works well enough. > + ;; return a result that actually depends on the > + ;; presence/absence of a newline, so the gain computed here > + ;; may not be accurate, but in practice it seems to works > + ;; well enough. > (let* ((newcol (smie-indent-calculate)) > (newgain (- curcol newcol))) > (when (> newgain gain) > @@ -1654,8 +1656,9 @@ > (smie-indent-forward-token)) > (when (> gain 0) > (goto-char bsf) > - (newline-and-indent))))) > - (t (do-auto-fill)))))) > + (newline-and-indent) > + 'done)))) > + (do-auto-fill))))) > > > (defun smie-setup (grammar rules-function &rest keywords) >