summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2019-04-19 23:50:58 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2019-04-19 23:51:21 -0400
commit6f334b6bc0f0c343bbf34c3fee0848aadb5d1d84 (patch)
treeff2f8b4f92f8fd09bfe8b901d07be791ab2b9e64 /lisp
parent4ff6c657a206a9c5ff6f3cda26996fda00e7598d (diff)
downloademacs-6f334b6bc0f0c343bbf34c3fee0848aadb5d1d84.tar.gz
* 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.
Diffstat (limited to 'lisp')
-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."
(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)