3

I have been using a forked version of python.el for some time in which I have changed the indentation rules so that instead of

something.method1()\
         .method2()

and

stuff = (1, 2, 3,
         4, 5, 6)

I get

something.method1()\
    .method2()

and

stuff = (1, 2, 3,
    4, 5, 6)

My changes are on GitHub at this commit and this commit, respectively.

The problem is that my forked version of python.el is out of date, and there's been a lot of development since then. So my question is: how can I make the same changes by modifying my init file, without modifying the source of python.el?

3
  • 4
    If you've only modified a function or two, why not put your versions in your init file after you load python.el? Your modified functions will then clobber the originals.
    – Dan
    Nov 14 '14 at 22:27
  • 1
    Seems like a good use-case for the advice mechanism. I'll try to write up a proper answer later when I have more time.
    – user1968
    Nov 14 '14 at 23:08
  • I like to clobber and completely take over major and minor modes -- :) -- I make them my own by adding prefixes to everything and making new libraries -- then, I modify the daylights out of them. If I want the default behavior, it's always there by calling the original modes.
    – lawlist
    Nov 15 '14 at 0:17
3

That's what the advice mechanism is for. Look up advice-add or defadvice.

This said, what you describe sounds not terribly specific to your use-case, so an even better solution is to M-x report-emacs-bug and attach your changes as a patch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.