[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/scala-mode be89855 084/217: Multi-line comment indentation
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/scala-mode be89855 084/217: Multi-line comment indentation and asterisk-insertion on mid-line return. |
Date: |
Sun, 29 Aug 2021 11:30:48 -0400 (EDT) |
branch: elpa/scala-mode
commit be8985583dbd8a6b2a7ab690de681246e08e2c0d
Author: Evan Meagher <evm@twitter.com>
Commit: Heikki Vesalainen <heikkivesalainen@yahoo.com>
Multi-line comment indentation and asterisk-insertion on mid-line return.
Also:
- Rm unnecessary `looking-at` predicate from
`scala-indent:indent-on-scaladoc-asterisk`.
- Only insert asterisk when:
1. Inside scaladoc comment and
2. Previous line had leading asterisk margin or was the starting line of
the comment.
Closes #41
---
scala-mode-indent.el | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/scala-mode-indent.el b/scala-mode-indent.el
index bb8457e..8f05e3a 100644
--- a/scala-mode-indent.el
+++ b/scala-mode-indent.el
@@ -873,18 +873,29 @@ the line."
(let ((state (syntax-ppss)))
(when (and (integerp (nth 4 state))
(looking-back "^\\s *\\*" (line-beginning-position)))
- (when (and scala-indent:add-space-for-scaladoc-asterisk
- (looking-at "\\s *$"))
+ (when scala-indent:add-space-for-scaladoc-asterisk
(insert " "))
(scala-indent:indent-line-to (scala-indent:scaladoc-indent (nth 8
state))))))
(defun scala-indent:insert-asterisk-on-multiline-comment ()
"Insert an asterisk at the end of the current line when at the beginning
of a line inside a multi-line comment "
- (let ((state (syntax-ppss)))
+ (let ((state (syntax-ppss))
+ (comment-start-pos (nth 8 (syntax-ppss))))
(when (and (integerp (nth 4 state))
- (string-match-p "^\\s-*$" (thing-at-point 'line)))
- (end-of-line)
+ ; Ensure that we're inside a scaladoc comment
+ (string-match-p "^/\\*\\*[^\\*]"
+ (buffer-substring-no-properties
+ comment-start-pos
+ (+ comment-start-pos 4)))
+ ; Ensure that the previous line had a leading asterisk or was
the comment start.
+ (let ((prev-line (buffer-substring-no-properties
+ (line-beginning-position 0)
+ (line-end-position 0))))
+ (or
+ (string-match-p "^\\s-*\\*" prev-line)
+ (string-match-p "\\s-*/\\*\\*" prev-line))))
+ (skip-syntax-forward " ")
(insert "*")
(scala-indent:indent-on-scaladoc-asterisk))))
- [nongnu] elpa/scala-mode d1fbe2d 171/217: Implemented prettify/conceal with a base set of rules. (#108), (continued)
- [nongnu] elpa/scala-mode d1fbe2d 171/217: Implemented prettify/conceal with a base set of rules. (#108), ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 2e8fd35 180/217: Fix for fill-paragraph with prefix arg. Fixes #125. (#126), ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 7e63002 182/217: Add "inline" keyword from scalameta (#128), ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 1357eba 183/217: Fix for #94, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 730e16d 186/217: Merge pull request #130 from ensime/fix/120, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 1dd5825 085/217: Added comment syntax for bash preambles (#!...!#) in scala script files, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 16d6f36 067/217: Added a not to README about font-lock-doc-face, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode b55ca83 066/217: Merge pull request #23 from hvesalai/issue22, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode aa38dae 083/217: Fixes #38: 100% CPU usage for multi-line strings in some cases., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 0af3b07 069/217: Added Makefile and fixed compilation warnings, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode be89855 084/217: Multi-line comment indentation and asterisk-insertion on mid-line return.,
ELPA Syncer <=
- [nongnu] elpa/scala-mode 711091a 087/217: moved provides to end of files, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 6312b36 082/217: Make the code agreeable to Emacs-Lisp mode, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 18a52f0 094/217: Update installation instructions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode a1ea0b7 097/217: Proper instructions and autoload settings for package-based install, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 763c93c 107/217: scala-indent:join-line, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode c62ecf9 109/217: Update README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode aea047a 104/217: Create .gitignore with *.elc, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode d4cccb0 112/217: scala-mode:set-scala-syntax-mode to support sbt-mode, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode c9dd697 103/217: alphaid-re for SIP11 support, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 89c7138 102/217: Merge pull request #52 from non/topic/octal-escapes, ELPA Syncer, 2021/08/29