3 ms·
HOKAY. So you can totally do this: > I'm guessing there's no easy way to replace the definition of the deleteToEndOfParagraph: action with something else... w
by natesm 15y ago
HOKAY. So you can totally do this:
> I'm guessing there's no easy way to replace the definition of the deleteToEndOfParagraph: action with something else...
with DYLD_INSERT_LIBRARIES and method_exchangeImplementations (and maybe launchd to apply that DYLD_INSERT_LIBRARIES to everything?).
What you have to do is:
Implement a category message that does what you want (my_deleteToEndOfParagraph:).
Write a function that uses method_exchangeImplementations to replace deleteToEndOfParagraph: with my_deleteToEndOfParagraph:. deleteToEndOfParagraph: probably depends on class (NSTextView, NSTextField, WebView, etc.)
Create a shared library that uses your function as an initialization routine.
Inject that shared library into every app on the system.
As you can see this is very easy. Har har har.
- Xuzz 15y agoIt's somewhat difficult to do DYLD_INSERT_LIBRARIES right on OSX; it tends to subtly break various system components even if your binary doesn't do anything. However, SIMBL (http://www.culater.net/software/SIMBL/SIMBL.php http://www.culater.net/software/SIMBL/SIMBL.php) usually works fine. (On the (jailbroken) iPhone, you'd want MobileSubstrate (http://iphonedevwiki.net/index.php/MobileSubstrate http://iphonedevwiki.net/index.php/MobileSubstrate), which does use DLYD_INSERT_LIBRARIES, where it causes few to no issues.) Also, when replacing methods, it's better to do it like this, by storing the actual function pointer to the implementation: http://pastie.org/private/nbaaog7hptyzsytahpc5a http://pastie.org/private/nbaaog7hptyzsytahpc5a — it makes "stacked" overrides (imagine an app tried to hook the same thing as well, you don't want that to cause issues) safer than renaming.
- krakensden 15y agoAnd people complain about Linux wasting your time.
- dextorious 15y agoAre you for real? As if the normal use case is that of a user wanting to change some text editing bindings back to Emacs-like behavior...
- thwarted 15y agoThere is no step three.