[英]Cycling through possible indentations in python.el in Emacs
Emacs的最新版本(例如24.3.93.1
)随附于python.el
。 如何为给定的块循环浏览不同级别的压痕?
例如在代码中:
for ix in range(10);
line1
line2 # <- two possible values of indentation for this line
EmacsWiki似乎没有提供有关此信息,我在Ch m
上找不到任何内容。 是否支持此功能?
两种python模式都使用TAB进行循环。 如果TAB不循环,请检查您的初始化响应。 考虑提交错误报告。
顺便说一句,它的完成方式略有不同:从最高位置开始,python.el将立即下降,而从正确的最高位置开始首先在python-mode.el上执行任何操作。 python-mode.el的第二个TAB将跳到第0列,然后逐个缩进。 Python.el进行相反的处理,逐个缩进地递减缩进,但从零列跳到最远。
使用Ch m知道这一点。 它调用describe-mode
函数。
您还可以查看python.el文件并查找define-key
:
;; Indent specific
(define-key map "\177" 'python-indent-dedent-line-backspace)
(define-key map (kbd "<backtab>") 'python-indent-dedent-line)
(define-key map "\C-c<" 'python-indent-shift-left)
(define-key map "\C-c>" 'python-indent-shift-right)
(define-key map ":" 'python-indent-electric-colon)
或indent
;; Indentation: Automatic indentation with indentation cycling is
;; provided, it allows you to navigate different available levels of
;; indentation by hitting <tab> several times. Also when inserting a
;; colon the `python-indent-electric-colon' command is invoked and
;; causes the current line to be dedented automatically if needed.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.