【问题标题】:emacs lisp (elisp): modifying indent-for-tab-command in actionscript-modeemacs lisp (elisp): 在 actionscript-mode 中修改 indent-for-tab-command
【发布时间】:2013-07-13 23:36:30
【问题描述】:

我在 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))))

这里的注释说“保持点在同一行的相对点上”。也许我可以关掉那部分。

【问题讨论】:

    标签: elisp


    【解决方案1】:

    我想通了。 back-to-indentation 命令将光标置于行首。我需要修改一些东西,因为我想在光标位于行中间的情况下保留相对位置,越过第一个非空白字符,但如果光标位于第一个非空白字符之前然后我想运行回缩进。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-05
      • 2011-06-20
      • 2011-04-13
      相关资源
      最近更新 更多