branch: elpa/scala-mode commit 8d4f34fe58b1c2699f01eb5b5104ed0a47adfc0f Author: Heikki Vesalainen <heikkivesalai...@yahoo.com> Commit: Heikki Vesalainen <heikkivesalai...@yahoo.com>
Use font-lock-doc-face for scaladoc comments --- README.md | 4 +++- scala-mode-fontlock.el | 9 +++++++++ scala-mode-paragraph.el | 2 +- scala-mode.el | 4 +++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 92f7193..6593f82 100644 --- a/README.md +++ b/README.md @@ -321,6 +321,8 @@ customization variable *frame-background-mode* to *dark* (use **M-x** ## Future work +- syntax-begin-function for reliably fontifying elements which span + multiple lines - beginning-of-defun, end-of-defun - indent case, etc after they are typed (use first space as self-insert-hook) - indent multi-line strings with margin correctly @@ -341,4 +343,4 @@ Contributors and valuable feedback: - Ray Racine - Eiríkr Åsheim (aka Erik Osheim) - Seth Tisue -- Gary Pamparà \ No newline at end of file +- Gary Pamparà diff --git a/scala-mode-fontlock.el b/scala-mode-fontlock.el index bd78a97..588692d 100644 --- a/scala-mode-fontlock.el +++ b/scala-mode-fontlock.el @@ -467,3 +467,12 @@ Does not continue past limit. (scala-font-lock:mark-integerLiteral . font-lock-constant-face) )) + +(defun scala-font-lock:syntactic-face-function (state) + "Return correct face for string or comment" + (if (and (integerp (nth 4 state)) + (save-excursion + (goto-char (nth 8 state)) + (looking-at "/\\*\\*\\($\\|[^*]\\)"))) + font-lock-doc-face + (if (nth 3 state) font-lock-string-face font-lock-comment-face))) diff --git a/scala-mode-paragraph.el b/scala-mode-paragraph.el index c5679bf..ef14e60 100644 --- a/scala-mode-paragraph.el +++ b/scala-mode-paragraph.el @@ -103,7 +103,7 @@ (fill-paragraph)) t) ((eq (nth 4 state) t) - ;; let normal fill-function handle this + ;; line comment, let normal fill-function handle this nil) ((eq (nth 3 state) t) ;; mask multi-line strings and fill. diff --git a/scala-mode.el b/scala-mode.el index 716ae05..6ba9915 100644 --- a/scala-mode.el +++ b/scala-mode.el @@ -51,6 +51,7 @@ When started, runs `scala-mode-hook'. 'scala-mode:debug-messages 'post-self-insert-hook 'syntax-propertize-function + 'font-lock-syntactic-face-function 'font-lock-defaults 'paragraph-start 'paragraph-separate @@ -74,8 +75,9 @@ When started, runs `scala-mode-hook'. parse-sexp-lookup-properties t ;; TODO: font-lock - font-lock-defaults '((scala-font-lock:keywords) + font-lock-defaults '(scala-font-lock:keywords nil) + font-lock-syntactic-face-function 'scala-font-lock:syntactic-face-function ;; TODO: beginning-of-defun-function, end-of-defun-function