Skip to content

Allows saving a file after introducing read-only mode #12

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

markflarup
Copy link
Contributor

I happened to have introduced a bug with pr #11 🙁

SOPS was no longer able to save the file as the buffer was read-only.
Invoking sops-save-file returned *Messages* buffer: funcall-interactively: Buffer is read-only: #<buffer foo.yaml>.

Manually disabling read-only-mode before invoking sops-edit-file made it possible to encrypt the file with sops-save-file.

I've fixed this by disabling read-only-mode before the buffer is erased and re-enabling read-only-mode when the buffer is saved. This allows for editing and saving a sops encrypted file, while still preventing the user from accidentally editing an encrypted file (hence the need to enable read-only-mode again).

Sorry for the inconvenience.

@djgoku
Copy link
Owner

djgoku commented Feb 6, 2025

I'll just back out the last commit for now. I hope it doesn't cause too much of an issue with your workflow.

I wrote a few extra tests for your pr and never pushed them. Let me get them added and then add a few more before circling back here.

@markflarup
Copy link
Contributor Author

I'll just back out the last commit for now. I hope it doesn't cause too much of an issue with your workflow.

No worries and don't stress it. I've been working of my fork since I realized this today. You can say this change has been vetted a bit more already.

I wrote a few extra tests for your pr and never pushed them. Let me get them added and then add a few more before circling back here.

Sweet! I'm eager to see how they're written. Elisp is quite new to me and the testing aspect is definitely uncharted territory.

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

Successfully merging this pull request may close these issues.

2 participants