1
我一直在使用上的PL/SQL mode,我一直對此感到滿意。Emacs'對齊在plsql模式下失敗
但是,當我嘗試align
或align-current
我剛剛得到一個錯誤:
declare
foo number;
x number;
y number;
begin
foo := 5;
x := 123;
y:=123;
end;
預期的結果是:
,我試圖對準align: Wrong type argument: sequencep, plsql-align-rules-list
示例代碼
declare
foo number;
x number;
y number;
begin
foo := 5;
x := 123;
y := 123;
end;
以下是plsql-mode代碼的相關部分(我希望):
;;;_ + Align
;; Should I make so that anything that is highlighted will line up?
;; Should we make a block anything inside()?
(eval-and-compile
(defcustom plsql-align-rules-list '() ""
:group 'plsql
:type 'align-rules-list-type)
;; Should I make so that anything that is highlighted will line up?
;; Should we make a block anything inside()?
(when (condition-case nil
(require 'align)
(error nil))
;; these are way too slow to use with indent before aligning
(unless (and plsql-align-rules-list plsql-debug)
(setq plsql-align-rules-list
'(
(plsql-assignment
(regexp . "\\(\\s-*\\):=\\(\\s-*\\)")
(group . (1 2))
(modes . '(plsql-mode))
(repeat t)
(tab-stop . nil))
(plsql-arrorw
(regexp . "\\(\\s-*\\)=>\\(\\s-*\\)")
(group . (1 2))
(modes . '(plsql-mode))
(repeat t)
(tab-stop . nil))
(plsql-equals ;; exclude the previous two cases
(regexp . "\\(\\s-*[^:]\\)=\\([^>]\\s-*\\)")
(group . (1 2))
(repeat t)
(tab-stop . nil)
(modes . '(plsql-mode)))
(plsql-operator ;; watch out for comments
(regexp . "\\(\\s-*\\)[-+/]{1}\\(\\s-*\\)")
(group . (1 2))
(repeat t)
(tab-stop . nil)
(modes . '(plsql-mode)))
(plsql-keywords
(regexp . "\\(\\s-+\\)\\(in\\|default\\|number\\|varchar2\\|blob\\|raw\\)\\b")
(group 1)
(repeat t)
(case-fold t)
(tab-stop . nil)
(modes . '(plsql-mode)))
)
))
(put 'plsql-align-rules-list 'risky-local-variable t)
(add-to-list 'align-c++-modes 'plsql-mode) ;; eg expression functions ...
(add-to-list 'align-sq-string-modes 'plsql-mode)
(add-to-list 'align-open-comment-modes 'plsql-mode)
;; Should we re-bind new-line-and-indent to align the current
;; region? That sounds expensive.
))
後來在defun plsql-mode()
:
(set (make-local-variable 'align-mode-rules-list) 'plsql-align-rules-list)
如何PLSQL模式應該進行修改,以獲得align
工作?我最好的變通到目前爲止是使用align-regexp
(由this answer啓發):
(defun my-align()
""
(interactive)
(align-regexp
(region-beginning) (region-end)
"\\(\\s-*\\):=" 1 1 nil))
這是好的但它不會修改右側。
作者不再使用該模式。我使用的是emacs 23.2.1。