我正在使用qq函数将我的SQL请求存储在Perl中。像这样:
qq{
SELECT
table1.name,
table1.description
FROM
table1
WHERE
table1.id=?
}
但在Emacs cperl模式下,不可能在qq中使用tab,这会减慢我的工作速度。我该怎么修?
Emacs有很好的工具,可以很好地理解语法,因为它不是一个完整的解析器。
请在init文件中尝试此操作。
(defun my-cperl-indent-command ()
"indent as cperl normally
indent relatively inside multi-line strings.
"
(interactive)
(let ((state (syntax-ppss)))
(if (and (nth 3 state) ;string
(and (nth 8 state) ;multi-line?
(< (nth 8 state) (point-at-bol))))
(indent-relative)
(cperl-indent-command))))
(eval-after-load "cperl-mode" '(define-key cperl-mode-map [remap cperl-indent-command] 'my-cperl-indent-command))
当然,您仍然需要调整indent-relative
,使其能够完全按照您的意愿进行操作。参见tab-to-tab-stop