-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Port to new advice mechanism #23
Comments
I'm fine with your suggestions, so PR welcome! :-) The only small downside is that the new mechanism was introduced in Emacs 24.4, but I'm guessing the majority of people are using it anyways. |
Hi, |
I think @gongzhitaao never sent this PR, however, the old advice mechanism should work just fine with newer Emacsen. |
Ah, actually the PR got stalled by some upstream Emacs bug. My bad. |
Really sorry about this dangling submission
And yes, it has something to do with the upstream Emacs implementation. It is not a big deal but really annoying. And I use some hard-code workaround now (defun me--ad-with-region-or-line (args)
"Operate on line or region."
(if (region-active-p)
args
(let ((bol (+ (line-beginning-position) (current-indentation)))
(eol (line-end-position)))
(push-mark bol)
(goto-char eol)
(list bol eol (nth 2 args))))) If you need, I could test it and submit a PR, probably sometime next weekend since I'm running a dealine now 😄 |
Now I use this advice again. It seems the new version of emacs still has this bug LOL. So I have to manually push a mark as a workaround... |
According to Porting Old Advice, advice such as
crux-with-region-or-line
may need to be updated.Here is a proposed new advice syntax.
Either (personally prefer this style)
Or
On top of that, since
crux-with-region-or-line
adds advice, i.e., changes the behaviour of the function, it might be convenient to provide an option to remove the advice.So
(crux-with-region-or-line #'comment-or-uncomment-region)
adds advice to this function while(crux-with-region-or-line #'comment-or-uncomment-region t)
removes the advice.The text was updated successfully, but these errors were encountered: