emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 r117266: * lisp/progmodes/sh-script.el (sh-smie-s


From: Stefan Monnier
Subject: [Emacs-diffs] emacs-24 r117266: * lisp/progmodes/sh-script.el (sh-smie-sh-rules): For { after &&, don't
Date: Fri, 20 Jun 2014 14:23:37 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117266
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17721
committer: Stefan Monnier <address@hidden>
branch nick: emacs-24
timestamp: Fri 2014-06-20 10:23:30 -0400
message:
  * lisp/progmodes/sh-script.el (sh-smie-sh-rules): For { after &&, don't
  align with the surrounding parent.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/progmodes/sh-script.el    shscript.el-20091113204419-o5vbwnq5f7feedwu-727
  test/indent/shell.sh           shell.sh-20110209185043-iuyrh0is1gz0s4w6-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-06-20 08:47:10 +0000
+++ b/lisp/ChangeLog    2014-06-20 14:23:30 +0000
@@ -1,3 +1,8 @@
+2014-06-20  Stefan Monnier  <address@hidden>
+
+       * progmodes/sh-script.el (sh-smie-sh-rules): For { after &&, don't
+       align with the surrounding parent (bug#17721).
+
 2014-06-20  Eli Zaretskii  <address@hidden>
 
        * textmodes/texinfo.el (texinfo-mode): Set skeleton-end-newline

=== modified file 'lisp/progmodes/sh-script.el'
--- a/lisp/progmodes/sh-script.el       2014-06-20 01:05:40 +0000
+++ b/lisp/progmodes/sh-script.el       2014-06-20 14:23:30 +0000
@@ -1952,7 +1952,11 @@
                   (<= indent initial))
          `(column . ,(+ initial sh-indentation)))))
     (`(:before . ,(or `"(" `"{" `"["))
-     (if (smie-rule-hanging-p) (smie-rule-parent)))
+     (when (smie-rule-hanging-p)
+       (if (not (smie-rule-prev-p "&&" "||" "|"))
+          (smie-rule-parent)
+        (smie-backward-sexp 'halfexp)
+        `(column . ,(smie-indent-virtual)))))
     ;; FIXME: Maybe this handling of ;; should be made into
     ;; a smie-rule-terminator function that takes the substitute ";" as arg.
     (`(:before . ,(or `";;" `";&" `";;&"))

=== modified file 'test/indent/shell.sh'
--- a/test/indent/shell.sh      2014-06-20 01:05:40 +0000
+++ b/test/indent/shell.sh      2014-06-20 14:23:30 +0000
@@ -33,6 +33,14 @@
         bar
 }
 
+for foo in bar; do              #  bug#17721
+    [ -e $foo ] && {
+        echo t
+    } && {
+       echo r
+    }
+done
+
 echo -n $(( 5 << 2 ))
 # This should not be treated as a heredoc (bug#12770).
 2


reply via email to

[Prev in Thread] Current Thread [Next in Thread]