-
Notifications
You must be signed in to change notification settings - Fork 44
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
request for a hook to deal with read-only files #25
Comments
# Sorry for the late response.
Thanks for the feature request.
Please try `VCS-integration` branch. New hook is `wgrep-begin-edit-buffer-hook`
|
I don't think wgrep-begin-edit-buffer-hook will work, because it is too late. Here is the relevant call sequence:
Note that wgrep-get-file-buffer is called before wgrep-commit-buffer. (defun wgrep-get-file-buffer (file)
(unless (file-exists-p file)
(signal 'wgrep-error (list "File does not exist.")))
(unless (file-writable-p file)
(signal 'wgrep-error (list "File is not writable.")))
(or (get-file-buffer file)
(find-file-noselect file))) |
Oh, I see. You may need to change |
wgrep is wonderful, but it does not seem to handle read-only files too well.
I would like to propose adding a hook of some sorts to wgrep to deal
with files that are read-only due to it being under version control systems
that require a "check out" step to make it writable.
The hook would be called when wgrep detects that a file is read-only.
Let me illustrate my point via a temporary solution that I came up with.
What this does is to execute code above whenever wgrep-get-file-buffer
is called. If the file is read-only and it is under perforce, then
p4-edit is called on it to do "check out" which will make the file
writable.
If a hook variable was available in wgrep, then I probably could have
used it instead of using advice.
Thanks for a very useful package.
The text was updated successfully, but these errors were encountered: