Coder Social home page Coder Social logo

Comments (7)

mentalisttraceur avatar mentalisttraceur commented on July 28, 2024

Thinking about it a bit more, I think pulling save into the lowest-level-but-still-public-API rewrite function is probably not the right play - better to just empower composition.

So for point 2 above, I now recommend the return value approach - just allowing the caller to know after the call if the rewrite happened is more flexible than pulling the save into the rewrite.

from denote.

jeanphilippegg avatar jeanphilippegg commented on July 28, 2024

You are right. The coupling is not ideal.

In my fork of the code (not announced yet elsewhere), I have made the options denote-rename-confirmations and denote-save-buffers control how the renaming commands confirm and save buffers. All renaming commands will respect those variables. None will have any optional parameters anymore regarding that.

denote-rename-confirmations will default to '(add-front-matter rewrite-front-matter modify-file-name) and denote-save-buffers to nil.

In the release notes for version 2.3.0, Prot has expressed a wish to wait until late April for new features.

I plan on making the pull requests to include everything that can be included back from my fork into Denote.

But first, there will be 2 other pull requests that will come before this one: I will first add denote-forced-* variables to help in customizing denote commands and then I will submit a refactor of all renaming commands to remove all code duplication and enhance their flexibility. It will be very easy for developers as well as users to define their own custom renaming commands.

It will be very easy to have separate renaming commands for all file name components (or multiple).

This is all done already in my fork. I will make it public this weekend, but I will do the pull requests in May!

from denote.

protesilaos avatar protesilaos commented on July 28, 2024

Yeah, the idea is to wait a bit for new features or more fundamental changes so that we can fix obvious bugs. Once we are sure that users are okay with what they have, we resume the work. A more fine-grained control over these confirmations is a good idea.

from denote.

mentalisttraceur avatar mentalisttraceur commented on July 28, 2024

Yep, I saw that in the release notes and totally respect that - I'm raising this now because this could be seen as a bug, and point 1 of my proposal as the fix.

Consider: if I hadn't read the changelog and checked the docstrings of functions I use, I wouldn't have realized that code which I wrote+tested+trusted to only save when deemed safe by my checks would now suddenly start saving files in other situations as well.

Personally, I don't mind - I already protected myself from this by proactively thoroughly checking the change log* and immediately adjusting my code. Cool, no data loss happened, no bad feelings.

But I think users would have been justified in expecting that the meaning/effect of a parameter named "no confirm" in a public API function wouldn't get promoted to "no confirm and save".

On the other hand, if you've got one or two users who prefer the new behavior, maybe that's more representative of a typical user. And the odds of serious data loss from this are probably low? So I'm not saying that you definitely should treat this as a bug, I'm just suggesting to think about it.

* Speaking of, thank you very much for that thorough change log! I know those are really hard to write even in basic form, and yours is both thorough and has an impressive degree of polish.

from denote.

protesilaos avatar protesilaos commented on July 28, 2024

I just merged the contribution of @jeanphilippegg which should fix this issue. Please check.

from denote.

mentalisttraceur avatar mentalisttraceur commented on July 28, 2024

@protesilaos thanks! I just read over most of that change, and it looks good to me.

from denote.

protesilaos avatar protesilaos commented on July 28, 2024

Thank you!

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.