* lisp/emacs-lisp/smie.el (smie-indent-comment-continue): Single-char case.

Make it so the comment-continue is aligned with the comment-start when
comment-start is a single-char.
This commit is contained in:
Stefan Monnier 2019-04-19 23:50:58 -04:00
parent 4ff6c657a2
commit 6f334b6bc0

View file

@ -1648,11 +1648,33 @@ should not be computed on the basis of the following token."
(let ((ppss (syntax-ppss)))
(save-excursion
(forward-line -1)
(if (<= (point) (nth 8 ppss))
(progn (goto-char (1+ (nth 8 ppss))) (current-column))
(skip-chars-forward " \t")
(if (looking-at (regexp-quote continue))
(current-column))))))))
(let ((start (nth 8 ppss)))
(if (<= (point) start)
(progn
(goto-char start)
(if (not (and comment-start-skip
(looking-at comment-start-skip)))
(forward-char 1)
(goto-char (match-end 0))
(skip-chars-backward " \t")
;; Try to align the first char of the comment-continue
;; with the second char of the comment-start or the
;; first char if the comment-start is made of
;; a single char. E.g.
;;
;; /* foo
;; * bar */
;;
;; but
;;
;; { foo
;; | bar }
(goto-char (if (eq (point) (1+ start))
start (1+ start))))
(current-column))
(skip-chars-forward " \t")
(if (looking-at (regexp-quote continue))
(current-column)))))))))
(defun smie-indent-comment-close ()
(and (boundp 'comment-end-skip)