2013-07-13 91 views
0

我在emacs中使用actionscript-mode,在這裏找到http://www.emacswiki.org/emacs/ActionScriptMode。我想修改它。問題在於TAB命令的行爲。我關心的是光標位於已包含代碼的行的第一列。 emacs中的大多數代碼編輯模式通過(1)執行縮進計算和調整以及(2)將光標前移到第一個非空白字符來處理這種情況。出於某種原因,動作模式確實是(1)而不是(2)。我如何修改它?我知道一點emacs-lisp,但不足以遵循代碼。我沒有要發佈整個動作-mode.el,但有可能會在本節的線索:emacs lisp(elisp):在actionscript-mode中修改indent-for-tab-command

(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

我想通了。命令返回縮進將光標置於該行的開頭。我需要修改幾件事情,因爲我希望在光標位於行中間的情況下保留相對位置,超過第一個非空白字符,但是如果光標位於第一個非空白字符之前那麼我想跑回去縮進。