1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-03 11:33:37 +00:00

* lisp/emacs-lisp/smie.el (smie--hanging-eolp-function): New var.

(smie-indent--hanging-p): Use it.
* lisp/progmodes/sh-script.el (sh-set-shell): Set it.

Fixes: debbugs:17621
This commit is contained in:
Stefan Monnier 2014-06-19 21:05:40 -04:00
parent 2c25d5e621
commit 500dce5f4d
5 changed files with 28 additions and 7 deletions

View 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

View 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)

View 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")

View 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

View File

@ -25,7 +25,11 @@ esac
{ # bug#17621
foo1 &&
foo2 &&
foo2 &&
bar
foo1 && \
foo2 && \
bar
}