之前在before-save-hook
加了untabify
,但编辑Makefile
的时候发现有的语言需要严格区分tab和space,这些语言都有哪些?
Whitespace.
讲道理,Makefile 这个是典型的 bug as feature 的例子,其它只要是正经的语言不管 free form 还是 offside rule 都不区分 tab 和 space 的。
The problem with Dennis’s Makefile is that when he added the comment line, he inadvertently inserted a space before the tab character at the beginning of line 2. The tab character is a very important part of the syntax of Makefiles. All command lines (the lines beginning with cc in our example) must start with tabs. After he made his change, line 2 didn’t, hence the error.
“So what?” you ask, “What’s wrong with that?”
There is nothing wrong with it, by itself. It’s just that when you consider how other programming tools work in Unix, using tabs as part of the syntax is like one of those pungee stick traps in The Green Berets: the poor kid from Kansas is walking point in front of John Wayne and doesn’t see the trip wire. After all, there are no trip wires to watch out for in Kansas corn fields. WHAM!
--- Unix Haters' Handbook
你没有仔细的看文档呀
.RECIPEPREFIX
The first character of the value of this variable is used as the
character make assumes is introducing a recipe line. If the
variable is empty (as it is by default) that character is the
standard tab character. For example, this is a valid makefile:
.RECIPEPREFIX = >
all:
> @echo Hello, world
The value of '.RECIPEPREFIX' can be changed multiple times; once
set it stays in effect for all rules parsed until it is modified.
好吧,这两段都有点不知道在说什么。。。
untabify
会把所有的 Tab 都改成空格,不仅仅是那些缩进,大多数编程语言的字符串类型都允许使用 Tab 字符(不必转义),所以 untabify
理论上并不安全。
不过我字符串用tab是都是用的转义。。。
- cobol