Answers:
基于Purple_arrows的解决方案:
(defun my-makefile-indent-line ()
(save-excursion
(forward-line 0)
(cond
;; keep TABs
((looking-at "\t")
t)
;; indent continuation lines to 4
((and (not (bobp))
(= (char-before (1- (point))) ?\\))
(delete-horizontal-space)
(indent-to 4))
;; delete all other leading whitespace
((looking-at "\\s-+")
(replace-match "")))))
(add-hook 'makefile-mode-hook
(lambda ()
(setq-local indent-line-function 'my-makefile-indent-line)))
FILES
和LIBS
很长,并且后面有一个元素:=
,并且最好将后面的元素与后面的第一个元素对齐,该:=
怎么办?
是。可以通过某种方式进行配置。
(对蛇的道歉。)
编写一个函数,缩进一条线,你所希望的方式,然后设置函数作为变量的值indent-line-function
了makefile-mode
。就像是:
(defun my-makefile-indent-line ()
...)
(add-hook 'makefile-mode-hook (lambda () (setq-local indent-line-function 'my-makefile-indent-line)))
indent-according-to-mode
命令?