emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/scala-mode d4cccb0 112/217: scala-mode:set-scala-syntax-mo


From: ELPA Syncer
Subject: [nongnu] elpa/scala-mode d4cccb0 112/217: scala-mode:set-scala-syntax-mode to support sbt-mode
Date: Sun, 29 Aug 2021 11:30:54 -0400 (EDT)

branch: elpa/scala-mode
commit d4cccb080530d761585bb95133487494da8c49bd
Author: Heikki Vesalainen <heikkivesalainen@yahoo.com>
Commit: Heikki Vesalainen <heikkivesalainen@yahoo.com>

    scala-mode:set-scala-syntax-mode to support sbt-mode
---
 scala-mode2-syntax.el |  3 ++-
 scala-mode2.el        | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/scala-mode2-syntax.el b/scala-mode2-syntax.el
index ace37dc..93f4979 100644
--- a/scala-mode2-syntax.el
+++ b/scala-mode2-syntax.el
@@ -219,7 +219,6 @@
       (scala-syntax:looking-at-stableIdOrPath)))
 
 
-
 (defun scala-syntax:regexp-for-id (id)
   (let ((prefix-regex 
          (if (string-match scala-syntax:alphaid-re id)
@@ -743,6 +742,7 @@ id, reserved symbol, keyword, block, or literal. Delimiters 
(.,;)
 and comments are skipped silently. Position is placed at the
 beginning of the skipped expression."
   (interactive)
+  (syntax-propertize (point-max))
   ;; emacs knows how to properly skip: lists, varid, capitalid,
   ;; strings, symbols, chars, quotedid. What we have to handle here is
   ;; most of all ids made of op chars
@@ -764,6 +764,7 @@ beginning of the skipped expression."
   silently. Position is placed at the beginning of the skipped
   expression."
   (interactive)
+  (syntax-propertize (point))
   ;; for implementation comments, see scala-syntax:forward-sexp
   (forward-comment (- (buffer-size)))
   (while (> 0 (+ (skip-syntax-backward " ")
diff --git a/scala-mode2.el b/scala-mode2.el
index 40e29f3..5e5b5b2 100644
--- a/scala-mode2.el
+++ b/scala-mode2.el
@@ -62,6 +62,21 @@ If there is no plausible default, return nil."
       (scala-syntax:forward-sexp))))
 
 ;;;###autoload
+(defun scala-mode:set-scala-syntax-mode ()
+  "Sets the syntax-table and other realted variables for the current buffer to 
those of scala-mode. Can be used to make some other major mode (such as 
sbt-mode) use scala syntax-table."
+  (set-syntax-table scala-syntax:syntax-table)
+  (scala-mode:make-local-variables
+   'syntax-propertize-function
+   'parse-sexp-lookup-properties
+   'forward-sexp-function)  
+
+  (add-hook 'syntax-propertize-extend-region-functions
+            'scala-syntax:propertize-extend-region)
+  (setq syntax-propertize-function      'scala-syntax:propertize
+        parse-sexp-lookup-properties    t
+        forward-sexp-function           'scala-mode:forward-sexp-function))
+
+;;;###autoload
 (define-derived-mode scala-mode prog-mode "Scala"
   "Major mode for editing scala code.
 
@@ -79,6 +94,7 @@ When started, runs `scala-mode-hook'.
    'font-lock-defaults
    'paragraph-start
    'paragraph-separate
+   'parse-sexp-lookup-properties
    'fill-paragraph-function
    'adaptive-fill-function
    'adaptive-fill-first-line-regexp



reply via email to

[Prev in Thread] Current Thread [Next in Thread]