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

Discourage accidentally modifying packages by making such buffers read-only #16350

Closed
wants to merge 1 commit into from

Conversation

bcc32
Copy link
Contributor

@bcc32 bcc32 commented Apr 4, 2024

Not sure if this would be controversial, but I do find myself frequently editing installed packages when I meant to be editing a git checkout of them. I think it's usually not productive to edit installed packages because edits will be overwritten whenever the package is upgraded, so this should help mitigate this footgun.

@bcc32
Copy link
Contributor Author

bcc32 commented Apr 4, 2024

Hmm, I don't really understand why the CI build is failing. I don't see any errors like this when installing packages by hand.

@smile13241324
Copy link
Collaborator

hmm this seems to kill package installation on base

@allentiak
Copy link
Contributor

@bcc32
It seems there have been some changes to the elisp tests workflow file.
(See ffcfff3.)

Have you tried rebasing your changes on current develop?

@smile13241324
Copy link
Collaborator

This seems to make autoloaded files read only.

An error occurred while installing evil (error: (error goto-chg-pkg.el:0:0: error: buffer-read-only: ( *autoload-file*)))

@bcc32
Copy link
Contributor Author

bcc32 commented Jul 8, 2024

Aha, it seems to work fine for me because package-generate-autoloads has changed in Emacs 29 from calling update-directory-autoloads (which is now obsolete) to loaddefs-generate. Only the former has trouble due to applying the directory-local buffer-read-only=t value. While we probably can't require Emacs 29 as the minimum version for Spacemacs just yet, could we at least add CI for it, and maybe we can put off this PR until we don't support Emacs <29 anymore?

@bcc32
Copy link
Contributor Author

bcc32 commented Jul 8, 2024

Ah, Emacs 29.3 was already added to the CI, thanks!

This is meant as a small deterrent to accidentally editing installed
package files, when the user most likely navigated there by
find-library or find-function, and wanted to instead make some changes
to a local copy of the installed package.
@bcc32 bcc32 changed the title Add .dir-locals.el to discourage accidentally modifying packages Discourage accidentally modifying packages by making such buffers read-only Jul 12, 2024
@bcc32
Copy link
Contributor Author

bcc32 commented Jul 12, 2024

Hmm, I'm not 100% sure if there's a good way to do this that is robustly going to apply when the user is visiting a file, but won't break things that actually need to edit/recompile/generate such files.

@bcc32 bcc32 closed this Jul 12, 2024
@bcc32 bcc32 deleted the read-only-elpa branch July 12, 2024 03:31
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.

3 participants