-
Notifications
You must be signed in to change notification settings - Fork 6
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
Using advice-around instead of hook trigger for mode enable. #6
Conversation
The original funcition `auto-sudoedit-sudoedit-and-kill' using buffer redirect method to replace the origin dired displayed buffer with the tramped one, and indeed that this procedure working for the hook both for `dired-mode-hook' or `find-file-hook' caused by the original `auto -sudoedit-mode' trigger. But for thus, the `kill-this-buffer' way will corrupted the origin buffer argument for the next hook rounder which will destroyed the whole dired or find-file initializing procedure. For avoiding this problem, this commit using the around-advices re-wrappering the `dired' and `find-file' which just transfer the tramp-transfered path for the rest process powered by the original package builtin function `auto-sudoedit-tramp-path'.
Original buffer-kill-replace mechanism will cause dired rest process corrupted, refer to the the PR: ncaq/auto-sudoedit#6 Waiting for merging.
auto-sudoedit.el
Outdated
(let ((first-existing-path (f-traverse-upwards #'f-exists? curr-path))) | ||
(unless (and first-existing-path (f-writable? first-existing-path)) | ||
(auto-sudoedit-sudoedit-and-kill)))))) | ||
(defun auto-sudoedit (_old_func &rest _args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The args
arguments is used.
However this naming starting underscore.
underscore show unused variable.
I think to should naming normal.
auto-sudoedit.el
Outdated
(let ((tramp-path (auto-sudoedit-tramp-path curr-path))) | ||
(apply _old_func tramp-path (cdr _args))) | ||
(apply _old_func _args))) | ||
(apply _old_func _args)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and, these argumest is used.
Sorry for a week delayed thus. Thanks for your reviews, the naming convention problems has been fixed |
Others: Update autosudoedit package commit refers to ncaq/auto-sudoedit#6
Tracking to the PR merged of ncaq/auto-sudoedit#6
Using advice-around instead of hook trigger for mode enable.
The original funcition 'auto-sudoedit-sudoedit-and-kill' using buffer redirect method to replace the origin dired displayed buffer with the tramped one, and indeed that this procedure working for the hook both for 'dired-mode-hook' or 'find-file-hook' caused by the original 'auto -sudoedit-mode' trigger. But for thus, the 'kill-this-buffer' way will corrupted the origin buffer argument for the next hook rounder which will destroyed the whole dired or find-file initializing procedure.
For avoiding this problem, this commit using the around-advices re-wrappering the 'dired' and 'find-file' which just transfer the tramp-transfered path for the rest process powered by the original package builtin function 'auto-sudoedit-tramp-path'.