TransWikia.com

org capture: Store new file name or use an existing file name as a variable

Emacs Asked by omarali linux on February 14, 2021

I’m looking for a way to use a fuzzy finder menu to store a new file name or select an existing file name as ${title} or %ˆ{Name} string variable.

I use the zettelkasten system and my workflow consists of capturing snippets of information and sorting them through indexes.

For example, A book I’m reading is the index file while every chapter I take notes on is a snippet file. Here’s how it looks https://imgur.com/U4zdYsL. Currently, I use org-roam with org-roam-capture.

Issue: I want a menu similar to org-roam-find-file where all of my previously created notes are shown. Org-roam-capture only allows me to store new files as ${slug} & ${title} but upon selecting an existing file, it opens it rather than create a new file with the {title} variable filled out.
I saw an answer here but it isn’t explicit. What function should I use? I’m new to elisp.

Workflow: Search my files by typing the name. If there are no options then save it as ${choose index} variable and if it exists then select the file and store it as ${choose index} variable, too. Doesn’t have to be ${choose index}, I just need it to be auto-filled.

Here’s how my org-roam-capture-template looks.

  (setq org-roam-capture-templates
   '(
      ("l" "[Note] Literature Snippet" plain (function org-roam--capture-get-point)
       "%?"
       :file-name "${choose index}_snippet-%<%Y%m%d%H%M%S>"
       :head "#+TITLE: Snippet: %^{snippet name} 
              Source: [[file:_daily/${choose index}.org][${choose index}-index]]n"
       :unnarrowed t)
    ))

${choose index} is the variable where I store the existing file or new file name from the menu while %^{snippet name} simply prompts for the title of the snippet.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP