3 ms·
Learn Emacs: use defadvice to modify functions
- swah 15y agoIsn't it dangerous to change that function if some other command/library depends on the original behavior? Why don't you just write my-zap-to-char like everyone else? :)
- kragen 15y agoIt's a little dangerous, but Emacs users have been making numbered backups automatically since before there was RCS. Since before there was GNU Emacs actually.
- rawsyntax 15y agoIt's a risk yes, but I've been using it this way for about a year and encountered no problems. I'm thinking of TIMTOWTDI, and that perhaps many people don't know about defadvice.
- swah 15y agoI also love hooks.
- gwern 15y agoIt is dangerous in theory, yeah. Much less so if you're a package like https://secure.wikimedia.org/wikipedia/en/wiki/Emacspeak https://secure.wikimedia.org/wikipedia/en/wiki/Emacspeak which, while almost entirely defadvice from what I've heard, doesn't modify any existing state.
- lelele 15y agoIt is dangerous only if you change the function's interface.
- swah 15y agoWhy? Its not like its a pure function. The change puts Emacs in a different state than with the original behavior...