summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/smie.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2014-06-19 21:05:40 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2014-06-19 21:05:40 -0400
commit500dce5f4d2a08570177d9b1019fa922f07e8508 (patch)
tree4e36479096a23e12e7855610aebd8dd8f5f89f5a /lisp/emacs-lisp/smie.el
parent2c25d5e6216d556a85f9c01bba5671f41637e11f (diff)
downloademacs-500dce5f4d2a08570177d9b1019fa922f07e8508.tar.gz
emacs-500dce5f4d2a08570177d9b1019fa922f07e8508.tar.bz2
emacs-500dce5f4d2a08570177d9b1019fa922f07e8508.zip
* 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
Diffstat (limited to 'lisp/emacs-lisp/smie.el')
-rw-r--r--lisp/emacs-lisp/smie.el14
1 files changed, 10 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index 3e40d37aacf..1a6011e712a 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -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)