From unknown Thu Jun 19 14:05:35 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#13942 <13942@debbugs.gnu.org> To: bug#13942 <13942@debbugs.gnu.org> Subject: Status: 24.3.50; `smie-auto-fill' loops Reply-To: bug#13942 <13942@debbugs.gnu.org> Date: Thu, 19 Jun 2025 21:05:35 +0000 retitle 13942 24.3.50; `smie-auto-fill' loops reassign 13942 emacs submitter 13942 Dirk Ullrich severity 13942 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 13 00:31:04 2013 Received: (at submit) by debbugs.gnu.org; 13 Mar 2013 04:31:04 +0000 Received: from localhost ([127.0.0.1]:49938 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFdLD-00015g-KA for submit@debbugs.gnu.org; Wed, 13 Mar 2013 00:31:04 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40115) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFdLA-00015C-HU for submit@debbugs.gnu.org; Wed, 13 Mar 2013 00:31:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFdK0-0000T5-Rb for submit@debbugs.gnu.org; Wed, 13 Mar 2013 00:29:51 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:35361) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFdK0-0000T1-OA for submit@debbugs.gnu.org; Wed, 13 Mar 2013 00:29:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFdJw-0008AB-8x for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2013 00:29:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFdJr-0000Bu-Uh for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2013 00:29:44 -0400 Received: from mail-ie0-x22a.google.com ([2607:f8b0:4001:c03::22a]:39011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFdJr-0000Bq-OS for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2013 00:29:39 -0400 Received: by mail-ie0-f170.google.com with SMTP id c11so891356ieb.1 for ; Tue, 12 Mar 2013 21:29:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=11Tsdwhrdhnn0lf4RzzKZRHd0+hQxQUpKQzUyBJkUzM=; b=lNjMbS7gALfk/tQMgcoivCxbbavkeXnAhNvXNyoGWKh/RJc0Vb7S8kb/XpznDfgRqq RqinGaQhIZ1QRidNl+u5QP882msKuz/q6UivhwccfVRpXOkFvE2jpGIHRFVXCLxxdhT1 IY3uETcONJaPTSpSVCcc81I5EmfqUjqHO642GQCsBrKgjYAlWz4Rk4EaQebKxofHFLsy 0vpHUjvNSLkqPOETpmU6smnUe3Mv+psK4ACa435kIFno4+G2+wr67kGyrY0wX3TSO/hM zBwCPm8sF7blpw/OETWLFMnaBGVj6cz3XC9U/kauHY6QcOFAw1ZnoPiHVDc43B+0wfck HlHg== MIME-Version: 1.0 X-Received: by 10.42.126.133 with SMTP id e5mr14825389ics.17.1363148978804; Tue, 12 Mar 2013 21:29:38 -0700 (PDT) Received: by 10.64.136.19 with HTTP; Tue, 12 Mar 2013 21:29:38 -0700 (PDT) Date: Wed, 13 Mar 2013 05:29:38 +0100 Message-ID: Subject: 24.3.50; `smie-auto-fill' loops From: Dirk Ullrich To: bug-gnu-emacs@gnu.org Content-Type: multipart/mixed; boundary=20cf301b6431a8aca604d7c6da51 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) --20cf301b6431a8aca604d7c6da51 Content-Type: text/plain; charset=ISO-8859-1 Prerequisits: 1. An Emacs with recent-enough `lisp/emacs-lisp/smie.el' module such that `smie-auto-fill' is provided. 2. A ProofGeneral (PG) with its Coq mode based on `smie' (and `load-path' properly set). 3. A Coq file with a comment longer than `fill-column'. How to reproduce the bug: 1. Initialize PG by loading `pg-init.el'. 2. Enable auto-filling for PG's Coq mode. 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. Remarks: 1. A debugger session shows that the looping is caused by `smie-auto-fill'. 2. A simple Coq test file is appended to this bug report. In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.4.2) of 2013-03-13 on koan Windowing system distributor `The X.Org Foundation', version 11.0.11204000 System Description: Debian GNU/Linux 7.0 (wheezy) Configured using: `configure --prefix=/usr/local/packages/emacs-devel --sysconfdir=/etc --mandir=/usr/local/packages/emacs-devel/share/man --localstatedir=/var/local/packages/emacs-devel --libexecdir=/usr/local/packages/emacs-devel/lib --enable-locallisppath=/etc/emacs --without-sound --with-gameuser=packages --program-suffix=-devel --with-x-toolkit=gtk3' Important settings: value of $LANG: de_DE.UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Coq Minor modes in effect: holes-mode: t tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t auto-fill-function: smie-auto-fill transient-mark-mode: t Recent input: C-x C-f P . M-x a u - f SPC C-x C-s M-q C-x u C-x C-s C-x C-s C-x C-s M-x e m a r e p o r t Recent messages: Wrote /common/depot/unfinished/2do/emacs-devel/smie-auto-fill/PG_Autofill.v Quit Mark set Saving file /common/depot/unfinished/2do/emacs-devel/smie-auto-fill/PG_Autofill.v... Wrote /common/depot/unfinished/2do/emacs-devel/smie-auto-fill/PG_Autofill.v Quit End of buffer Saving file /common/depot/unfinished/2do/emacs-devel/smie-auto-fill/PG_Autofill.v... Wrote /common/depot/unfinished/2do/emacs-devel/smie-auto-fill/PG_Autofill.v Making completion list... Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils help-mode vc-git which-func imenu coq coq-smie-lexer smie coq-indent coq-par-compile coq-seq-compile coq-compile-common coq-abbrev coq-local-vars local-vars-list coq-syntax coq-db holes proof proof-shell pg-user completion pg-goals pg-response proof-toolbar pg-assoc proof-tree proof-script proof-menu cus-edit cus-start cus-load wid-edit span proof-auxmodes proof-utils scomint proof-syntax advice help-fns bufhist easy-mmode ring proof-splash derived pg-custom proof-config proof-faces proof-useropts pg-pamacs proof-compat easymenu proof-site proof-autoloads cl-macs gv cl nadvice cl-lib pg-vars time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) --20cf301b6431a8aca604d7c6da51 Content-Type: application/octet-stream; name="PG_Autofill.v" Content-Disposition: attachment; filename="PG_Autofill.v" Content-Transfer-Encoding: base64 X-Attachment-Id: f_he7znpaz0 KCogV2Ugc3RhcnQgdG8gbG9hZCBzb21lIG1vZHVsZXMgZm9yIENvcSdzIHN0YW5kYXJkIGxpYnJh cnkgd2hvc2Ugc3R1ZmYgd2UgdXNlIGhlcmUuICop --20cf301b6431a8aca604d7c6da51-- From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 13 23:06:41 2013 Received: (at 13942) by debbugs.gnu.org; 14 Mar 2013 03:06:41 +0000 Received: from localhost ([127.0.0.1]:52261 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFyV6-000281-TS for submit@debbugs.gnu.org; Wed, 13 Mar 2013 23:06:41 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:22360) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFyV5-00027p-1Q for 13942@debbugs.gnu.org; Wed, 13 Mar 2013 23:06:39 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFHO+KL9/2dsb2JhbABEuzWDWRdzgh4BAQQBJy8WCgMFCws0EhQYDSSIHgbBLZEKA6R6gV6DEw X-IPAS-Result: Av8EABK/CFHO+KL9/2dsb2JhbABEuzWDWRdzgh4BAQQBJy8WCgMFCws0EhQYDSSIHgbBLZEKA6R6gV6DEw X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="4864857" Received: from 206-248-162-253.dsl.teksavvy.com (HELO pastel.home) ([206.248.162.253]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 13 Mar 2013 23:05:22 -0400 Received: by pastel.home (Postfix, from userid 20848) id 17B3B678BC; Wed, 13 Mar 2013 23:05:24 -0400 (EDT) From: Stefan Monnier To: Dirk Ullrich Subject: Re: bug#13942: 24.3.50; `smie-auto-fill' loops Message-ID: References: Date: Wed, 13 Mar 2013 23:05:24 -0400 In-Reply-To: (Dirk Ullrich's message of "Wed, 13 Mar 2013 05:29:38 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 13942 Cc: 13942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > 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) From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 14 02:32:51 2013 Received: (at 13942) by debbugs.gnu.org; 14 Mar 2013 06:32:51 +0000 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 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 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== MIME-Version: 1.0 X-Received: by 10.50.89.200 with SMTP id bq8mr1124974igb.58.1363242689876; Wed, 13 Mar 2013 23:31:29 -0700 (PDT) Received: by 10.64.136.19 with HTTP; Wed, 13 Mar 2013 23:31:29 -0700 (PDT) In-Reply-To: References: Date: Thu, 14 Mar 2013 07:31:29 +0100 Message-ID: Subject: Re: bug#13942: 24.3.50; `smie-auto-fill' loops From: Dirk Ullrich To: Stefan Monnier Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 13942 Cc: 13942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) 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) > From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 14 12:12:45 2013 Received: (at 13942-done) by debbugs.gnu.org; 14 Mar 2013 16:12:45 +0000 Received: from localhost ([127.0.0.1]:54351 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UGAlk-00056n-8V for submit@debbugs.gnu.org; Thu, 14 Mar 2013 12:12:45 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:29322) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UGAld-00056S-5m for 13942-done@debbugs.gnu.org; Thu, 14 Mar 2013 12:12:37 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFHO+KL9/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA6R6gV6DEw X-IPAS-Result: Av8EABK/CFHO+KL9/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA6R6gV6DEw X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="4916551" Received: from 206-248-162-253.dsl.teksavvy.com (HELO pastel.home) ([206.248.162.253]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 14 Mar 2013 12:11:08 -0400 Received: by pastel.home (Postfix, from userid 20848) id 73F3167A4D; Thu, 14 Mar 2013 12:10:51 -0400 (EDT) From: Stefan Monnier To: Dirk Ullrich Subject: Re: bug#13942: 24.3.50; `smie-auto-fill' loops Message-ID: References: Date: Thu, 14 Mar 2013 12:10:51 -0400 In-Reply-To: (Dirk Ullrich's message of "Thu, 14 Mar 2013 07:31:29 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 13942-done Cc: 13942-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > I've just tested your patch. It works for me, too. Thank you, installed in emacs-24. Stefan From unknown Thu Jun 19 14:05:35 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 12 Apr 2013 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator