[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 6f334b6: * lisp/emacs-lisp/smie.el (smie-indent-com
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] master 6f334b6: * lisp/emacs-lisp/smie.el (smie-indent-comment-continue): Single-char case. |
Date: |
Fri, 19 Apr 2019 23:51:25 -0400 (EDT) |
branch: master
commit 6f334b6bc0f0c343bbf34c3fee0848aadb5d1d84
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>
* 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.
---
lisp/emacs-lisp/smie.el | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index e0293c3..f2163b2 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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 6f334b6: * lisp/emacs-lisp/smie.el (smie-indent-comment-continue): Single-char case.,
Stefan Monnier <=