Open AtomicNess123 opened 3 years ago
The first line of an org file is customarily the #+TITLE
line. I don't know whether that is a requirement, or just a custom. (I've not seen an example where the #+TITLE
was not first, but I haven't searched the entire Internet.)
Note that zetteldeft-title-prefix
starts with it.
Regarding the link highlighting, how have you set zetteldeft-id-regex
? That might be related, as I believe you need to set it in such a way that zetteldeft--id-font-lock-setup
will be called (like via :custom
in use-package
).
First, thanks for your help.
I actually learned from other users and set my orgfiles to be of the form:
#+startup: overview
#+startup: indent
#+options: toc:nil num:nil
#+todo: TODO FANCY OPTIONS | DONE
# ...etc.
#+title: My title
I like this approach because I don't have the title and then lots of setting in between the main text and the title, it's just a preamble with settings.
My zetteldeft-title-prefix’s value is:
"#+STARTUP: overview
#+STARTUP: indent
#+TITLE: "
Original value was "#+TITLE: "
I modified to suit my needs.
As for my setteldeft-id-regex, I modified it also:
"[0-9]\\{4\\}\\(-[0-9]\\{2,\\}\\)\\{3\\}-[0-9]\\{2\\}"
Original value was
"[0-9]\\{4\\}\\(-[0-9]\\{2,\\}\\)\\{3\\}"
So these are actually two separate issues.
First the titles: Zetteldeft relies on Deft to figure out the title of a note, so the challenge here is to figure Deft correctly. Take a look at deft-strip-title-regexp
. I seem to recall a discussion about this topic in Deft's Github repository, perhaps start there? EDIT: It's this issue
Second the link highlighting: this is indeed something Zetteldeft should take care of. How did you customize the zetteldeft-id-regex
in your setup? I think two approaches should work: either via setq
before requiring Zetteldeft, or via the customize
interface. This way, the font-lock is applied correctly, as explained by @gklimowicz
Thanks!
(1) deft-strip-title-regexp:
"\\(?:^%+\\|^#\\+TITLE: *\\|^[#* ]+\\|-\\*-[[:alpha:]]+-\\*-\\|^Title:[ ]*\\|#+$\\)"
This is a regex issue, and I don't know much regex, so I guess I will be stuck here. I read the thread but couldn't figure it out yet. Will keep trying.
(2) zetteldeft-id-regex should be correct:
Its value is "[0-9]\\{4\\}\\(-[0-9]\\{2,\\}\\)\\{3\\}-[0-9]\\{2\\}"
Original value was
"[0-9]\{4\}\(-[0-9]\{2,\}\)\{3\}"
edit: I forgot to answer your question on how I set up this variable:
(setq zetteldeft-id-regex "[0-9]\\{4\\}\\(-[0-9]\\{2,\\}\\)\\{3\\}-[0-9]\\{2\\}")
and I call it on my init AFTER requiring zetteldeft.
edit:
calling it before fixes the issue (2), thanks!
My format for new notes has some
#+STARTUP: options
lines at the start of the buffer, the first one being "+STARTUP: overview
".When I use functions like
zetteldeft-insert-list-links
andzetteldeft-file-rename
, the list of links I get retrieves the first line of the note as the title:zetteldeft-insert-list-links
:zetteldeft-file-rename
:I am not sure if I am doing something wrong or should tweak my configuration. Any help provided welcome, thanks!
On a side note, the format of the links shows like this on my Emacs (tried many themes invariably):
This is, the last two digits of the ID are not fontified like the rest.