GithubHelp home page GithubHelp logo

Comments (10)

protesilaos avatar protesilaos commented on September 14, 2024

Hello @pprevos!

Several of my notes have an enhanced front matter, Org mode allows a lot more entry types than described in Denote, for example #+startup: and #+properties:, #+options:. It also allows using bespoke keywords.

I see. You mention "several" which makes me think that you insert those on a case-by-case basis? If you were doing it for all notes, the easiest way to get the renaming and creation of new notes to insert those is to modify the variable denote-org-front-matter.

Can this function be rewritten to replace the content, instead of replacing the complete front matter?

If the above is not appropriate for you, then yes we will need to rewrite the code.

[ This is, by the way, why the rewriting of the front matter always asks for confirmation and never saves the underlying buffer. ]

from denote.

pprevos avatar pprevos commented on September 14, 2024

Each note has a different purpose and can have buffer local variables. I use notes a lot to develop snippets of code in Org source blocks, so I have settings for this. Other notes are math-heavy, so the Latex preview feature is on etc.

Ideally,Denote should respect the existing (non-Denote generated) lines in the front matter.

I assume the same would apply to Markdown. Should someone want o convert the note to a website with the Hugo software for example.

from denote.

protesilaos avatar protesilaos commented on September 14, 2024

Thanks for the explanation! In this case we need a more sophisticated method to rewriting the front matter. Now we take an all-or-nothing approach of changing the entire block. The replacement should be done on a per-line basis.

Will think about it some more and work on it tomorrow morning (local time is close to 23h and I've been awake since ~4).

I shall keep you posted on my progress.

from denote.

protesilaos avatar protesilaos commented on September 14, 2024

Will think about it some more and work on it tomorrow morning (local time is close to 23h and I've been awake since ~4).

"Tomorrow morning" arrived earlier than expected... I just pushed commit 4ebd1e9 in the new refactor-front-matter-rewrite branch. I have tested it and it seems to work reliably, but I have not merged it into main yet just to be sure everything is in order.

Can you use git to test this right away? Otherwise I will put together the relevant code you need to evaluate in order to test this.

from denote.

pprevos avatar pprevos commented on September 14, 2024

Happy to test now. It is a wonderful chill Sunday morning for me here in Australia.

Look after your health Prot, we all need sleep!

from denote.

protesilaos avatar protesilaos commented on September 14, 2024

Hello again Peter,

I tested it again and updated the documentation. The code is now in the main branch.

Look after your health Prot, we all need sleep!

Thank you! You are absolutely right. Normally I sleep properly. Yesterday was an exception.

from denote.

pprevos avatar pprevos commented on September 14, 2024

Hi Prot,

I tried to test the change, but could not figure out how to jump branches.

Just renamed some test files with non-Denote Org mode keywords at the end, start and in the middle of the front matter. I also added a property drawer.

The new method respects existing Org mode keywords. Thanks for the changes.

from denote.

protesilaos avatar protesilaos commented on September 14, 2024

I tried to test the change, but could not figure out how to jump branches.

No worries! I should have explained it.

Just renamed some test files with non-Denote Org mode keywords at the end, start and in the middle of the front matter. I also added a property drawer.

The new method respects existing Org mode keywords. Thanks for the changes.

So you tried the main branch, right? I am happy to read this.

If the rewriting works properly in all scenaria, I think it makes sense to align it with the semantics of the user option denote-dired-rename-expert, so that it does not ask for confirmation. But let's leave that for the future. Just to be sure it does the right thing.

from denote.

pprevos avatar pprevos commented on September 14, 2024

I like the confirmation. renaming is a serious task in a system with strict naming conventions.

P.S. I just also tested the Markdown dialects and text file versions - all OK.

from denote.

protesilaos avatar protesilaos commented on September 14, 2024

I like the confirmation. renaming is a serious task in a system with strict naming conventions.

Agreed! Let's keep it as-is.

P.S. I just also tested the Markdown dialects and text file versions - all OK.

Great!

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.