Closed jcs090218 closed 1 year ago
I noticed the same the other day. It's a bit confusing though, because the recent PRs that were merged did not touch nim-rx
. So I just checked locally if I can reproduce the same error on HEAD~3 744e076f0bea1c5ddc49f92397d9aa98ffa7eff8
Running emacs with -Q and:
;; load all packages required by nim-mode
(add-to-list 'load-path "~/.emacs.d/elpa/commenter-20160219.1627/")
(add-to-list 'load-path "~/.emacs.d/elpa/epc-20140610.534/")
(add-to-list 'load-path "~/.emacs.d/elpa/concurrent-20170601.435/")
(add-to-list 'load-path "~/.emacs.d/elpa/deferred-20170901.1330/")
(add-to-list 'load-path "~/.emacs.d/elpa/ctable-20210128.629/")
;; add nim-mode itself
(add-to-list 'load-path "~/src/nim/nim-mode")
;; try to recompile the module
(byte-recompile-directory "~/src/nim/nim-mode/" 0 t)
yields the same error for me on that commit.
So I suppose this is some issue that didn't appear on older emacs versions?
Also (betraying my ignorance) I'm a bit confused that evaluating the nim-rx-constituents
definition in nim-rx.org
works fine, but only doing the byte compilation fails.
Unfortunately, the nim-rx
code is a bit over my head. I'm more used to writing Nim macros. :rofl: While I managed to fix (?) it locally for me, I'm not sure if I'm changing the result. Or rather I am if I base it on evaluating the defvar
by hand, but this
((dedenter . "\\_<\\(?:e\\(?:l\\(?:if\\|se\\)\\|xcept\\)\\|finally\\|of\\)\\_>") (defun . "\\_<\\(?:converter\\|func\\|iterator\\|m\\(?:acro\\|ethod\\)\\|proc\\|template\\)\\_>") (block-start-defun . "\\_<\\(?:block\\|c\\(?:ase\\|onverter\\)\\|e\\(?:l\\(?:if\\|se\\)\\|num\\|xcept\\)\\|f\\(?:inally\\|or\\|unc\\)\\|i\\(?:f\\|terator\\)\\|m\\(?:acro\\|ethod\\)\\|o\\(?:bject\\|f\\)\\|proc\\|t\\(?:emplate\\|ry\\|uple\\)\\|w\\(?:h\\(?:en\\|ile\\)\\|ith\\)\\)\\_>") (decl-block . "\\_<\\(?:const\\|import\\|let\\|type\\|var\\)\\_>[[:space:]]*\\(?:#\\|$\\)") (symbol-name . "[_–[:alpha:]][_–[:word:]]*") (hex-lit . "0[Xx][[:xdigit:]]\\(?:[[:xdigit:]]\\|_\\)*") (dec-lit . "[[:digit:]]\\(?:[[:digit:]]\\|_\\)*") (oct-lit . "0[Cco][0-7][0-7_]*") (bin-lit . "0[Bb][01][01_]*") (exponent . "\\([Ee][+-]?[[:digit:]]\\(?:_\\|[[:digit:]]\\)*\\)") (open-paren . "[([{]") (close-paren . "[])}]") ...)
is a bit hard to read for me (this is what the current code produces for me when evaluated by hand). The confusing thing to me is also that the entire
(dedenter . ("elif" "else" "of" "except" "finally"))
does not at all appear.
If anyone can help out, that would be appreciated! I'll try to understand if my fix is correct later and possibly open a PR with it.
I think this is how you solve this issue. 🤔
diff --git a/nim-rx.el b/nim-rx.el
index 5628c17..079ad58 100644
--- a/nim-rx.el
+++ b/nim-rx.el
@@ -34,7 +34,10 @@
"try" "except" "finally"
"with" "block"
"enum" "tuple" "object")))
- collect (cons sym (apply `((lambda () (rx symbol-start (or ,@kwd) symbol-end)))))))
+ collect (cons sym (apply
+ (lambda (kwd)
+ (eval `(rx symbol-start (or ,@kwd) symbol-end)))
+ (list kwd)))))
(constituents2 `((decl-block . ,(rx symbol-start
(or "type" "const" "var" "let" "import")
symbol-end
I've opened the PR in #248 for the fix!
By seeing many warnings and errors in this package, I strongly recommend adding CI/CD to this repo; therefore, it can lower your maintenance. 🤔
By seeing many warnings and errors in this package, I strongly recommend adding CI/CD to this repo; therefore, it can lower your maintenance. 🤔
You're more than welcome to help with that. I've never set up a CI for emacs, so I'm not sure how this is typically done (i.e. how do we test different versions of emacs? how do we generally run the test cases? etc.). I've only started to actively help maintaining this repo, because no one else was doing it. Not because I'm an expert, heh.
I only use Eask to test my packages. If you want, I can open a PR for this.
See lsp-grammarly as the reference.
That would be much appreciated! :rocket:
Closed by #248.
This package is not installable at the moment.
Here is the compile log: