-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Don't change default find-file behaviour #28
Conversation
I'll take a look at this. There's a writable check that should prevent this for files you can actually write to. Add if the hook's removed it should be documented. |
To be clear - I agree with the spirit of the change, but:
|
@bbatsov I'm still not clear what the purpose is of adding this function to the hook. |
@bbatsov ping, would you be able to take a look at this? |
The idea was that you won't have to think about the command at all as it would be applied automatically to some files if necessary. As I said before, I think the behaviour you've experienced is a bug in the file check done before reopening the file. The original idea was for this to affect just files owned by root. Anyways, I can imagine this being annoying, but I'm guessing some people also find it useful... |
There are two issues here: 1: This applies to reading all files that aren't owned by the current user. For example, 2: Users who want to simply view a file owned by root are prompted for sudo credentials. If they don't have sudo credentials, or don't want to use them, they're prompted every single time. This is my concern. How would you feel about making this opt-in? We could move this line of code to the readme or define a |
I agree. Probably making this a trivial mode that simply adds and removes this hook would be best. Or we can hook into saving the file so people are not prompted to do anything unless they actually try to change it... |
6cc6490
to
5969cc8
Compare
Wonderful, thanks for being supportive :) I've written a little global minor mode, let me know what you think. |
Looks good. Just mention it somewhere in the README. |
Rather than changing the default find-file behavior, providing a minor mode enables users to opt-in or toggle the behavior. Fixes bbatsov#20.
5969cc8
to
da6ca15
Compare
README updated. |
Currently, opening any file that is read-only and not owned by the
current user triggers a root login prompt. This occurs for viewing
system files (e.g /etc/fstab), built-in elisp
libraries (e.g. simple.el.gz) and simply viewing files owned by other
users on a shared system.
We can't assume that this is the behaviour users want, and changing
built-in functions without asking is surprising.
Fixes #20.