[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/julia-mode e22debdd96 13/14: Merge pull request #177 from
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/julia-mode e22debdd96 13/14: Merge pull request #177 from non-Jedi/li1-imenu-fixes |
Date: |
Wed, 12 Jul 2023 04:00:22 -0400 (EDT) |
branch: elpa/julia-mode
commit e22debdd96709f115a1bd643aa3584fb0b37455f
Merge: c798df5a4e f08a73d6fb
Author: Tamas K. Papp <tkpapp@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #177 from non-Jedi/li1-imenu-fixes
@li1 imenu fixes now tested
---
julia-mode-tests.el | 9 +++++++++
julia-mode.el | 33 +++++++++++++++++----------------
2 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/julia-mode-tests.el b/julia-mode-tests.el
index e77cf03818..5c4d8832f9 100644
--- a/julia-mode-tests.el
+++ b/julia-mode-tests.el
@@ -749,6 +749,15 @@ var = func(begin
(julia--should-font-lock c (- (length c) 1) font-lock-string-face)
(julia--should-font-lock c (length c) nil)))))
+(ert-deftest julia--test-const-def-font-lock ()
+ (let ((string "const foo = \"bar\""))
+ (julia--should-font-lock string 1 font-lock-keyword-face) ; const
+ (julia--should-font-lock string 5 font-lock-keyword-face) ; const
+ (julia--should-font-lock string 7 font-lock-variable-name-face) ; foo
+ (julia--should-font-lock string 9 font-lock-variable-name-face) ; foo
+ (julia--should-font-lock string 11 nil) ; =
+ ))
+
;;; Movement
(ert-deftest julia--test-beginning-of-defun-assn-1 ()
"Point moves to beginning of single-line assignment function."
diff --git a/julia-mode.el b/julia-mode.el
index 7f8f7c171a..47c325e2d4 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -288,6 +288,13 @@ partial match for LaTeX completion, or `nil' when not
applicable."
"abstract type" "primitive type" "struct" "mutable
struct")
(1+ space) (group (1+ (or word (syntax symbol))))))
+(defconst julia-const-def-regex
+ (rx
+ bol (zero-or-more space)
+ "const" space
+ (group (one-or-more alnum)) (zero-or-more space)
+ "=" (not (any "="))))
+
(defconst julia-type-annotation-regex
(rx "::" (0+ space) (group (1+ (or word (syntax symbol))))))
@@ -337,6 +344,10 @@ partial match for LaTeX completion, or `nil' when not
applicable."
(list julia-function-regex 1 'font-lock-function-name-face)
(list julia-function-assignment-regex 1 'font-lock-function-name-face)
(list julia-type-regex 1 'font-lock-type-face)
+ ;; Per the elisp manual, font-lock-variable-name-face is for variables
being defined or
+ ;; declared. It is difficult identify this consistently in julia (see issue
#2). For now,
+ ;; we only font-lock constant definitions.
+ (list julia-const-def-regex 1 'font-lock-variable-name-face)
;; font-lock-type-face is for the point of type definition rather
;; than usage, but using for type annotations is an acceptable pun.
(list julia-type-annotation-regex 1 'font-lock-type-face)
@@ -791,22 +802,12 @@ Return nil if point is not in a function, otherwise
point."
;;; IMENU
(defvar julia-imenu-generic-expression
;; don't use syntax classes, screws egrep
- '(("Function (_)" "[ \t]*function[ \t]+\\(_[^ \t\n]*\\)" 1)
- ("Function" "^[ \t]*function[ \t]+\\([^_][^\t\n]*\\)" 1)
- ("Const" "[ \t]*const \\([^ \t\n]*\\)" 1)
- ("Type" "^[ \t]*[a-zA-Z0-9_]*type[a-zA-Z0-9_]* \\([^ \t\n]*\\)" 1)
- ("Require" " *\\(\\brequire\\)(\\([^ \t\n)]*\\)" 2)
- ("Include" " *\\(\\binclude\\)(\\([^ \t\n)]*\\)" 2)
- ;; ("Classes" "^.*setClass(\\(.*\\)," 1)
- ;; ("Coercions" "^.*setAs(\\([^,]+,[^,]*\\)," 1) ; show from and to
- ;; ("Generics" "^.*setGeneric(\\([^,]*\\)," 1)
- ;; ("Methods" "^.*set\\(Group\\|Replace\\)?Method(\"\\(.+\\)\"," 2)
- ;; ;;[ ]*\\(signature=\\)?(\\(.*,?\\)*\\)," 1)
- ;; ;;
- ;; ;;("Other" "^\\(.+\\)\\s-*<-[
\t\n]*[^\\(function\\|read\\|.*data\.frame\\)]" 1)
- ;; ("Package" "^.*\\(library\\|require\\)(\\(.*\\)," 2)
- ;; ("Data" "^\\(.+\\)\\s-*<-[ \t\n]*\\(read\\|.*data\.frame\\).*(" 1)))
- ))
+ `(("Function" ,julia-function-regex 1)
+ ("Function" ,julia-function-assignment-regex 1)
+ ("Const" ,julia-const-def-regex 1)
+ ("Type" ,julia-type-regex 1)
+ ("Require" " *\\(\\brequire\\)(\\([^ \t\n)]*\\)" 2)
+ ("Include" " *\\(\\binclude\\)(\\([^ \t\n)]*\\)" 2)))
;;;###autoload
(define-derived-mode julia-mode prog-mode "Julia"
- [nongnu] elpa/julia-mode a6c87d7bf4 02/14: Support single-line qualified fns, (continued)
- [nongnu] elpa/julia-mode a6c87d7bf4 02/14: Support single-line qualified fns, ELPA Syncer, 2023/07/12
- [nongnu] elpa/julia-mode 7e8947d749 01/14: Add one-line fns to imenu, type -> struct, const requires =, ELPA Syncer, 2023/07/12
- [nongnu] elpa/julia-mode 6b43ca61ed 05/14: imenu regex -> rx, ELPA Syncer, 2023/07/12
- [nongnu] elpa/julia-mode a7caf75c16 04/14: Simplify one-line, support @annotations for all fns, ELPA Syncer, 2023/07/12
- [nongnu] elpa/julia-mode 1f53a51400 07/14: Use rx macro instead of rx-to-string for imenu regexes, ELPA Syncer, 2023/07/12
- [nongnu] elpa/julia-mode 180b7fc5b6 10/14: Delete unused and obsolete syntax from imenu comments, ELPA Syncer, 2023/07/12
- [nongnu] elpa/julia-mode 45fc7039dc 06/14: setq -> defvar, ELPA Syncer, 2023/07/12
- [nongnu] elpa/julia-mode 260bb21a7d 08/14: Use existing font-lock regexes for imenu instead of rewriting, ELPA Syncer, 2023/07/12
- [nongnu] elpa/julia-mode 107940a19e 09/14: Font-lock const definitions with font-lock-variable-name-face, ELPA Syncer, 2023/07/12
- [nongnu] elpa/julia-mode f08a73d6fb 12/14: Change "Struct" label to "Type" for imenu, ELPA Syncer, 2023/07/12
- [nongnu] elpa/julia-mode e22debdd96 13/14: Merge pull request #177 from non-Jedi/li1-imenu-fixes,
ELPA Syncer <=
- [nongnu] elpa/julia-mode 89e5e005b6 14/14: do not test on Emacs master, ELPA Syncer, 2023/07/12
- [nongnu] elpa/julia-mode d4077f27a8 03/14: match _one-liners; preserve types; stop at end, ELPA Syncer, 2023/07/12
- [nongnu] elpa/julia-mode f7b8178fbf 11/14: Merge remote-tracking branch 'upstream/master' into li1-imenu-fixes, ELPA Syncer, 2023/07/12