aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2019-04-19 23:50:58 -0400
committerStefan Monnier2019-04-19 23:51:21 -0400
commit6f334b6bc0f0c343bbf34c3fee0848aadb5d1d84 (patch)
treeff2f8b4f92f8fd09bfe8b901d07be791ab2b9e64
parent4ff6c657a206a9c5ff6f3cda26996fda00e7598d (diff)
downloademacs-6f334b6bc0f0c343bbf34c3fee0848aadb5d1d84.tar.gz
emacs-6f334b6bc0f0c343bbf34c3fee0848aadb5d1d84.zip
* 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.
-rw-r--r--lisp/emacs-lisp/smie.el32
1 files changed, 27 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index e0293c3cbb4..f2163b243ee 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -1648,11 +1648,33 @@ should not be computed on the basis of the following token."
1648 (let ((ppss (syntax-ppss))) 1648 (let ((ppss (syntax-ppss)))
1649 (save-excursion 1649 (save-excursion
1650 (forward-line -1) 1650 (forward-line -1)
1651 (if (<= (point) (nth 8 ppss)) 1651 (let ((start (nth 8 ppss)))
1652 (progn (goto-char (1+ (nth 8 ppss))) (current-column)) 1652 (if (<= (point) start)
1653 (skip-chars-forward " \t") 1653 (progn
1654 (if (looking-at (regexp-quote continue)) 1654 (goto-char start)
1655 (current-column)))))))) 1655 (if (not (and comment-start-skip
1656 (looking-at comment-start-skip)))
1657 (forward-char 1)
1658 (goto-char (match-end 0))
1659 (skip-chars-backward " \t")
1660 ;; Try to align the first char of the comment-continue
1661 ;; with the second char of the comment-start or the
1662 ;; first char if the comment-start is made of
1663 ;; a single char. E.g.
1664 ;;
1665 ;; /* foo
1666 ;; * bar */
1667 ;;
1668 ;; but
1669 ;;
1670 ;; { foo
1671 ;; | bar }
1672 (goto-char (if (eq (point) (1+ start))
1673 start (1+ start))))
1674 (current-column))
1675 (skip-chars-forward " \t")
1676 (if (looking-at (regexp-quote continue))
1677 (current-column)))))))))
1656 1678
1657(defun smie-indent-comment-close () 1679(defun smie-indent-comment-close ()
1658 (and (boundp 'comment-end-skip) 1680 (and (boundp 'comment-end-skip)