[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/scala-mode 59cdd94 074/217: Add `scala-indent:use-javadoc-
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/scala-mode 59cdd94 074/217: Add `scala-indent:use-javadoc-style` defcustom. |
Date: |
Sun, 29 Aug 2021 11:30:46 -0400 (EDT) |
branch: elpa/scala-mode
commit 59cdd94ae7c9d4d67f58f2fc8d95266bde0ca297
Author: Evan Meagher <evm@twitter.com>
Commit: Evan Meagher <evm@twitter.com>
Add `scala-indent:use-javadoc-style` defcustom.
When non-nil, multi-line comments are indented according to Javadoc style
(i.e. indented to the first asterisk). This overrides the Scaladoc behavior
of indenting comment lines to the second asterisk.
---
README.md | 32 ++++++++++++++++++++++----------
scala-mode-indent.el | 12 ++++++++++--
2 files changed, 32 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index 5a9d95b..c7653f4 100644
--- a/README.md
+++ b/README.md
@@ -192,17 +192,29 @@ val xs = for (i <- 1 to 10)
The start of a multi-line comment is indented to the same level with
code.
-If a multi-line comment begins with `/**` it is considered to be a
-scaladoc comment. Scaladoc comments are indented acording to the
-scaladoc style guide.
+By default, if a multi-line comment begins with `/**` it is considered
+to be a Scaladoc comment. Scaladoc comments are indented according to
+the Scaladoc style guide.
```
-/** This is a scaladoc comment.
+/** This is a Scaladoc comment.
* 2nd line.
*/
```
-Other multi-line comments are indented under the first asterisk.
+Alternatively, if the configurable variable *scala-indent:use-javadoc-style*
+is set to `t`, multi-line comments beginning with `/**` will be indented
+according to the Javadoc style, wherein all following lines are indented
+under the first asterisk.
+
+```
+/**
+ * This is a Javadoc-style comment.
+ * 2nd line.
+ */
+```
+
+All other multi-line comments are indented under the first asterisk.
```
/****
@@ -217,7 +229,7 @@ Other multi-line comments are indented under the first
asterisk.
Typing an asterisk in multi-line comment region, at the start of a
line, will trigger indent. Furthermore, if the configurable variable
-*scala-indent:add-space-for-scaladoc-asterisk* is t (default) and the
+*scala-indent:add-space-for-scaladoc-asterisk* is `t` (default) and the
asterisk was the last character on the line, a space will be inserted
after it.
@@ -237,7 +249,7 @@ or a mode-hook.
Basic emacs motion will work as expected.
Text paragraph motion (i.e. *forward-paragraph*, *backward-paragraph*)
-works inside comments and multi-line strings, and it respect scaladoc's
+works inside comments and multi-line strings, and it respect Scaladoc's
wiki-style markup.
The commands *forward-sexp* and *backward-sexp* ( **M-C-f**, **M-C-b**
@@ -309,9 +321,9 @@ can do so in the mode hook (set *indent-tabs-mode* to t).
Highlighting code is still a work in progress. Feedback on how it
should work is welcomed as issues to this github project.
-It may come as a surprise to some that scaladoc comments (comments that
+It may come as a surprise to some that Scaladoc comments (comments that
start with exactly `/** `) are highlighted in the same color as
-strings. This is because scaladoc comments get the font-lock-doc-face,
+strings. This is because Scaladoc comments get the font-lock-doc-face,
which is usually an alias for font-lock-string-face (a heritage from
lisp, the native language of emacs, where document comments are
strings). If this really bothers you, you may customize the face (use
@@ -359,7 +371,7 @@ or put a blank line after it.
- beginning-of-defun, end-of-defun
- movement commands to move to previous or next definition (val,
var, def, class, trait, object)
-- highlight headings and annotations inside scaladoc specially (use
+- highlight headings and annotations inside Scaladoc specially (use
underline for headings)
- highlight variables in string interpolation (scala 2.10)
diff --git a/scala-mode-indent.el b/scala-mode-indent.el
index 93caf73..18f5079 100644
--- a/scala-mode-indent.el
+++ b/scala-mode-indent.el
@@ -120,6 +120,13 @@ when it is added to an empty line."
:type 'boolean
:group 'scala)
+(defcustom scala-indent:use-javadoc-style nil
+ "When non-nil, multi-line comments are indented according to Javadoc
+style (i.e. indented to the first asterisk). This overrides the
+Scaladoc behavior of indenting comment lines to the second asterisk."
+ :type 'boolean
+ :group 'scala)
+
(defun scala-indent:run-on-strategy ()
"Returns the currently effecti run-on strategy"
(or scala-indent:effective-run-on-strategy
@@ -803,10 +810,11 @@ comment is outside the comment region. "
(goto-char comment-start-pos)
(when (looking-at "/\\*+")
(goto-char
- (if (= (- (match-end 0) (match-beginning 0)) 3)
+ (if (and (not scala-indent:use-javadoc-style)
+ (= (- (match-end 0) (match-beginning 0)) 3))
(- (match-end 0) 1)
(+ (match-beginning 0) 1)))
- (current-column))))
+ (current-column))))
(defun scala-indent:indent-on-parentheses ()
(when (and (= (char-syntax (char-before)) ?\))
- [nongnu] elpa/scala-mode a1ff6f3 202/217: feat: add Scala 3 keywords, (continued)
- [nongnu] elpa/scala-mode a1ff6f3 202/217: feat: add Scala 3 keywords, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 46bb948 198/217: Fix #155, remove ob-scala.el, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode a2a1b1d 208/217: compile mode with sbt thin client, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 54fa36f 200/217: Merge pull request #159 from kpbochenek/fix-files-association-alist, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 5058a85 204/217: doc: clarify Scala versions supported, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 0c5ed9e 022/217: deleted example files, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 61a511f 021/217: Update README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode fe5c2c4 031/217: Fixes #11: was still using the slow regexp, not faster, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 1a3d958 029/217: forward/backward-sexp, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode e30b35a 008/217: Indentation working, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 59cdd94 074/217: Add `scala-indent:use-javadoc-style` defcustom.,
ELPA Syncer <=
- [nongnu] elpa/scala-mode 347faeb 075/217: Add Evan Meagher to contributors list., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 081a92b 081/217: scala-indent:remove-indent-from-previous-empty-line, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 0fac9ae 014/217: removed debug messages, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 9476d4c 018/217: Fixes #3: alignment of else inside parens, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 3f724ed 030/217: Add the scala-indent:pad-equals setting., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 6257e3b 033/217: Renamed bad-equals to indent-value-expression. Added info to README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 4e3a24f 043/217: Updated Examples.md to reflect issues already solved, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 338ff73 060/217: Changed the indent defaults, closes #19, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 6c257f6 057/217: Enhanced support for comments and multi-line strings, including, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 68ca175 056/217: Fixes #20, the cons bug (a :: b :: Nil) as well as improving some of, ELPA Syncer, 2021/08/29