Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Queue random note for spontaneous recall and related notes #53

Closed
erictleung opened this issue May 8, 2020 · 4 comments
Labels
discussion Discuss practices & share information

Comments

@erictleung
Copy link

In using org-brain, I really liked its wander feature, which brings a note randomly. It essentially randomly samples the notes created and displays it. This can be helpful as an informal 'quiz' of your knowledge base or at least refresh your memory that the particular note exists. From there you can edit it with current knowledge or link it to other notes.

I'd like to propose a similar function in zetteldeft.

I've created a simple function to accomplish this.

(defun etl/zetteldeft-ergodic ()
  "Find a random file in the deft directory."
  (interactive)
  (deft-filter-clear)
  (kill-new
   (zetteldeft--lift-id
    (nth (random (length (directory-files deft-directory)))
         (directory-files deft-directory)))
    nil)
  (deft-filter-yank))

I'd run this after being in the deft buffer. So after running deft (C-c d d), I'd run the above etl/zetteldeft-ergodic which will randomly retrieve a random note ID and search for it.

Thanks for creating this package.

@EFLS EFLS added the discussion Discuss practices & share information label May 8, 2020
@EFLS
Copy link
Owner

EFLS commented May 8, 2020

Ooh that's nice. I'm working on a sort of Zetteldeft knowledge base (in Zetteldeft of course) and will make sure to include this piece of code.

I think it is nice to provide these as snippets that people can use as they see fit, rather than features included in the code itself, as I don't think it is core functionality. At least for now.

@erictleung
Copy link
Author

A knowledge base sounds like a great idea. I look forward to reading it. And thanks for your consideration. Plug-and-play snippets sounds really nice actually.

@EFLS
Copy link
Owner

EFLS commented May 9, 2020

I've changed your code a bit, so that it

  1. picks a note from those deft knows about (since directory-files will also return . and .., and won't respect deft-recursive, deft-ignore-files-regex etc.)
  2. opens the deft buffer automatically (but will still work when you're already at it)
  3. sets the filter directly, rather than via yank

I've called it zetteldeft-wander. Really nice idea! Maybe I should consider including it in the main code after all...

(defun zetteldeft-wander ()
  "Wander through `zetteldeft' notes.
Search `deft' for a random `zetteldeft' id."
  (interactive)
  (switch-to-buffer deft-buffer)
  (let ((all-files (deft-find-all-files-no-prefix)))
    (deft-filter
      (zetteldeft--lift-id
        (nth (random (length all-files))
           all-files)))))

@EFLS
Copy link
Owner

EFLS commented Jun 6, 2020

This is now included in https://github.com/EFLS/zd-tutorial, which serves as both a knowledge base and a tutorial. More discussion in #64.

Feel free to leave a comment if you think this should be part of the core feature set.

@EFLS EFLS closed this as completed Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Discuss practices & share information
Projects
None yet
Development

No branches or pull requests

2 participants