Open peti opened 4 years ago
Normally neuron-mode
should be enabled automatically whenever one opens a markdown file in a zettelkasten, assuming the directory has a neuron.dhall
file at its root.
However, manually enabling neuron-mode
shouldn't give an error, regardless of the existence of neuron.dhall
.
Could you provide the backtrace?
How do I generate a backtrace?
Running M-x toggle-debug-on-error
should open a buffer with the backtrace when an error occurs.
I get this error:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
intern(nil)
#f(compiled-function (zettel) #<bytecode 0x16ce4d1>)(((zettelTags . ["learning"]) (zettelDay . "2020-07-25") (zettelID . "bb86db02") (zettelError (Right . [])) (zettelContent . []) (zettelQueries . [["ZettelQuery_ZettelByID" ["e692b9e8" nil]]]) (zettelFormat . "markdown") (zettelPath . "bb86db02.md") (zettelTitle . "How to Use the Zettelkasten System?") (zettelTitleInBody . t)))
mapcar(#f(compiled-function (zettel) #<bytecode 0x16ce4d1>) [((zettelTags . ["learning"]) (zettelDay . "2020-07-25") (zettelID . "bb86db02") (zettelError (Right . [])) (zettelContent . []) (zettelQueries . [["ZettelQuery_ZettelByID" ["e692b9e8" nil]]]) (zettelFormat . "markdown") (zettelPath . "bb86db02.md") (zettelTitle . "How to Use the Zettelkasten System?") (zettelTitleInBody . t)) ((zettelTags . ["learning"]) (zettelDay) (zettelID . "e692b9e8") (zettelError (Right . [])) (zettelContent . []) (zettelQueries . []) (zettelFormat . "markdown") (zettelPath . "e692b9e8.md") (zettelTitle . "Using Feynman Notes for Learning") (zettelTitleInBody . t))])
neuron--rebuild-cache()
byte-code("\301\010!\203\011\0\302 \210\303\304!\207" [neuron-zettelkasten f-directory\? neuron--rebuild-cache provide neuron-mode] 2)
autoload-do-load((autoload "neuron-mode" "A major mode to edit Zettelkasten notes with neuron.\n\n(fn)" t nil) neuron-mode)
command-execute(neuron-mode record)
execute-extended-command(nil "neuron-mode")
smex-read-and-run(("toggle-debug-on-error" "neuron-mode" "R" "cd" "5x5" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "man" "mpc" "pdb" "pwd" "rsh" "sdb" "xdb" "bbdb" "calc" "diff" "dirs" "ffap" "gnus" "grep" "help" "ielm" "info" "life" "mail" "mpuz" "ping" "pong" "smex" "talk" "term" "undo" "yank" "zone" "align" "chmod" "debug" "diary" "dired" "ediff" "edirs" ...))
smex()
funcall-interactively(smex)
#<subr call-interactively>(smex nil nil)
apply(#<subr call-interactively> smex (nil nil))
call-interactively@ido-cr+-record-current-command(#<subr call-interactively> smex nil nil)
apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (smex nil nil))
call-interactively(smex nil nil)
command-execute(smex)
That is odd. I'm almost certain that the compiled function that gives the error is assoc-id
defined here:
(defun neuron--rebuild-cache ()
"Rebuild the zettel cache with the current zettelkasten."
(let ((zettels (neuron--query-url-command "z:zettels"))
(assoc-id (lambda (zettel) (cons (intern (map-elt zettel 'zettelID)) zettel))))
(setq neuron--zettel-cache (mapcar assoc-id zettels))))
But this would mean that (map-elt zettel 'zettelID)
returns nil
, which sounds impossible given that the list of zettels in te backtrace provide a zettelID
field for each entry.
What is the value of neuron-default-zettelkasten-directory
? Also, do you have the neuron.dhall
file at the root of your zettelkasten?
What is the value of
neuron-default-zettelkasten-directory
?
neuron-default-zettelkasten-directory’s value is "/home/simons/zettelkasten", which is where the zettelkasten lives. I used to have it at ~/src/zettelkasten
, but eventually moved it because keeping the directory in a non-default place caused all kinds of trouble with neuron itself, etc.
Also, do you have the
neuron.dhall
file at the root of your zettelkasten?
Yes, I do:
$ cat neuron.dhall
{ siteTitle = "Peter Simons' Zettelkasten"
, siteBaseUrl = Some "http://cryp.to"
}
Do you have any idea what might be causing this issue?
Sorry for the late response, unfortunately I wasn't able to reproduce the bug. Could you try updating both neuron and neuron-mode just to be sure? (\<id> links are still supported for now, I'll do wikilinks next) And then try reproducing the error and backtrace without compiling your config so that I can be sure where the error comes from Not sure how to run emacs without using the precompiled files though
I usually install these Emacs modes via Nix, which means that I get whatever version of these that Nixpkgs currently contains. Nix snapshots ELPA and other repositories every couple of weeks, so it's possible that these versions are not completely up-to-date. Anyhow, the errors I experience come from the Nix-based installation. So I tried something else and installed neuron-mode
via package.el
in Emacs. Lo and behold, that installation works just fine.
So it's safe to say that this issue is not caused by a bug in neuron-mode itself. Rather, it's some kind of incompatibility between neuron-mode and some older version of some other library that it uses.
I usually install these Emacs modes via Nix
Interesting, how does it work? I think you can also do declarative builds directly in emacs using something like straight (doom emacs configs are more or less declarative for example, it is based on straight). The only issue is that you can't install external software this way.
I'll leave the issue open in case someone finds a fix
I load some zettel from zettelkasten directory into Emacs and it's recognized as
markdown-mode
-- notneuron-mode
. So I runM-x neuron-mode
manually, but all I get is the error message:I'm using GNU Emacs 26.3. Is that a known problem?