GNU bug report logs - #15826
24.3.50; SMIE hangs in sh-mode

Previous Next

Package: emacs;

Reported by: Aaron Ecay <aaronecay <at> gmail.com>

Date: Thu, 7 Nov 2013 03:57:02 UTC

Severity: normal

Found in version 24.3.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15826 in the body.
You can then email your comments to 15826 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15826; Package emacs. (Thu, 07 Nov 2013 03:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Aaron Ecay <aaronecay <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 07 Nov 2013 03:57:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Aaron Ecay <aaronecay <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; SMIE hangs in sh-mode
Date: Wed, 06 Nov 2013 22:55:53 -0500
I observe hangs when using sh-mode in recent trunk emacs (latest commit
Tue Nov 5 18:36:37 2013 +0200).  Recipe to reproduce:

- emacs -Q
- C-x C-f foo.sh
- type “for i in”
- immediately after entering the ‘n’, emacs will hang

Setting debug-on-quit to t and quitting yields the following backtrace:
Debugger entered--Lisp error: (quit)
  re-search-backward("\\(?:\\(?:^\\|[^\\]\\)\\(?:\\\\\\\\\\)*\\(\\(?:&&\\|;\\(?:;&\\|[&;]\\)\\||[&|]\\|[&;|]\\)\\)\\)\\=" 1 t)
  looking-back("\\(?:^\\|[^\\]\\)\\(?:\\\\\\\\\\)*\\(\\(?:&&\\|;\\(?:;&\\|[&;]\\)\\||[&|]\\|[&;|]\\)\\)" 1 greedy)
  sh-smie-sh-backward-token()
  sh-smie--sh-keyword-in-p()
  sh-smie--sh-keyword-p("in")
  sh-smie-sh-backward-token()
  smie-blink-matching-open()
  self-insert-command(1)
  call-interactively(self-insert-command nil nil)
  command-execute(self-insert-command)

Thanks,
Aaron



In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.2)
 of 2013-11-05 on haize
Windowing system distributor `The X.Org Foundation', version 11.0.11404000
Configured using:
 `configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
 --libexecdir=/usr/lib --mandir=/usr/share/man --without-sound
 --with-xft --with-x-toolkit=gtk --with-gif=no 'CFLAGS=-march=x86-64
 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4'
 CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

-- 
Aaron Ecay




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Fri, 08 Nov 2013 04:35:02 GMT) Full text and rfc822 format available.

Notification sent to Aaron Ecay <aaronecay <at> gmail.com>:
bug acknowledged by developer. (Fri, 08 Nov 2013 04:35:02 GMT) Full text and rfc822 format available.

Message #10 received at 15826-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Aaron Ecay <aaronecay <at> gmail.com>
Cc: 15826-done <at> debbugs.gnu.org
Subject: Re: bug#15826: 24.3.50; SMIE hangs in sh-mode
Date: Thu, 07 Nov 2013 23:34:38 -0500
> - emacs -Q
> - C-x C-f foo.sh
> - type “for i in”
> - immediately after entering the ‘n’, emacs will hang

Indeed, thank you.  I installed the patch below which should fix it.


        Stefan


=== modified file 'lisp/progmodes/sh-script.el'
--- lisp/progmodes/sh-script.el	2013-10-24 21:16:20 +0000
+++ lisp/progmodes/sh-script.el	2013-11-08 04:31:52 +0000
@@ -1730,7 +1730,7 @@
 like a keyword, then it is a keyword."
   (let ((prev (funcall smie-backward-token-function)))
     (if (zerop (length prev))
-        (looking-back "\\s(" (1- (point)))
+        (looking-back "\\`\\|\\s(" (1- (point)))
       (assoc prev smie-grammar))))
 
 (defun sh-smie--newline-semi-p (&optional tok)
@@ -1804,12 +1804,14 @@
       (setq prev (funcall smie-backward-token-function))
       (cond
        ((zerop (length prev))
-        (if newline
-            (progn (cl-assert words) (setq res 'word))
+	(cond
+	 (newline (cl-assert words) (setq res 'word))
+	 ((bobp) (setq res 'word))
+	 (t
           (setq words t)
           (condition-case nil
               (forward-sexp -1)
-            (scan-error (setq res 'unknown)))))
+            (scan-error (setq res 'unknown))))))
        ((equal prev ";")
         (if words (setq newline t)
           (setq res 'keyword)))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15826; Package emacs. (Sat, 09 Nov 2013 20:02:02 GMT) Full text and rfc822 format available.

Message #13 received at 15826-done <at> debbugs.gnu.org (full text, mbox):

From: Aaron Ecay <aaronecay <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 15826-done <at> debbugs.gnu.org
Subject: Re: bug#15826: 24.3.50; SMIE hangs in sh-mode
Date: Sat, 09 Nov 2013 15:01:37 -0500
2013ko azaroak 7an, Stefan Monnier-ek idatzi zuen:
>
> Indeed, thank you.  I installed the patch below which should fix it.

It is indeed fixed.  BTW, the (new?) highlighting of for/done, if/fi,
etc. in show-paren-mode is very nifty.

Thanks,

--
Aaron Ecay




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15826; Package emacs. (Sun, 10 Nov 2013 13:50:02 GMT) Full text and rfc822 format available.

Message #16 received at 15826-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Aaron Ecay <aaronecay <at> gmail.com>
Cc: 15826-done <at> debbugs.gnu.org
Subject: Re: bug#15826: 24.3.50; SMIE hangs in sh-mode
Date: Sun, 10 Nov 2013 08:49:01 -0500
>> Indeed, thank you.  I installed the patch below which should fix it.
> It is indeed fixed.  BTW, the (new?) highlighting of for/done, if/fi,
> etc. in show-paren-mode is very nifty.

Thanks, I'm glad you like it,


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 09 Dec 2013 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 278 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.