crux icon indicating copy to clipboard operation
crux copied to clipboard

Fix #23

Open gongzhitaao opened this issue 10 years ago • 6 comments

  1. Porting to new advice syntax for crux-with-region-or-line.
  2. Add parameter remove to crux-with-region-or-line allowing the user to remove such advice.

gongzhitaao avatar Feb 29 '16 20:02 gongzhitaao

Apart from my inline comments - please capitalize the word fix in the commit messages - [Fix #23] ....

bbatsov avatar Mar 17 '16 09:03 bbatsov

Actually there is a small bug in Emacs. comment-or-uncomment uses (interactive "*r\nP"), for the formatter r, if local mark ring is empty, it will show an error message The mark is not set now, so there is no region without executing the function and advice at all. kill-ring-save does not use this r formatter, so it works fine. The only work-around is to push some random mark (C-SPC C-SPC) into local mark ring before comment or uncomment some lines.

gongzhitaao avatar Mar 17 '16 14:03 gongzhitaao

That's unfortunate. Did you report this upstream?

bbatsov avatar Apr 30 '16 15:04 bbatsov

FWIW define-advice wraps (defun ...) (advice-add ...) and has a nice function-name@advice-name naming convention, which I think is handy if you use a completion system like helm or ivy, since searching for the original function will bring up the advice function too. So it'd be e.g. fill-region@crux-with-region-or-buffer.

dieggsy avatar Jul 20 '17 20:07 dieggsy

@dieggsy Is define-advice some new Emacs addition?

bbatsov avatar Jan 13 '18 10:01 bbatsov

@bbatsov Ah yeah, it's probably new to emacs 25, so it may not be a good idea to incorporate yet?

dieggsy avatar Jan 13 '18 13:01 dieggsy