EFLS / zetteldeft

A Zettelkasten system! Or rather, some functions on top of the emacs deft package.
https://efls.github.io/zetteldeft
GNU General Public License v3.0
394 stars 42 forks source link

New zettel in doom-emacs does not strip the ID from the note title #41

Open rotlaus opened 4 years ago

rotlaus commented 4 years ago

As mentioned in #26 i get the timestamps in my titles. Using my old vanilla config using zetteldeft-new file i get a title like #+TITLE: Test 5 Using the doom-emacs distribution i get #+TITLE: 2020-04-02-1537-test-6

The deft and zetteldeft config on my side is identical in both cases.

The doom specific deft configuration can be found here: https://github.com/hlissner/doom-emacs/blob/develop/modules/ui/deft/config.el

rotlaus commented 4 years ago

Setting the deft-file-naming-rules back to default fixes the zetteldeft generated Title. But with zetteldeft-title-prefix set to nil and the file-templates package active it still looks like #+TITLE: 2020 04 02 1558 Test 9

EFLS commented 4 years ago

Can you share your zetteldeft configuration? How do you load the package?

rotlaus commented 4 years ago

It's the default doom installation. In the .doom.d/packages.el i have the package loaded with (package! zetteldeft)

In the .doom.d/init.el i have enabled the deft package and in the .doom.d/config.el i have the default zetteldeft configuration:

(use-package deft
  :after org
  :custom
  (deft-recursive t)
  (deft-default-extension "org")
  (deft-directory "\~/pm/zettel/")
  :init
  (setq deft-file-naming-rules '( (noslash . "-") )))

(use-package! zetteldeft
  :commands (zetteldeft-new-file zetteldeft-tag-buffer zetteldeft-search-at-point zetteldeft-find-file zetteldeft-search-current-id zetteldeft-follow-link zetteldeft-avy-tag-search zetteldeft-new-file-and-link zetteldeft-file-rename zetteldeft-find-file-id-insert zetteldeft-find-file-full-title-insert zetteldeft-search-at-point zetteldeft-avy-link-search zetteldeft-avy-file-search-ace-window zetteldeft-find-file)
  :init
  (map! :leader
        :prefix ("d" . "zetteldeft")
        :desc "deft" "d" #'deft
        :desc "zetteldeft-deft-new-search" "D" #'zetteldeft-new-file
        :desc "deft-refresh" "R" #'deft-refresh
        :desc "zetteldeft-search-at-point" "s" #'zetteldeft-search-at-point
        :desc "zetteldeft-search-current-id" "c" #'zetteldeft-search-current-id
        :desc "zetteldeft-follow-link" "f" #'zetteldeft-follow-link
        :desc "zetteldeft-avy-file-search-ace-window" "F" #'zetteldeft-avy-file-search-ace-window
        :desc "zetteldeft-avy-link-search" "l" #'zetteldeft-avy-link-search
        :desc "zetteldeft-avy-tag-search" "t" #'zetteldeft-avy-tag-search
        :desc "zetteldeft-tag-buffer" "T" #'zetteldeft-tag-buffer
        :desc "zetteldeft-find-file-id-insert" "i" #'zetteldeft-find-file-id-insert
        :desc "zetteldeft-find-file-full-title-insert" "I" #'zetteldeft-find-file-full-title-insert
        :desc "zetteldeft-find-file" "o" #'zetteldeft-find-file
        :desc "zetteldeft-new-file" "n" #'zetteldeft-new-file
        :desc "zetteldeft-new-file-and-link" "N" #'zetteldeft-new-file-and-link
        :desc "zetteldeft-file-rename" "r" #'zetteldeft-file-rename
        :desc "zetteldeft-count-words" "x" #'zetteldeft-count-words
        )
  )

With the deft-file-naming-rules as above and the file-templates package disabled it works as intended.

To my shame i have to admit i never questioned the Ids in the title. I always thought that it was the way it has to be.

EFLS commented 4 years ago

I don't immediately see where this issue comes from. My guess is that creating a new file via the deft search bar replaces spaces with - (as per doom default), which then causes issues for the zetteldeft--lift-file-title because of the additional dashes.

Just to gather information, can you report what happens when you

In any case, the second way of creating new zetteldeft notes is not really supported, since here deft takes over the title generation. I might have to mention this in an introductory guide or something.

rotlaus commented 4 years ago

I made these test with the default doom config with the file-templates package activated and without the deft-file-naming-rules setting.

  • make a new note via zetteldeft-new-file (which is SPC d n)
#+TITLE: 2020 04 06 1509 Test 7

#+TITLE: 2020-04-06-1509-test-7

Filename: 2020-04-06-1509-test-7.org

  • make a new note via the deft search bar
#+TITLE: Test 8

Filename: test-8.org

But i wouldn't call this a bug, it's more a configuration issue. With the deft-file-naming-rules and the disabled file-templates package (or a (set-file-template! 'org-mode :ignore t) like mentioned by @neildurant in #26) and zetteldeft works like intended.

sunnyrahul25 commented 4 years ago

@rotlaus Thank for sharing your config. I got only title to show in new zettle However the filename created '2020-04-17-1624 true.org' has a space as separator between title and date. If I use (setq deft-file-naming-rules '( (noslash . "-")(nospace . "_") ))) then the title contains the date as well. Is there a way to remove space as well.