felko / neuron-mode

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

neuron-insert-zettel-link inserts [[[nil]]] for link with non-ascii letters in filename #74

Open arkoort opened 3 years ago

arkoort commented 3 years ago

With default settings (I use LANG=ru_RU.UTF-8) neuron executable returns ???? instead of non-ascii letters. With LANG=C.UTF-8 executable returns the correct results (I've tried some queries by hand) and neuron-mode operates mostly correct, but it cannot insert the link to the zettel file with non-ascii letters in the file name.

I admit that my setup is incorrect somewhere, but I cannot find the reason.

felko commented 3 years ago

I think this is because of the regex that is used to identify links (which is used when selecting a zettel), it only matches characters in [A-Za-z0-9-_ ]. Emacs regexps have a special [:alnum:] class that can match alphanumerical character from different scripts, depending on your system's language I think. You could try this commit https://github.com/felko/neuron-mode/commit/02fbfca98b5dfb09f09159914682efea6d6afb5a, make emacs use ru_RU.UTF-8, and write (setq neuron-executable "LANG=C.UTF-8 neuron") in your emacs config until neuron supports ru_RU.UTF-8 (maybe you should open an issue on the neuron repo).

arkoort commented 3 years ago

Thank you, it works now with cyrillic letters. But is there the reason to limit to alphanumerical, - and _ only? The filename one of my zettels was initially named ZFS_2.0 (it has some my notes about new ZFS version), but I was forced to rename it to ZFS_2 because neuron-mode inserted [[[nil]]] instead of its title too. It seems to me that there can be any symbol except space (because neuron itself doesn't expand titles if the filename contains space). Of course only if it will not break the code.

I've got the recommendation about C.UTF-8 as quick fix just from one of neuron issues, but you're right, I'll discover this situation more carefully, and maybe it really needs to be fixed.

srid commented 3 years ago

Neuron does allow whitespace in IDs, along with a number of special characters. See https://github.com/srid/neuron/blob/595f040293d746fc7e036cc872b7e48c1f45c7f1/neuron/src/lib/Neuron/Zettelkasten/ID.hs#L84-L98

Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Monday, February 8th, 2021 at 10:29 AM, arkoort notifications@github.com wrote:

Thank you, it works now with cyrillic letters. But is there the reason to limit to alphanumerical, - and _ only? The filename one of my zettels was initially named ZFS_2.0 (it has some my notes about new ZFS version), but I was forced to rename it to ZFS_2 because neuron-mode inserted [[[nil]]] instead of its title too. It seems to me that there can be any symbol except space (because neuron itself doesn't expand titles if the filename contains space). Of course only if it will not break the code.

I've got the recommendation about C.UTF-8 as quick fix just from one of neuron issues, but you're right, I'll discover this situation more carefully, and maybe it really needs to be fixed.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

arkoort commented 3 years ago

It allows, but doesn't expand links in generated HTMLs. For example, [[12345678_qwe]] will be shown in HTML as "The qwe link" (if it has # The qwe link title), but [[12345678 qwe]]` will remain "12345678 qwe".

Or I understand wrong? I've got that behaviour in my base at the latest neuron.

srid commented 3 years ago

If "12345678 qwe.md" exists, then neuron should link to it. See the doc zettelkasten which uses whitespace liberally in zettel IDs: https://github.com/srid/neuron/tree/master/doc/Guide

Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Monday, February 8th, 2021 at 12:30 PM, arkoort notifications@github.com wrote:

It allows, but doesn't expand links in generated HTMLs. For example, [[12345678_qwe]] will be shown in HTML as "The qwe link" (if it has # The qwe link title), but [[12345678 qwe]]` will remain "12345678 qwe".

Or I understand wrong? I've got that behaviour in my base at the latest neuron.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

arkoort commented 3 years ago

Sorry, my English is very poor. I try do say the following:

1) if the file 12345678_qwe.md has the title # The link, and in another note I use see [[12345678_qwe]]., I'll see in HTML: see The link.. 2) if the file 12345678 qwe.md has the title # The link, and in another note I use see [[12345678 qwe]]., I'll see in HTML: see 12345678 link..

I've read the Guide and I understand that it is the expected behaviour. But I need the first variant and just it was I tried to say in the original message. It was not the claim against neuron, it was the description of my situation. Sorry for not being able to say that on the first try.

(And, of course, this is the reason why I write about cyrillic letters both in neuron repo and here:)

srid commented 3 years ago

Number 2 is not expected behaviour.

Sent from ProtonMail mobile

-------- Original Message -------- On Feb. 8, 2021, 2:04 p.m., arkoort wrote:

Sorry, my English is very poor. I try do say the following:

  • if the file 12345678_qwe.md has the title # The link, and in another note I use see [[12345678_qwe]]., I'll see in HTML: see The link..
  • if the file 12345678 qwe.md has the title # The link, and in another note I use see [[12345678 qwe]]., I'll see in HTML: see 12345678 link..

I've read the Guide and I understand that it is the expected behaviour. But I need the first variant and just it was I tried to say in the original message. It was not the claim against neuron, it was the description of my situation. Sorry for not being able to say that on the first try.

(And, of course, this is the reason why I write about cyrillic letters both in neuron repo and here:)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

arkoort commented 3 years ago

Sorry, it wasn't clear from documentation (and from site, where almost all spaced filenames have no title, and just one has title natching filename). Should I open an issue, or it may be caused by #543?