我在emacs中使用actionscript-mode,在http://www.emacswiki.org/emacs/ActionScriptMode找到。我想修改它。问题在于TAB命令的行为。我关心的是光标位于包含代码的行的第一列。 emacs中的大多数代码编辑模式通过以下方式处理这种情况:(1)执行缩进计算和调整,以及(2)将光标前进到第一个非空白字符。出于某种原因,actionscript-mode执行(1)但不执行(2)。我怎么修改它?我知道一些emacs-lisp但不足以遵循代码。我不会发布整个actionscript-mode.el,但这部分可能有一个线索:
(defun actionscript-indent-line ()
"Indent current line of As3 code. Delete any trailing
whitespace. Keep point at same relative point in the line."
(interactive)
(save-excursion
(end-of-line)
(delete-horizontal-space))
(let ((old-pos (point)))
(back-to-indentation)
(let ((delta (- old-pos (point)))
(col (max 0 (as3-calculate-indentation))))
(indent-line-to col)
(forward-char delta))))
这里的评论说“保持点在同一个相对点。”也许我可以关掉这一部分。
答案 0 :(得分:0)
我明白了。命令back-to-indentation将光标放在行的开头。我需要修改一些东西,因为我希望保留光标位于行中间的情况下的相对位置,超过第一个非空白字符,但是如果光标位于第一个非空白字符之前然后我想回到缩进。