Groovy-Emacs-Modes / groovy-emacs-modes

A groovy major mode, grails minor mode, and a groovy inferior mode.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Indentation failed by missing function

dove-young opened this issue · comments

My environment is Spacemacs 25.3 on Mac OS X 10.14.2

When I press tab key on any groovy file with groovy mode, I got this error.

Debugger entered--Lisp error: (void-function s-blank-str\?)
  (s-blank-str\? text-after-paren)
  (not (s-blank-str\? text-after-paren))
  (and (not (s-blank-str\? text-after-paren)) (not has-closing-paren) (not (string-match "->$" text-after-paren)))
  (cond (multiline-string-p (quote noindent)) (multiline-comment-p (indent-line-to (1+ (* groovy-indent-offset current-paren-depth)))) ((and (not (s-blank-str\? text-after-paren)) (not has-closing-paren) (not (string-match "->$" text-after-paren))) (let (open-paren-column) (save-excursion (goto-char current-paren-pos) (setq open-paren-column (current-column))) (indent-line-to (1+ open-paren-column)))) (t (let ((indent-level current-paren-depth)) (save-excursion (let* ((prev-line (groovy--backwards-to-prev-code-line)) (line-end (line-end-position)) (end-slashy-string (and prev-line ... ...))) (if (and prev-line (not end-slashy-string) (not ...) (or ... ...)) (progn (setq indent-level ...))))) (save-excursion (let (next-line) (while (and (setq line-after ...) (groovy--backwards-to-prev-code-line) (progn ... t) (groovy--line-ends-with-incomplete-block-statement-p)) (setq indent-level (1+ indent-level))))) (if (s-starts-with-p "." current-line) (progn (setq indent-level (1+ indent-level)))) (let ((blocks (groovy--enclosing-blocks)) (switch-count 0)) (let ((--dolist-tail-- blocks) block-symbol) (while --dolist-tail-- (setq block-symbol (car --dolist-tail--)) (if (equal block-symbol "switch") (progn ...)) (setq --dolist-tail-- (cdr --dolist-tail--)))) (if (> switch-count 0) (progn (setq indent-level (+ indent-level switch-count)) (if (s-matches-p groovy--case-regexp current-line) (progn ...)) (if (and ... ...) (progn ...))))) (indent-line-to (* groovy-indent-offset indent-level)))))
  (let* ((point-offset (- (current-column) (current-indentation))) (syntax-bol (syntax-ppss (line-beginning-position))) (multiline-string-p (nth 3 syntax-bol)) (multiline-comment-p (nth 4 syntax-bol)) (current-paren-depth (groovy--effective-paren-depth (line-beginning-position))) (current-paren-pos (nth 1 syntax-bol)) (current-paren-character (if (nth 1 syntax-bol) (progn (char-after (nth 1 syntax-bol))))) (text-after-paren (if current-paren-pos (progn (save-excursion (goto-char current-paren-pos) (s-trim (groovy--remove-comments ...)))))) (current-line (s-trim (groovy--current-line))) has-closing-paren) (if (or (s-starts-with-p "}" current-line) (s-starts-with-p ")" current-line) (s-starts-with-p "]" current-line)) (progn (setq has-closing-paren t) (setq current-paren-depth (1- current-paren-depth)))) (if (< current-paren-depth 0) (progn (setq current-paren-depth 0))) (cond (multiline-string-p (quote noindent)) (multiline-comment-p (indent-line-to (1+ (* groovy-indent-offset current-paren-depth)))) ((and (not (s-blank-str\? text-after-paren)) (not has-closing-paren) (not (string-match "->$" text-after-paren))) (let (open-paren-column) (save-excursion (goto-char current-paren-pos) (setq open-paren-column (current-column))) (indent-line-to (1+ open-paren-column)))) (t (let ((indent-level current-paren-depth)) (save-excursion (let* ((prev-line ...) (line-end ...) (end-slashy-string ...)) (if (and prev-line ... ... ...) (progn ...)))) (save-excursion (let (next-line) (while (and ... ... ... ...) (setq indent-level ...)))) (if (s-starts-with-p "." current-line) (progn (setq indent-level (1+ indent-level)))) (let ((blocks (groovy--enclosing-blocks)) (switch-count 0)) (let ((--dolist-tail-- blocks) block-symbol) (while --dolist-tail-- (setq block-symbol ...) (if ... ...) (setq --dolist-tail-- ...))) (if (> switch-count 0) (progn (setq indent-level ...) (if ... ...) (if ... ...)))) (indent-line-to (* groovy-indent-offset indent-level))))) (if (>= point-offset 0) (progn (move-to-column (+ (current-indentation) point-offset)))))
  groovy-indent-line()
  indent-for-tab-command(nil)
  funcall-interactively(indent-for-tab-command nil)
  call-interactively(indent-for-tab-command nil nil)
  command-execute(indent-for-tab-command)

I can fix it by adding the missing function

(defun s-blank-str? (s)
  "Is S nil or the empty string or string only contains whitespace?"
  (declare (pure t) (side-effect-free t))
  (or (s-blank? s) (s-blank? (s-trim s))))

I find the root cause. My s.el package too old.