felko / neuron-mode

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

Open/Edit zettel gives only <nil> nil () #29

Closed carlos-cardoso closed 4 years ago

carlos-cardoso commented 4 years ago

Hi, Thanks for all the work on this project.

I'm new to emacs and installed Doom (v2.0.9), emacs (28.0.50), and neuron with nix.

After creating some zettels with SPC z z, when I try to edit or open them SPC z e, or SPC z o, I get:

Edit zettel:
<nil> nil ()
<nil> nil ()
<nil> nil ()

After selecting one of the options nothing happens. With the elisp repl I found that the issue seems related to the neuron-zettel-cache

ELISP> neuron--zettel-cache
((c4bd7158
  (path . "/home/carlos/zettelkasten/c4bd7158.md")
  (day . "2020-05-19")
  (id . "c4bd7158")
  (title . "Index")
  (tags .
   []))
 (ef1be6a2
  (path . "/home/carlos/zettelkasten/ef1be6a2.md")
  (day . "2020-05-19")
  (id . "ef1be6a2")
  (title . "Writing")
  (tags .
   ["writing" "zettelkasten" "note-taking"]))
 (26a0709a
  (path . "/home/carlos/zettelkasten/26a0709a.md")
  (day . "2020-05-10")
  (id . "26a0709a")
  (title . "ZettelKasten")
  (tags .
   ["notetaking" "zettelkasten" "organization" "writing"])))

The neuron--propertize-zettel function seems to expect keys in the first element, by using cdr I got it to work (I know almost nothing about lisp).

(defun cdr-neuron--propertize-zettel (zettel)
  (neuron--propertize-zettel (cdr zettel)))

(defun neuron--select-zettel-from-list (zettels &optional prompt)
  "Select a zettel from a given list.
ZETTELS is a list of maps containing zettels (keys: id, title, tags, path)
PROMPT is the prompt passed to `ivy-read'."
  (let* ((selection
          (ivy-read (or prompt "Select Zettel: ")
                    (mapcar #'cdr-neuron--propertize-zettel zettels)
                    :caller 'neuron--select-zettel-from-list)))
    (get-text-property 0 'zettel selection)))

SPC z e now gives:

Edit zettel:
<c4bd7158> Index
<ef1be6a2> Writing (writting, zettelkasten, note-taking)
<26a0709a> ZettelKasten (notetaking, zettelkasten, organization, writing)
felko commented 4 years ago

Hey, thank you for reporting this bug, sadly I cannot reproduce it. Given your emacs version (28), I suspect that this is an issue with the new version of the map.el (2.1). Could you please check the version of your map.el (by typing SPC h p map)?

felko commented 4 years ago

Ok, I managed to reproduce it by installing map.el version 2.1, so that's probably what's happening here. I just pushed an attempt at making neuron-mode forward compatible with map-2.1, can you give it a try now (by running doom update)?

carlos-cardoso commented 4 years ago

I tried doom update and It's fixed, thanks! And you were right, SPC h p RET map showed that I had version 2.1.

felko commented 4 years ago

Great! Thank you