Question

I there any way to change python-mode indenting for function args, so instead of

urlpattrens = patterns('',
                       view,
                       name='view')

on enter key press formating will be following:

urlpattrens = patterns('',
    view,
    name='view')

?

Était-ce utile?

La solution

After upcoming release of python-mode.el 6.1.2 introduction of indent-styles is at the table.

See https://bugs.launchpad.net/python-mode/+bug/1197521

Consider to add your request there.

For the moment you could install a macro correcting the indent of the first line "view," - afterwards that indent should be honored.

For any curious to hack the indent-machine: here some pseudo-code indicating the entry-point:

+++ python-mode.el  2013-08-16 13:47:45.059486451 +0200
@@ -10859,7 +10859,10 @@
                            ((< (current-indentation) (current-column))
                             (+ (current-indentation) py-indent-offset))
                            (t (py-fetch-previous-indent orig)))
-                        (cond ((looking-at "\\s([ \t]*$")
+                        (cond (
+                               NEW_VAR_SET
+
+                               (looking-at "\\s([ \t]*$")
                                (py-empty-arglist-indent nesting py-indent-offset indent-offset))
                               ((looking-at "\\s([ \t]*\\([^ \t]+.*\\)$")
                                (goto-char (match-beginning 1))
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top