unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Aaron Ecay <aaronecay@gmail.com>
Cc: 15826-done@debbugs.gnu.org
Subject: bug#15826: 24.3.50; SMIE hangs in sh-mode
Date: Thu, 07 Nov 2013 23:34:38 -0500	[thread overview]
Message-ID: <jwv61s34in3.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <87habo986u.fsf@gmail.com> (Aaron Ecay's message of "Wed, 06 Nov 2013 22:55:53 -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)))






  reply	other threads:[~2013-11-08  4:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-07  3:55 bug#15826: 24.3.50; SMIE hangs in sh-mode Aaron Ecay
2013-11-08  4:34 ` Stefan Monnier [this message]
2013-11-09 20:01   ` Aaron Ecay
2013-11-10 13:49     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv61s34in3.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=15826-done@debbugs.gnu.org \
    --cc=aaronecay@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).