Coder Social home page Coder Social logo

Comments (7)

protesilaos avatar protesilaos commented on September 2, 2024 1

In recent versions of Denote we no longer support multi-word keywords. The user option denote-file-name-slug-functions can be used to apply some specific transformation (e.g. to upcase) the given input. I am thus closing this. Thank you!

from denote.

protesilaos avatar protesilaos commented on September 2, 2024

Hello @djgoku! I am afraid there is no good solution here. The problem with my_name is that Denote interprets it as _my and _name because it appears in the file name like this:

DATE--TITLE__my_name.org

Put differently, by reading the file name we cannot know if those are two separate keywords or a single keyword.

About the use of hyphens, I found this in org.el:

(defconst org-tag-re "[[:alnum:]_@#%]+"
  "Regexp matching a single tag.")

The constraint is that we exclude @, #, % from file names. Changing org-tag-re will probably break things...

Perhaps we can allow for camelcase like myName? Otherwise you will have to use single words for the agenda to work.

If there is something else we can do to accommodate this use-case, I am happy to learn about it.

from denote.

djgoku avatar djgoku commented on September 2, 2024

Hello @protesilaos! Giving M-x denote file title and another_keyword,file_keyword creates this file
20230109T231457--file-title__another-keyword_file-keyword.org

If I replace dashes in filetags to underscores like #+filetags: :another_keyword:file_keyword: then run M-x denote-rename-file-using-front-matter it renames the file to: 20230109T231457--file-title__another_keyword_file_keyword.org. Which shows up correctly in org-agenda

edit So maybe using underscores for both filetags and keywords in the filename would work?

from denote.

protesilaos avatar protesilaos commented on September 2, 2024

So maybe using underscores for both filetags and keywords in the filename would work?

What happened in that renaming operation is that the two keywords another_keyword and file_keyword were converted into four keywords: another, keyword, file, keyword. This means that in the keywords' prompt you will get those as completion candidates, even though that was not your intention.

This can work, though it depends on your workflow and the specific words you will use. Though in that case, you can skip the renaming part and just use the individual words as keywords.

from denote.

djgoku avatar djgoku commented on September 2, 2024

Ahh good to know.

My denote/org config is:

(setq org-agenda-files '("~/dev/org" "~/dev/notes"))

(use-package
  denote
  :straight t
  :config
  (setq denote-directory "~/dev/notes"))

My workflow is M-x denote and then type in file title and add keywords. I can look into seeing if I can modify the function that modifies keywords that get inserted into #+filetags and builds the filename string to see if I can get it to work for my workflow.

I'll give an example of what I want and the output I would want so it works in org-agenda.

M-x denote
File title: notes of things I have learned while writing code
File keyword: emacs_lisp,software_development,data_structures

Wanted Filename created 20230111T162437--notes-of-things-i-have-learned-while-writing-code__data_structures_elisp_software_development.org

Wanted File contents:

#+title:      notes of things I have learned while writing code
#+date:       [2023-01-11 Wed 16:24]
#+filetags:   :data_structures:elisp:software_development:
#+identifier: 20230111T162437

If there is a way to configure the keyword separator for the file name I could configure it to be ___ three underscores or maybe a single dash?

If three underscores:
20230111T162437--notes-of-things-i-have-learned-while-writing-code__data_structures___elisp___software_development.org

If a single dash:

20230111T162437--notes-of-things-i-have-learned-while-writing-code__data_structures-elisp-software_development.org.

from denote.

protesilaos avatar protesilaos commented on September 2, 2024

Thanks for the detailed explanation! The use of the triple underscores will not solve our problem. With the current approach, we can search for, say, _data to list all relevant notes. If the underscore is a word separator, we will still get false positives like _structures.

I think the only way to accommodate the Org agenda while also using multi-word keywords is to employ camelCasing or similar techniques. Denote would still need to be modified to not alter the capitalisation of those words.

Here I should note why the casing of keywords is changed. I did it to streamline the experience. We do not need to worry about typos or possible variations of the same concept like XTerm, xterm, Xterm.

from denote.

djgoku avatar djgoku commented on September 2, 2024

With the current approach, we can search for, say, _data to list all relevant notes. If the underscore is a word separator, we will still get false positives like _structures.

Do you mind elaborating on your workflow of how you search for relevant notes?

I think the only way to accommodate the Org agenda while also using multi-word keywords is to employ camelCasing or similar techniques. Denote would still need to be modified to not alter the capitalisation of those words.

Edit: I do understand there is at least two things in play here. There is a need for consistent file naming and from that builds the front matter. Not only would file naming need to be changed or configurable but the way that keywords are saved in front matter would need to change to make valid org-mode tags.

If the keyword separator in filenames could be configured to a - (single dash) that should work, no? If there is something more to read within the code to try and understand why or why this won't work, I would be happy to read.

from denote.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.