]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/smie.el (smie--hanging-eolp-function): New var.
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 20 Jun 2014 01:05:40 +0000 (21:05 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 20 Jun 2014 01:05:40 +0000 (21:05 -0400)
(smie-indent--hanging-p): Use it.
* lisp/progmodes/sh-script.el (sh-set-shell): Set it.

Fixes: debbugs:17621
lisp/ChangeLog
lisp/emacs-lisp/smie.el
lisp/progmodes/sh-script.el
lisp/term/xterm.el
test/indent/shell.sh

index 51c7332a9a9590869001cb2e4b980eeddfb904a5..7fdc6478979f8c3a69c6e4bb6377b857afff3b77 100644 (file)
@@ -1,3 +1,9 @@
+2014-06-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/smie.el (smie--hanging-eolp-function): New var.
+       (smie-indent--hanging-p): Use it.
+       * progmodes/sh-script.el (sh-set-shell): Set it (bug#17621).
+
 2014-06-20  Leo Liu  <sdl.web@gmail.com>
 
        * simple.el (read-quoted-char): Don't let help chars pop up help
index 3e40d37aacf1ee5aa8e132cbaeeb358f14b3ffd6..1a6011e712a570f61d2f040f5cd4754995d27ac1 100644 (file)
@@ -1155,6 +1155,15 @@ NUMBER                           offset by NUMBER, relative to a base token
 The functions whose name starts with \"smie-rule-\" are helper functions
 designed specifically for use in this function.")
 
+(defvar smie--hanging-eolp-function
+  ;; FIXME: This is a quick hack for 24.4.  Don't document it and replace with
+  ;; a well-defined function with a cleaner interface instead!
+  (lambda ()
+    (skip-chars-forward " \t")
+    (or (eolp)
+       (and ;; (looking-at comment-start-skip) ;(bug#16041).
+        (forward-comment (point-max))))))
+
 (defalias 'smie-rule-hanging-p 'smie-indent--hanging-p)
 (defun smie-indent--hanging-p ()
   "Return non-nil if the current token is \"hanging\".
@@ -1168,10 +1177,7 @@ the beginning of a line."
                    (not (eobp))
                    ;; Could be an open-paren.
                    (forward-char 1))
-               (skip-chars-forward " \t")
-               (or (eolp)
-                   (and ;; (looking-at comment-start-skip) ;(bug#16041).
-                        (forward-comment (point-max))))
+              (funcall smie--hanging-eolp-function)
                (point))))))
 
 (defalias 'smie-rule-bolp 'smie-indent--bolp)
index c407ba24e201cbdc8d72276b69dd3b98f9c0bff1..f248494eed1befac1db2653b7c6f155d339f2481 100644 (file)
@@ -2279,6 +2279,11 @@ Calls the value of `sh-set-shell-hook' if set."
         (let ((mksym (lambda (name)
                        (intern (format "sh-smie-%s-%s"
                                        sh-indent-supported-here name)))))
+         (add-function :around (local 'smie--hanging-eolp-function)
+                       (lambda (orig)
+                         (if (looking-at "[ \t]*\\\\\n")
+                             (goto-char (match-end 0))
+                           (funcall orig))))
           (smie-setup (symbol-value (funcall mksym "grammar"))
                       (funcall mksym "rules")
                       :forward-token  (funcall mksym "forward-token")
index 5d4112b24fdbd0757e3d83f616413659b9782a27..ba017e9938f75d08d8c1121b37be70e7648ab20e 100644 (file)
@@ -510,8 +510,8 @@ The relevant features are:
           ;; Gnome terminal 2.32.1 reports 1;2802;0
           (setq version 200))
         (when (equal (match-string 1 str) "83")
-          ;; OSX's Terminal.app (version 2.3 (309), which returns 83;40003;0)
-          ;; seems to also lack support for some of these (bug#17607).
+          ;; `screen' (which returns 83;40003;0) seems to also lack support for
+          ;; some of these (bug#17607).
           (setq version 240))
         ;; If version is 242 or higher, assume the xterm supports
         ;; reporting the background color (TODO: maybe earlier
index 74985a401d447f144a8ff9ba92eea75517221dae..ed6bcf8da3a1a55daa4d965312023dc452ed455b 100755 (executable)
@@ -25,7 +25,11 @@ esac
 
 {                              # bug#17621
     foo1 &&
-        foo2 &&
+       foo2 &&
+        bar
+
+    foo1 &&     \
+        foo2 && \
         bar
 }