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

Using advice-around instead of hook trigger for mode enable. #6

Merged
merged 2 commits into from
Aug 9, 2019

Conversation

c0001
Copy link

@c0001 c0001 commented Jul 28, 2019

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'.

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'.
c0001 added a commit to c0001/entropy-emacs that referenced this pull request Jul 28, 2019
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)
Copy link
Owner

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))))
Copy link
Owner

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.

auto-sudoedit.el Outdated Show resolved Hide resolved
@c0001
Copy link
Author

c0001 commented Aug 8, 2019

Sorry for a week delayed thus.

Thanks for your reviews, the naming convention problems has been fixed
yet. I've tested and the monitoring the trails for a week as seeking
the decision reliable done. :)

@ncaq ncaq merged commit 4d7aeee into ncaq:master Aug 9, 2019
c0001 added a commit to c0001/entropy-emacs-extensions that referenced this pull request Aug 9, 2019
Others:

Update autosudoedit package commit refers to
ncaq/auto-sudoedit#6
c0001 added a commit to c0001/entropy-emacs that referenced this pull request Aug 9, 2019
ncaq added a commit that referenced this pull request Apr 9, 2020
Using advice-around instead of hook trigger for mode enable.
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.

None yet

2 participants