felko / neuron-mode

An emacs mode for editing Zettelkasten notes with neuron
GNU General Public License v3.0
118 stars 21 forks source link

wrong-argument-type when rebuilding cache #42

Closed fxsmith closed 4 years ago

fxsmith commented 4 years ago

I've installed neuron-mode (and the latest neuron) on two machines in the past day and I'm seeing the same issue. Rebuilding the cache always gives a wrong-argument-type. I've done a little testing (not an emacs expert at all), and it looks like emacs is able to call into neuron ok and get a response. To my untrained eye, it almost looks like the JSON returned by neuron has unexpected ID keys. Example stack below.

I'm using the latest neuron (v 0.5.8) - I tried to roll back to earlier version of neuron to test but ran into build issues.

Debugger entered--Lisp error: (wrong-type-argument stringp nil) intern(nil)

f(compiled-function (zettel) #<bytecode 0x14753b5>)(((zettelTags . []) (zettelDay . "2020-07-01") (zettelID . "270da4c0") (zettelError (Right . [])) (zettelContent . []) (zettelQueries . []) (zettelTitle . "Test") (zettelTitleInBody . t)))

mapcar(#f(compiled-function (zettel) #<bytecode 0x14753b5>) [((zettelTags . []) (zettelDay . "2020-07-01") (zettelID . "270da4c0") (zettelError (Right . [])) (zettelContent . []) (zettelQueries . []) (zettelTitle . "Test") (zettelTitleInBody . t)) ((zettelTags . []) (zettelDay . "2020-07-01") (zettelID . "2937754d") (zettelError (Right . [])) (zettelContent . []) (zettelQueries . []) (zettelTitle . "Foo10") (zettelTitleInBody . t)) ((zettelTags . []) (zettelDay . "2020-07-01") (zettelID . "2d4a2a74") (zettelError (Right . [])) (zettelContent . []) (zettelQueries . []) (zettelTitle . "Foo") (zettelTitleInBody . t)) ((zettelTags . []) (zettelDay . "2020-07-01") (zettelID . "62a8aa73") (zettelError (Right . [])) (zettelContent . []) (zettelQueries . []) (zettelTitle . "Foo") (zettelTitleInBody . t)) ((zettelTags . []) (zettelDay . "2020-07-01") (zettelID . "87102e41") (zettelError (Right . [])) (zettelContent . []) (zettelQueries . []) (zettelTitle . "foo7") (zettelTitleInBody . t)) ((zettelTags . []) (zettelDay . "2020-07-01") (zettelID . "91c3f4bd") (zettelError (Right . [])) (zettelContent . []) (zettelQueries . []) (zettelTitle . "My first zettel") (zettelTitleInBody . t)) ((zettelTags . []) (zettelDay . "2020-07-01") (zettelID . "a5ebe114") (zettelError (Right . [])) (zettelContent . []) (zettelQueries . []) (zettelTitle . "Flip") (zettelTitleInBody . t)) ((zettelTags . []) (zettelDay . "2020-07-01") (zettelID . "ecfa6007") (zettelError (Right . [])) (zettelContent . []) (zettelQueries . []) (zettelTitle . "Foo3") (zettelTitleInBody . t)) ((zettelTags . []) (zettelDay . "2020-07-01") (zettelID . "ff4784ce") (zettelError (Right . [])) (zettelContent . []) (zettelQueries . []) (zettelTitle . "foo5") (zettelTitleInBody . t))]) neuron--rebuild-cache() neuron--update-current-zettelkasten("/home/fred/dev/neuron") neuron-zettelkasten() neuron-check-if-zettelkasten-exists() neuron-mode() funcall-interactively(neuron-mode) call-interactively(neuron-mode record nil) command-execute(neuron-mode record) execute-extended-command(nil "neuron-mode" "neuron-mode") funcall-interactively(execute-extended-command nil "neuron-mode" "neuron-mode") call-interactively(execute-extended-command nil nil) command-execute(execute-extended-command)

srid commented 4 years ago

This is because the JSON output got changed recently in neuron. It sucks to break compatibility here, but the change was done to prevent further JSON related regressions. See https://github.com/srid/neuron/pull/265

I tried to roll back to earlier version of neuron to test but ran into build issues.

What were those build issues? Have you tried running this command to rollback to the version before the JSON output got changed?

nix-env -if https://github.com/srid/neuron/archive/15e53733e692e0e7523a2b023f5e16faca544395.tar.gz
fxsmith commented 4 years ago

Rolling back to 0.5.7 using the command you provided worked, and neuron-mode appears to be working correctly. Thank you for the help!

Since this appears to be an open/ongoing issue for which neuron-mode will need to be updated, I let you folks decide how/when to close issue. Thanks again.

Previously I had tried to roll all the way back to 0.4.0.0. I am not at all familiar with the nix build environment - this might not be expected to work, but I include this just as a datapoint in response to your query above. The build command that failed for me is below:

~/dev$ nix-env -if https://github.com/srid/neuron/archive/0.4.0.0.tar.gz

building '/nix/store/yiwvlf251v0ygbx60phmbcfr9aqq2lw8-neuron-gitDescribe.drv'... fatal: not a git repository (or any of the parent directories): .git builder for '/nix/store/yiwvlf251v0ygbx60phmbcfr9aqq2lw8-neuron-gitDescribe.drv' failed with exit code 128 error: build of '/nix/store/yiwvlf251v0ygbx60phmbcfr9aqq2lw8-neuron-gitDescribe.drv' failed (use '--show-trace' to show detailed location information)

felko commented 4 years ago

I should have opened an issue before to avoid you the trouble of debugging yourself. Can you give it a try with https://github.com/felko/neuron-mode/commit/b2d6e4c2cd9e9836ba9cc325b9d30eb8ab78974a?

fxsmith commented 4 years ago

I've tried with the latest commit, and it appears to make it past the refresh process. However, editing a zettel is failing. It could by my local config, but I've tried a few times, and it seems that the code is expecting a path that it can't find in the JSON record:

Debugger entered--Lisp error: (wrong-type-argument stringp nil) expand-file-name(nil "/home/fred/dev/neuron/guide") f-expand(nil "/home/fred/dev/neuron/guide")

f(compiled-function (arg) #<bytecode 0x174687d>)(nil)

mapcar(#f(compiled-function (arg) #<bytecode 0x174687d>) ("/" "/home/fred/dev/neuron/guide" nil)) -map(#f(compiled-function (arg) #<bytecode 0x174687d>) ("/" "/home/fred/dev/neuron/guide" nil)) f-join("/" "/home/fred/dev/neuron/guide" nil) neuron--edit-zettel-from-path(nil) neuron-edit-zettel(((zettelTags . []) (zettelDay . "2020-07-01") (zettelID . "4c57f82a") (zettelError (Right . [])) (zettelContent . []) (zettelQueries . []) (zettelTitle . "Foo2") (zettelTitleInBody . t))) funcall-interactively(neuron-edit-zettel ((zettelTags . []) (zettelDay . "2020-07-01") (zettelID . "4c57f82a") (zettelError (Right . [])) (zettelContent . []) (zettelQueries . []) (zettelTitle . "Foo2") (zettelTitleInBody . t))) call-interactively(neuron-edit-zettel record nil) command-execute(neuron-edit-zettel record) execute-extended-command(nil "neuron-edit-zettel" "neuron-edit-ze") funcall-interactively(execute-extended-command nil "neuron-edit-zettel" "neuron-edit-ze") call-interactively(execute-extended-command nil nil) command-execute(execute-extended-command)

felko commented 4 years ago

My bad, should be fixed now.

srid commented 4 years ago

I updated my doom-emacs along with the packages in it (bin/doom upgrade) and launched Emacs after a long break. neuron-mode works for me, with neuron 0.5.8.0.

felko commented 4 years ago

I have been using it for a few days and fixed the remaining bugs that I encountered, closing for now. Please reopen if you find anything else.