Migrate notes in Emacs from Deft to Denote
==========================================

Deft for Emacs
--------------

Deft  for  Emacs[1] is  a  mode  for quickly  browsing,
filtering, and editing directories of plain text notes.

Deft applies  auto saving, so changes  are committed to
disk automagically.

I  have been  using Deft  for personal  notes.  All  my
notes in  Deft are in  org mode format. Most  notes are
just  plain  text, without  links  or  any other  fancy
stuff.

I do use two to  three levels of headers, and sometimes
bullets.

Deft offers some methods to search in your notes, but I
have not used that often.  Just browsing the file names
in the  directory is  most of the  time enough  to find
what I am looking for.

Deft starts with a buffer  listing the notes, sorted by
last modified  date. The  most recent modified  file is
shown on top  of the list, the oldest  modified file at
the bottom. This feature of Deft I like most.

Denote
------

Denote [2]  advertises as "simple notes  for Emacs with
an efficient file-naming scheme",

Denote comes with an extensive manual.

When creating  a new note  in Denote, it prompts  for a
title and  then for  one or  more tags.  A new  note is
created, with  a file  name consisting of  the creation
date and time,  the sluggified title and  the tags, and
the file type.

When a region is active at the moment of note creation,
Denote  prompts the  region  as the  title. Just  press
enter to accept the title, or change it.

Denote has  reached version 2.0  and I expect it  to be
quite stable now, and started to use it. Again I create
the notes in the org mode format.

Denote  offers a  lot  of fancy  features for  creating
notes and to change the title  or the tags, to keep the
file naming scheme consistent with those elements.

Also it offers an easy to  use method to link notes and
to view back links.

Unlike Deft, Denote doesn't show the directory at start
up.  The  user has to  use Dired  for that. Dired  is a
kind  of file  manager  for Emacs,  it shows  directory
listings  in  a  buffer.  Denote  shows  the  directory
listing with some  color coding, so the  title, and the
tags stand out.

Import existing notes into Denote
---------------------------------

The  functions to  change the  file name  are used  for
importing files.

The most convenient way to  import a number of files is
to use the denote-dired-rename-marked-files command.

File dates
.........

Denote uses the file-date to create the file name, so
make sure you preserve the date when you f.e,, first
copy the existing notes before importing.

An easy way to preserve the  file date is to use tar to
create an archive of  the current directory and extract
the tar archive in the denote directory.

The denote-dired-rename-marked-files command works also
outside the denote directory.  You can rename the files
where they are  and after that move them  to the denote
directory.  The  command renames  the files, so  if you
want to use this on  your original files, make sure you
can roll back. For example  first tar the directory, to
make  sure you  don't loose  the file  dates. (Remember
that Git destroys your file dates.)

Once  you have  imported the  files, the  file date  is
coded in  the filename, and  also is part of  the front
matter of the note. So, after the import you can forget
about preserving the file date, and Git is safe to use.

Importing files
..............

How to import some files into Denote:

* Open the directory in Dired
* Mark the files (with 'm')
* Apply the command denote-dired-rename-marked-files

Denote prompts  for a tag,  I just used 'deft'  for the
bulk import. Later I can always add one or more tags.

The  renaming takes  some  time. After  the command  is
finished,  the buffers  have to  be saved.  To do  this
issue the command C-x s (not  C-x C-s) and then use '!'
to save all files.

Denote uses the file name for the title. Deft has saved
the notes with a lowercase slug. It you want to use the
frontmatter title, you have to  come up with a solution
for that.

Filtering files with a specific tag
-----------------------------------

To list only files with a specific tag in Dired:

* Open the directory in Dired
* % m (select files based on regular expression)
* _<tag>
* t (toggle marks)
* k (kill view of marked lines)

To   see   the   complete  listing   again,   use   'g'
(revert-buffer).

Example to list only files with tag "gopher":

  % m _gopher t k

Mimic Deft with Denote
----------------------

I have created a bookmark to the Denote directory.

To do that, just open the directory in Dired and create
a bookmark with:

  C-x r m

To open a bookmark, list the bookmarks with:

  C-x r l

and hit 'enter' on the right line.

To sort  the files  on the last  modified date  like in
Deft, just press 's'.

Auto save  can probably  be set up  with the  hook from
Denote, but I didn't bother.


[1] https://jblevins.org/projects/deft/
[2] https://github.com/protesilaos/denote


Last edited: $Date: 2023/08/02 16:21:03 $