[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/scala-mode 4581995 111/217: defined find-tag-default-funct
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/scala-mode 4581995 111/217: defined find-tag-default-function |
Date: |
Sun, 29 Aug 2021 11:30:54 -0400 (EDT) |
branch: elpa/scala-mode
commit 45819956fcecc3828b5e4a7bbd9e6376cffe1c44
Author: Heikki Vesalainen <heikkivesalainen@yahoo.com>
Commit: Heikki Vesalainen <heikkivesalainen@yahoo.com>
defined find-tag-default-function
---
scala-mode2-syntax.el | 11 +++++++++++
scala-mode2.el | 28 ++++++++++++++++++++++++++++
2 files changed, 39 insertions(+)
diff --git a/scala-mode2-syntax.el b/scala-mode2-syntax.el
index 1e90354..ace37dc 100644
--- a/scala-mode2-syntax.el
+++ b/scala-mode2-syntax.el
@@ -218,6 +218,17 @@
(looking-at scala-syntax:literal-re)
(scala-syntax:looking-at-stableIdOrPath)))
+
+
+(defun scala-syntax:regexp-for-id (id)
+ (let ((prefix-regex
+ (if (string-match scala-syntax:alphaid-re id)
+ "\\b" (concat "\\(^\\|[^" scala-syntax:opchar-group "]\\)")))
+ (suffix-regex
+ (if (string-match scala-syntax:op-re (substring id -1 nil))
+ (concat "\\([^" scala-syntax:opchar-group "]\\|$\\)") "\\b")))
+ (concat prefix-regex id suffix-regex)))
+
;;;
;;; Other regular expressions
;;;
diff --git a/scala-mode2.el b/scala-mode2.el
index 174c7c7..40e29f3 100644
--- a/scala-mode2.el
+++ b/scala-mode2.el
@@ -26,6 +26,32 @@
(defmacro scala-mode:make-local-variables (&rest quoted-names)
(cons 'progn (mapcar #'(lambda (quoted-name) `(make-local-variable
,quoted-name)) quoted-names)))
+(defun scala-mode:find-tag ()
+ "Determine default tag to search for, based on text at point.
+If there is no plausible default, return nil."
+ (let (from to)
+ (when (and (progn
+ ;; Look at text around `point'.
+ (save-excursion
+ (if (< 0 (skip-chars-backward scala-syntax:opchar-group))
+ (if (= (char-before) ?_)
+ (skip-syntax-backward "w_"))
+ (skip-syntax-backward "w_"))
+ (setq from (point)))
+ (save-excursion
+ (skip-syntax-forward "w_.") (setq to (point)))
+ (save-excursion
+ (ignore-errors (scala-syntax:backward-sexp)) (setq from
(max from (point))))
+ (save-excursion
+ (goto-char from)
+ (ignore-errors (scala-syntax:forward-sexp)) (setq to (min
to (point))))
+ (> to from))
+ (save-excursion
+ (goto-char from)
+ (and (looking-at scala-syntax:id-re)
+ (not (looking-at scala-syntax:keywords-unsafe-re)))))
+ (buffer-substring-no-properties from to))))
+
(defun scala-mode:forward-sexp-function (&optional count)
(unless count (setq count 1))
@@ -62,6 +88,7 @@ When started, runs `scala-mode-hook'.
'comment-column
'comment-multi-line
'forward-sexp-function
+ 'find-tag-default-function
'indent-line-function
'indent-tabs-mode
'join-line)
@@ -93,6 +120,7 @@ When started, runs `scala-mode-hook'.
comment-multi-line t
forward-sexp-function 'scala-mode:forward-sexp-function
+ find-tag-default-function 'scala-mode:find-tag
indent-line-function 'scala-indent:indent-line
indent-tabs-mode nil
join-line 'scala-indent:join-line
- [nongnu] elpa/scala-mode 94f34b2 077/217: Rm trailing whitespace from all project files., (continued)
- [nongnu] elpa/scala-mode 94f34b2 077/217: Rm trailing whitespace from all project files., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 5d2416f 088/217: Reverted unintended removal of whitespace deletion hook, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 56280a2 062/217: Made scala-indent:indent-on-scaladoc-asterisk be an integral part of the mode., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode caaebbd 078/217: Rm unneccessary `integerp` invocation., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode b251627 079/217: Comment out example binding of `scala-indent:insert-asterisk-on-multiline-comment`, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode f4b5a6b 095/217: Add .sbt to config, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 037d202 090/217: Merge pull request #44 from vn971/patch-1, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode cc2db35 100/217: indent case body only if first case statement is on its own line, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode e3f91eb 101/217: octal escapes for chars and strings, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 74e5194 108/217: sbt support for scala-mode2, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 4581995 111/217: defined find-tag-default-function,
ELPA Syncer <=
- [nongnu] elpa/scala-mode 2e514f8 118/217: proper instructions for sbt-mode, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode cddd00c 119/217: provide a package target to make a marmalade compatible package, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode ecbed5f 121/217: use the existing ELISP_COMMAND instead of EMACSBIN, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode c53742a 122/217: add Marmalade instructions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 3df7da0 133/217: Merge pull request #66 from corruptmemory/improved-syntax, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 69e071e 140/217: scala-syntax:forward-modifiers: Unmatched [ or [^ error, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode d8a141b 125/217: Makefile clean-up, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 34888c0 142/217: Update README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode f03a582 141/217: Merge pull request #83 from ancane/master, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 461f9a5 134/217: Fix issue #63 and names with _ and reserved word, ELPA Syncer, 2021/08/29