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

Generalizing this package #210

Open
walseb opened this issue Sep 22, 2023 · 2 comments
Open

Generalizing this package #210

walseb opened this issue Sep 22, 2023 · 2 comments

Comments

@walseb
Copy link

walseb commented Sep 22, 2023

Hello!

I'm working on overhauling a package that uses a git repo to store every change you make in all buffers, so that you can restore your buffer to any previous state at any time (link: https://github.com/walseb/git-backup-ivy).

One major issue I'm facing is that whenever you revert to a previous state, the entire buffer gets overwritten and so all markers get messed up - the same issue this package solves for formatters.

Is there any way I could use this package to solve that problem?

I'd need a function that takes a string and changes the current buffer into that string, maintaining the markers as best it can. After reading the description of this package, it seems that it does exactly that, as well as running the actual formatter processes.

Thank you!

@raxod502
Copy link
Member

You can probably use Apheleia for that. This would be, to my knowledge, the first usage of Apheleia as a library rather than a user-facing application. Bind apheleia-formatters to define an Elisp function formatter and then invoke apheleia-format-buffer. The Elisp function formatter can overwrite the buffer contents with your desired string. If that works, you can provide feedback on the usability from a library perspective and we can consider improvements to the interface.

@walseb
Copy link
Author

walseb commented Sep 23, 2023

Great, I will try it out. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants