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

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

[nongnu] elpa/scala-mode c3ea76f 009/217: fixed indenting of if body (an


From: ELPA Syncer
Subject: [nongnu] elpa/scala-mode c3ea76f 009/217: fixed indenting of if body (and probably other things)
Date: Sun, 29 Aug 2021 11:30:34 -0400 (EDT)

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

    fixed indenting of if body (and probably other things)
    
    closes #1
---
 scala-mode-syntax.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/scala-mode-syntax.el b/scala-mode-syntax.el
index eed7fc3..1313f7b 100644
--- a/scala-mode-syntax.el
+++ b/scala-mode-syntax.el
@@ -613,15 +613,18 @@ and whitespace are skipped before matching."
     (scala-syntax:skip-forward-ignorable)
     (looking-at re)))
 
-(defun scala-syntax:looking-back-token (re &optional limit)
+(defun scala-syntax:looking-back-token (re &optional max-chars)
   "Return the start position of the token matched by re, if the
 current position is preceeded by it, or nil if not. All ignorable
 comments and whitespace are ignored, i.e. does not search past an
-empty line. Expects to be outside of comment."
+empty line. Expects to be outside of comment. A limit for the
+search is calculated based on max-chars. The function won't look
+further than max-chars starting after skipping any ignorable."
   (save-excursion
     ;; skip back all comments
     (scala-syntax:skip-backward-ignorable)
-    (let ((end (point)))
+    (let ((end (point))
+          (limit (when max-chars (- (point) max-chars))))
       ;; skip back punctuation or ids (words and related symbols and 
delimiters)
       (or (/= 0 (skip-chars-backward scala-syntax:delimiter-group limit))
           (/= 0 (skip-syntax-backward "." limit))



reply via email to

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