Updated Spanish translation
[anjuta.git] / data / templates / indent.tpl
blobb186b3960bfad7e144714c6a89af9f7f6defc1a0
1 [+ autogen5 template +]
2 [+DEFINE START-INDENT \+]
3 [+(out-push-new)\+]
4 [+ENDDEF \+]
5 [+DEFINE END-INDENT \+]
6 [+(for-each
7         indent
8         (string-split (out-pop #t) #\nl);
9 )\+]
10 [+ENDDEF \+]
11 [+(define
12         indentation
13         (lambda
14                 (tab)
15                 (let*
16                         (
17                                 (use-tabs (not (zero? (or (string->number (get "UseTabs")) 8))))
18                                 (tab-width (or (string->number (get "TabWidth")) 8))
19                                 (indent-width (or (string->number (get "IndentWidth")) 1))
20                                 (spaces (* tab indent-width))
21                                 (tab-indent (if use-tabs (quotient spaces tab-width) 0))
22                                 (space-indent (- spaces (* tab-indent tab-width)))
23                         )
24                         (string-append
25                                 (make-string tab-indent #\ht)
26                                 (make-string space-indent #\sp)
27                         )
28                 )
29         )
31 (define
32         indent
33         (lambda
34                 (line)
35                 (let
36                         ((tab (or (string-skip line #\ht) 0)))
37                         (emit 
38                                 (string-append
39                                         (indentation tab)
40                                         (string-drop line tab)
41                                         "\n"
42                                 )
43                         )
44                 )       
45         )
46 ) \+]
47 [+DEFINE EMACS-MODELINE \+]
48 -*- Mode: [+MODE+]; indent-tabs-mode: [+(if (== (get "UseTabs") "1") "t" "nil")+]; c-basic-offset: [+IndentWidth+]; tab-width: [+TabWidth+] -*- [+ENDDEF \+]