>From 3a0454293fd147d8d312befa86131e168fabc79f Mon Sep 17 00:00:00 2001
From: Colomban Wendling <ban@herbesfolles.org>
Date: Sat, 13 Aug 2011 18:10:12 +0200
Subject: [PATCH 1/2] Add support for filetype-specific indentation overrides

---
 data/filetypes.actionscript     |    5 +
 data/filetypes.ada              |    5 +
 data/filetypes.asm              |    5 +
 data/filetypes.c                |    5 +
 data/filetypes.caml             |    5 +
 data/filetypes.cmake            |    5 +
 data/filetypes.cobol            |    5 +
 data/filetypes.conf             |    5 +
 data/filetypes.cpp              |    5 +
 data/filetypes.cs               |    5 +
 data/filetypes.css              |    5 +
 data/filetypes.d                |    5 +
 data/filetypes.diff             |    5 +
 data/filetypes.docbook          |    5 +
 data/filetypes.erlang           |    5 +
 data/filetypes.f77              |    4 +
 data/filetypes.ferite           |    5 +
 data/filetypes.forth            |    5 +
 data/filetypes.fortran          |    5 +
 data/filetypes.freebasic        |    5 +
 data/filetypes.glsl             |    5 +
 data/filetypes.haskell          |    5 +
 data/filetypes.haxe             |    5 +
 data/filetypes.html             |    5 +
 data/filetypes.java             |    5 +
 data/filetypes.javascript       |    5 +
 data/filetypes.latex            |    5 +
 data/filetypes.lisp             |    5 +
 data/filetypes.lua              |    5 +
 data/filetypes.makefile         |    5 +
 data/filetypes.matlab           |    5 +
 data/filetypes.nsis             |    5 +
 data/filetypes.pascal           |    5 +
 data/filetypes.perl             |    5 +
 data/filetypes.php              |    5 +
 data/filetypes.po               |    5 +
 data/filetypes.python           |    5 +
 data/filetypes.r                |    5 +
 data/filetypes.restructuredtext |    5 +
 data/filetypes.ruby             |    5 +
 data/filetypes.sh               |    5 +
 data/filetypes.sql              |    5 +
 data/filetypes.tcl              |    5 +
 data/filetypes.vala             |    5 +
 data/filetypes.verilog          |    5 +
 data/filetypes.vhdl             |    5 +
 data/filetypes.xml              |    5 +
 data/filetypes.yaml             |    5 +
 doc/geany.html                  |  224 +++++++++++++++++++++++----------------
 doc/geany.txt                   |   24 ++++
 src/document.c                  |   49 +++++----
 src/filetypes.c                 |   26 +++++
 src/filetypes.h                 |    3 +
 53 files changed, 448 insertions(+), 117 deletions(-)

diff --git a/data/filetypes.actionscript b/data/filetypes.actionscript
index 5119e76..b69b957 100644
--- a/data/filetypes.actionscript
+++ b/data/filetypes.actionscript
@@ -54,6 +54,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.ada b/data/filetypes.ada
index cf0f520..72dd6a1 100644
--- a/data/filetypes.ada
+++ b/data/filetypes.ada
@@ -43,6 +43,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 
 [build_settings]
 # %f will be replaced by the complete filename
diff --git a/data/filetypes.asm b/data/filetypes.asm
index fa91ef7..f5bde3f 100644
--- a/data/filetypes.asm
+++ b/data/filetypes.asm
@@ -49,6 +49,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.c b/data/filetypes.c
index a212315..c54c7b2 100644
--- a/data/filetypes.c
+++ b/data/filetypes.c
@@ -63,6 +63,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.caml b/data/filetypes.caml
index 4d43392..d074eef 100644
--- a/data/filetypes.caml
+++ b/data/filetypes.caml
@@ -46,6 +46,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.cmake b/data/filetypes.cmake
index eda9145..ca1c29c 100644
--- a/data/filetypes.cmake
+++ b/data/filetypes.cmake
@@ -47,3 +47,8 @@ comment_use_indent=true
 
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
+
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
diff --git a/data/filetypes.cobol b/data/filetypes.cobol
index 0f15564..747da57 100644
--- a/data/filetypes.cobol
+++ b/data/filetypes.cobol
@@ -41,3 +41,8 @@ comment_use_indent=false
 
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
+
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
diff --git a/data/filetypes.conf b/data/filetypes.conf
index 3824837..df9ca0e 100644
--- a/data/filetypes.conf
+++ b/data/filetypes.conf
@@ -36,3 +36,8 @@ comment_use_indent=true
 
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
+
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
diff --git a/data/filetypes.cpp b/data/filetypes.cpp
index 1380d3e..1687d70 100644
--- a/data/filetypes.cpp
+++ b/data/filetypes.cpp
@@ -65,6 +65,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.cs b/data/filetypes.cs
index 2bb11fc..711d1e6 100644
--- a/data/filetypes.cs
+++ b/data/filetypes.cs
@@ -65,6 +65,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.css b/data/filetypes.css
index 473e89f..dc38f97 100644
--- a/data/filetypes.css
+++ b/data/filetypes.css
@@ -61,3 +61,8 @@ comment_use_indent=true
 
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
+
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
diff --git a/data/filetypes.d b/data/filetypes.d
index fe30894..8a92ded 100644
--- a/data/filetypes.d
+++ b/data/filetypes.d
@@ -55,6 +55,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.diff b/data/filetypes.diff
index eff14b6..b7a7e91 100644
--- a/data/filetypes.diff
+++ b/data/filetypes.diff
@@ -26,3 +26,8 @@ extension=diff
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
diff --git a/data/filetypes.docbook b/data/filetypes.docbook
index cc62792..ab2449d 100644
--- a/data/filetypes.docbook
+++ b/data/filetypes.docbook
@@ -67,3 +67,8 @@ context_action_cmd=
 # if this setting is set to true, a new line after a line ending with an
 # unclosed tag will be automatically indented
 xml_indent_tags=true
+
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
diff --git a/data/filetypes.erlang b/data/filetypes.erlang
index d5bfc91..a4adb28 100644
--- a/data/filetypes.erlang
+++ b/data/filetypes.erlang
@@ -65,6 +65,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.f77 b/data/filetypes.f77
index 6043178..040cb0e 100644
--- a/data/filetypes.f77
+++ b/data/filetypes.f77
@@ -50,6 +50,10 @@ comment_use_indent=false
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+type=0
 
 [build_settings]
 # %f will be replaced by the complete filename
diff --git a/data/filetypes.ferite b/data/filetypes.ferite
index fc1a9fb..1dbc252 100644
--- a/data/filetypes.ferite
+++ b/data/filetypes.ferite
@@ -54,6 +54,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.forth b/data/filetypes.forth
index 30ac4f8..ba6090d 100644
--- a/data/filetypes.forth
+++ b/data/filetypes.forth
@@ -45,3 +45,8 @@ comment_use_indent=true
 
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
+
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
diff --git a/data/filetypes.fortran b/data/filetypes.fortran
index 099986c..fb35c20 100644
--- a/data/filetypes.fortran
+++ b/data/filetypes.fortran
@@ -50,6 +50,11 @@ comment_use_indent=false
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 
 [build_settings]
 # %f will be replaced by the complete filename
diff --git a/data/filetypes.freebasic b/data/filetypes.freebasic
index 5f7276f..eb8a547 100644
--- a/data/filetypes.freebasic
+++ b/data/filetypes.freebasic
@@ -54,6 +54,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.glsl b/data/filetypes.glsl
index 2e34b58..22d9b5f 100644
--- a/data/filetypes.glsl
+++ b/data/filetypes.glsl
@@ -68,6 +68,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.haskell b/data/filetypes.haskell
index 832a617..6c36da3 100644
--- a/data/filetypes.haskell
+++ b/data/filetypes.haskell
@@ -48,6 +48,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.haxe b/data/filetypes.haxe
index 78b331d..b14a93d 100644
--- a/data/filetypes.haxe
+++ b/data/filetypes.haxe
@@ -55,6 +55,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.html b/data/filetypes.html
index 10ef1d4..4a3f9d7 100644
--- a/data/filetypes.html
+++ b/data/filetypes.html
@@ -38,6 +38,11 @@ context_action_cmd=
 # unclosed tag will be automatically indented
 xml_indent_tags=true
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.java b/data/filetypes.java
index f438d34..d2a647a 100644
--- a/data/filetypes.java
+++ b/data/filetypes.java
@@ -56,6 +56,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 
 [build_settings]
 # %f will be replaced by the complete filename
diff --git a/data/filetypes.javascript b/data/filetypes.javascript
index 72a8cd1..8e8c446 100644
--- a/data/filetypes.javascript
+++ b/data/filetypes.javascript
@@ -53,6 +53,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.latex b/data/filetypes.latex
index 887faac..a95bd87 100644
--- a/data/filetypes.latex
+++ b/data/filetypes.latex
@@ -36,6 +36,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.lisp b/data/filetypes.lisp
index a10bb5a..637f33a 100644
--- a/data/filetypes.lisp
+++ b/data/filetypes.lisp
@@ -46,6 +46,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.lua b/data/filetypes.lua
index b62c8a2..594b8da 100644
--- a/data/filetypes.lua
+++ b/data/filetypes.lua
@@ -61,6 +61,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.makefile b/data/filetypes.makefile
index a20a1c9..81947d4 100644
--- a/data/filetypes.makefile
+++ b/data/filetypes.makefile
@@ -35,3 +35,8 @@ comment_use_indent=true
 
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
+
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+type=1
diff --git a/data/filetypes.matlab b/data/filetypes.matlab
index 47a8715..0e53ed8 100644
--- a/data/filetypes.matlab
+++ b/data/filetypes.matlab
@@ -39,6 +39,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.nsis b/data/filetypes.nsis
index bf0b56b..0b75cba 100644
--- a/data/filetypes.nsis
+++ b/data/filetypes.nsis
@@ -57,6 +57,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.pascal b/data/filetypes.pascal
index df98ff4..0943ef5 100644
--- a/data/filetypes.pascal
+++ b/data/filetypes.pascal
@@ -50,6 +50,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.perl b/data/filetypes.perl
index baaca45..d5403ba 100644
--- a/data/filetypes.perl
+++ b/data/filetypes.perl
@@ -69,6 +69,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.php b/data/filetypes.php
index 02f0870..e3cc614 100644
--- a/data/filetypes.php
+++ b/data/filetypes.php
@@ -34,6 +34,11 @@ context_action_cmd=
 # unclosed tag will be automatically indented
 xml_indent_tags=true
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.po b/data/filetypes.po
index b78f8e1..71c95c1 100644
--- a/data/filetypes.po
+++ b/data/filetypes.po
@@ -38,6 +38,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 
 [build_settings]
 # %f will be replaced by the complete filename
diff --git a/data/filetypes.python b/data/filetypes.python
index 52c5087..c131a9b 100644
--- a/data/filetypes.python
+++ b/data/filetypes.python
@@ -54,6 +54,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=0
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.r b/data/filetypes.r
index f4fedd6..ece66d8 100644
--- a/data/filetypes.r
+++ b/data/filetypes.r
@@ -49,3 +49,8 @@ comment_use_indent=false
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
diff --git a/data/filetypes.restructuredtext b/data/filetypes.restructuredtext
index aeb0a01..c9375f4 100644
--- a/data/filetypes.restructuredtext
+++ b/data/filetypes.restructuredtext
@@ -28,3 +28,8 @@ context_action_cmd=
 
 # sort tags by appearance
 symbol_list_sort_mode=1
+
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
diff --git a/data/filetypes.ruby b/data/filetypes.ruby
index c4136c0..3d64c5a 100644
--- a/data/filetypes.ruby
+++ b/data/filetypes.ruby
@@ -66,6 +66,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.sh b/data/filetypes.sh
index 52ca19b..5d77b57 100644
--- a/data/filetypes.sh
+++ b/data/filetypes.sh
@@ -44,6 +44,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.sql b/data/filetypes.sql
index 1a854ef..5249860 100644
--- a/data/filetypes.sql
+++ b/data/filetypes.sql
@@ -45,3 +45,8 @@ comment_use_indent=true
 
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
+
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
diff --git a/data/filetypes.tcl b/data/filetypes.tcl
index 47b1025..1d0c32e 100644
--- a/data/filetypes.tcl
+++ b/data/filetypes.tcl
@@ -51,6 +51,11 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 
 [build_settings]
 # %f will be replaced by the complete filename
diff --git a/data/filetypes.vala b/data/filetypes.vala
index 451e3b3..15520ce 100644
--- a/data/filetypes.vala
+++ b/data/filetypes.vala
@@ -66,6 +66,11 @@ comment_close=*/
 # context action command (please see Geany's main documentation for details)
 #context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
diff --git a/data/filetypes.verilog b/data/filetypes.verilog
index c86f495..9e64263 100644
--- a/data/filetypes.verilog
+++ b/data/filetypes.verilog
@@ -46,4 +46,9 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 
diff --git a/data/filetypes.vhdl b/data/filetypes.vhdl
index f313dc4..142eaeb 100644
--- a/data/filetypes.vhdl
+++ b/data/filetypes.vhdl
@@ -51,4 +51,9 @@ comment_use_indent=true
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
 
diff --git a/data/filetypes.xml b/data/filetypes.xml
index 72be59f..55ca468 100644
--- a/data/filetypes.xml
+++ b/data/filetypes.xml
@@ -108,3 +108,8 @@ context_action_cmd=
 # if this setting is set to true, a new line after a line ending with an
 # unclosed tag will be automatically indented
 xml_indent_tags=true
+
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
diff --git a/data/filetypes.yaml b/data/filetypes.yaml
index 6bd5c18..b210df8 100644
--- a/data/filetypes.yaml
+++ b/data/filetypes.yaml
@@ -41,3 +41,8 @@ comment_use_indent=true
 
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
+
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
diff --git a/doc/geany.html b/doc/geany.html
index 742761a..f337dbf 100644
--- a/doc/geany.html
+++ b/doc/geany.html
@@ -430,88 +430,89 @@ of this program, and also in the chapter <a class="reference internal" href="#gn
 <li><a class="reference internal" href="#keywords-section" id="id189">[keywords] section</a></li>
 <li><a class="reference internal" href="#lexer-properties-section" id="id190">[lexer_properties] section</a></li>
 <li><a class="reference internal" href="#settings-section" id="id191">[settings] section</a></li>
-<li><a class="reference internal" href="#build-settings-section" id="id192">[build_settings] section</a></li>
+<li><a class="reference internal" href="#indentation-section" id="id192">[indentation] section</a></li>
+<li><a class="reference internal" href="#build-settings-section" id="id193">[build_settings] section</a></li>
 </ul>
 </li>
-<li><a class="reference internal" href="#special-file-filetypes-common" id="id193">Special file filetypes.common</a><ul>
-<li><a class="reference internal" href="#named-styles-section" id="id194">[named_styles] section</a></li>
-<li><a class="reference internal" href="#id4" id="id195">[styling] section</a></li>
-<li><a class="reference internal" href="#id5" id="id196">[settings] section</a></li>
+<li><a class="reference internal" href="#special-file-filetypes-common" id="id194">Special file filetypes.common</a><ul>
+<li><a class="reference internal" href="#named-styles-section" id="id195">[named_styles] section</a></li>
+<li><a class="reference internal" href="#id4" id="id196">[styling] section</a></li>
+<li><a class="reference internal" href="#id5" id="id197">[settings] section</a></li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference internal" href="#filetype-extensions" id="id197">Filetype extensions</a></li>
-<li><a class="reference internal" href="#filetype-group-membership" id="id198">Filetype group membership</a></li>
-<li><a class="reference internal" href="#preferences-file-format" id="id199">Preferences file format</a><ul>
-<li><a class="reference internal" href="#build-menu-section" id="id200">[build-menu] section</a></li>
+<li><a class="reference internal" href="#filetype-extensions" id="id198">Filetype extensions</a></li>
+<li><a class="reference internal" href="#filetype-group-membership" id="id199">Filetype group membership</a></li>
+<li><a class="reference internal" href="#preferences-file-format" id="id200">Preferences file format</a><ul>
+<li><a class="reference internal" href="#build-menu-section" id="id201">[build-menu] section</a></li>
 </ul>
 </li>
-<li><a class="reference internal" href="#project-file-format" id="id201">Project file format</a><ul>
-<li><a class="reference internal" href="#build-menu-additions" id="id202">[build-menu] additions</a></li>
+<li><a class="reference internal" href="#project-file-format" id="id202">Project file format</a><ul>
+<li><a class="reference internal" href="#build-menu-additions" id="id203">[build-menu] additions</a></li>
 </ul>
 </li>
-<li><a class="reference internal" href="#templates" id="id203">Templates</a><ul>
-<li><a class="reference internal" href="#template-meta-data" id="id204">Template meta data</a></li>
-<li><a class="reference internal" href="#file-templates" id="id205">File templates</a><ul>
-<li><a class="reference internal" href="#adding-file-templates" id="id206">Adding file templates</a></li>
+<li><a class="reference internal" href="#templates" id="id204">Templates</a><ul>
+<li><a class="reference internal" href="#template-meta-data" id="id205">Template meta data</a></li>
+<li><a class="reference internal" href="#file-templates" id="id206">File templates</a><ul>
+<li><a class="reference internal" href="#adding-file-templates" id="id207">Adding file templates</a></li>
 </ul>
 </li>
-<li><a class="reference internal" href="#customizing-templates" id="id207">Customizing templates</a><ul>
-<li><a class="reference internal" href="#template-wildcards" id="id208">Template wildcards</a><ul>
-<li><a class="reference internal" href="#special-command-wildcard" id="id209">Special {command:} wildcard</a></li>
+<li><a class="reference internal" href="#customizing-templates" id="id208">Customizing templates</a><ul>
+<li><a class="reference internal" href="#template-wildcards" id="id209">Template wildcards</a><ul>
+<li><a class="reference internal" href="#special-command-wildcard" id="id210">Special {command:} wildcard</a></li>
 </ul>
 </li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference internal" href="#customizing-the-toolbar" id="id210">Customizing the toolbar</a><ul>
-<li><a class="reference internal" href="#manually-editing-the-toolbar-layout" id="id211">Manually editing the toolbar layout</a></li>
-<li><a class="reference internal" href="#available-toolbar-elements" id="id212">Available toolbar elements</a></li>
+<li><a class="reference internal" href="#customizing-the-toolbar" id="id211">Customizing the toolbar</a><ul>
+<li><a class="reference internal" href="#manually-editing-the-toolbar-layout" id="id212">Manually editing the toolbar layout</a></li>
+<li><a class="reference internal" href="#available-toolbar-elements" id="id213">Available toolbar elements</a></li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference internal" href="#plugin-documentation" id="id213">Plugin documentation</a><ul>
-<li><a class="reference internal" href="#html-characters" id="id214">HTML Characters</a><ul>
-<li><a class="reference internal" href="#insert-entity-dialog" id="id215">Insert entity dialog</a></li>
-<li><a class="reference internal" href="#replace-special-chars-by-its-entity" id="id216">Replace special chars by its entity</a><ul>
-<li><a class="reference internal" href="#at-typing-time" id="id217">At typing time</a></li>
-<li><a class="reference internal" href="#bulk-replacement" id="id218">Bulk replacement</a></li>
+<li><a class="reference internal" href="#plugin-documentation" id="id214">Plugin documentation</a><ul>
+<li><a class="reference internal" href="#html-characters" id="id215">HTML Characters</a><ul>
+<li><a class="reference internal" href="#insert-entity-dialog" id="id216">Insert entity dialog</a></li>
+<li><a class="reference internal" href="#replace-special-chars-by-its-entity" id="id217">Replace special chars by its entity</a><ul>
+<li><a class="reference internal" href="#at-typing-time" id="id218">At typing time</a></li>
+<li><a class="reference internal" href="#bulk-replacement" id="id219">Bulk replacement</a></li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference internal" href="#save-actions" id="id219">Save Actions</a><ul>
-<li><a class="reference internal" href="#instant-save" id="id220">Instant Save</a></li>
-<li><a class="reference internal" href="#backup-copy" id="id221">Backup Copy</a></li>
+<li><a class="reference internal" href="#save-actions" id="id220">Save Actions</a><ul>
+<li><a class="reference internal" href="#instant-save" id="id221">Instant Save</a></li>
+<li><a class="reference internal" href="#backup-copy" id="id222">Backup Copy</a></li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference internal" href="#contributing-to-this-document" id="id222">Contributing to this document</a></li>
-<li><a class="reference internal" href="#scintilla-keyboard-commands" id="id223">Scintilla keyboard commands</a><ul>
-<li><a class="reference internal" href="#keyboard-commands" id="id224">Keyboard commands</a></li>
+<li><a class="reference internal" href="#contributing-to-this-document" id="id223">Contributing to this document</a></li>
+<li><a class="reference internal" href="#scintilla-keyboard-commands" id="id224">Scintilla keyboard commands</a><ul>
+<li><a class="reference internal" href="#keyboard-commands" id="id225">Keyboard commands</a></li>
 </ul>
 </li>
-<li><a class="reference internal" href="#tips-and-tricks" id="id225">Tips and tricks</a><ul>
-<li><a class="reference internal" href="#document-notebook" id="id226">Document notebook</a></li>
-<li><a class="reference internal" href="#editor" id="id227">Editor</a></li>
-<li><a class="reference internal" href="#interface" id="id228">Interface</a></li>
-<li><a class="reference internal" href="#gtk-related" id="id229">GTK-related</a></li>
+<li><a class="reference internal" href="#tips-and-tricks" id="id226">Tips and tricks</a><ul>
+<li><a class="reference internal" href="#document-notebook" id="id227">Document notebook</a></li>
+<li><a class="reference internal" href="#editor" id="id228">Editor</a></li>
+<li><a class="reference internal" href="#interface" id="id229">Interface</a></li>
+<li><a class="reference internal" href="#gtk-related" id="id230">GTK-related</a></li>
 </ul>
 </li>
-<li><a class="reference internal" href="#compile-time-options" id="id230">Compile-time options</a><ul>
-<li><a class="reference internal" href="#src-geany-h" id="id231">src/geany.h</a></li>
-<li><a class="reference internal" href="#project-h" id="id232">project.h</a></li>
-<li><a class="reference internal" href="#editor-h" id="id233">editor.h</a></li>
-<li><a class="reference internal" href="#keyfile-c" id="id234">keyfile.c</a></li>
-<li><a class="reference internal" href="#build-c" id="id235">build.c</a></li>
+<li><a class="reference internal" href="#compile-time-options" id="id231">Compile-time options</a><ul>
+<li><a class="reference internal" href="#src-geany-h" id="id232">src/geany.h</a></li>
+<li><a class="reference internal" href="#project-h" id="id233">project.h</a></li>
+<li><a class="reference internal" href="#editor-h" id="id234">editor.h</a></li>
+<li><a class="reference internal" href="#keyfile-c" id="id235">keyfile.c</a></li>
+<li><a class="reference internal" href="#build-c" id="id236">build.c</a></li>
 </ul>
 </li>
-<li><a class="reference internal" href="#gnu-general-public-license" id="id236">GNU General Public License</a></li>
-<li><a class="reference internal" href="#license-for-scintilla-and-scite" id="id237">License for Scintilla and SciTE</a></li>
+<li><a class="reference internal" href="#gnu-general-public-license" id="id237">GNU General Public License</a></li>
+<li><a class="reference internal" href="#license-for-scintilla-and-scite" id="id238">License for Scintilla and SciTE</a></li>
 </ul>
 </div>
 <div class="section" id="introduction">
@@ -4914,8 +4915,45 @@ to filetypes for which the HTML or XML lexer is used. Such filetypes have
 this setting in their system configuration files.</dd>
 </dl>
 </div>
+<div class="section" id="indentation-section">
+<h4><a class="toc-backref" href="#id192">[indentation] section</a></h4>
+<p>This section allows to define indentation settings specific to the file type,
+overriding the ones configured in the preferences.  This can be useful for
+file types requiring specific indentation settings (e.g. tabs only for
+Makefile).  Please note that these settings also overrides the automatic
+detection.</p>
+<dl class="docutils">
+<dt>width</dt>
+<dd>The forced indentation width.</dd>
+<dt>type</dt>
+<dd><p class="first">The forced indentation type.</p>
+<table border="1" class="last docutils">
+<colgroup>
+<col width="18%" />
+<col width="82%" />
+</colgroup>
+<thead valign="bottom">
+<tr><th class="head">Value</th>
+<th class="head">Indentation type</th>
+</tr>
+</thead>
+<tbody valign="top">
+<tr><td>0</td>
+<td>Spaces only</td>
+</tr>
+<tr><td>1</td>
+<td>Tabs only</td>
+</tr>
+<tr><td>2</td>
+<td>Mixed (tabs and spaces)</td>
+</tr>
+</tbody>
+</table>
+</dd>
+</dl>
+</div>
 <div class="section" id="build-settings-section">
-<h4><a class="toc-backref" href="#id192">[build_settings] section</a></h4>
+<h4><a class="toc-backref" href="#id193">[build_settings] section</a></h4>
 <p>As of Geany 0.19 this section is supplemented by the <a class="reference internal" href="#build-menu-section">[build-menu] section</a>.
 Values that are set in the [build-menu] section will override those in this section.</p>
 <dl class="docutils">
@@ -4968,7 +5006,7 @@ complete filename, e.g. for shell scripts.</p>
 </div>
 </div>
 <div class="section" id="special-file-filetypes-common">
-<h3><a class="toc-backref" href="#id193">Special file filetypes.common</a></h3>
+<h3><a class="toc-backref" href="#id194">Special file filetypes.common</a></h3>
 <p>There is a special filetype definition file called
 filetypes.common. This file defines some general non-filetype-specific
 settings.</p>
@@ -4983,7 +5021,7 @@ the system file.</p>
 <p class="last">See the <a class="reference internal" href="#filetype-configuration">Filetype configuration</a> section for how to define styles.</p>
 </div>
 <div class="section" id="named-styles-section">
-<h4><a class="toc-backref" href="#id194">[named_styles] section</a></h4>
+<h4><a class="toc-backref" href="#id195">[named_styles] section</a></h4>
 <p>Named styles declared here can be used in the [styling] section of any
 filetypes.* file.</p>
 <p>For example:</p>
@@ -5010,7 +5048,7 @@ original style.</p>
 schemes menu</a>.</p>
 </div>
 <div class="section" id="id4">
-<h4><a class="toc-backref" href="#id195">[styling] section</a></h4>
+<h4><a class="toc-backref" href="#id196">[styling] section</a></h4>
 <dl class="docutils">
 <dt>default</dt>
 <dd><p class="first">This is the default style. It is used for styling files without a
@@ -5194,7 +5232,7 @@ arguments set whether to use the defined colors.</p>
 </dl>
 </div>
 <div class="section" id="id5">
-<h4><a class="toc-backref" href="#id196">[settings] section</a></h4>
+<h4><a class="toc-backref" href="#id197">[settings] section</a></h4>
 <dl class="docutils">
 <dt>whitespace_chars</dt>
 <dd><p class="first">Characters to treat as whitespace. These characters are ignored
@@ -5208,7 +5246,7 @@ when moving, selecting and deleting across word boundaries
 </div>
 </div>
 <div class="section" id="filetype-extensions">
-<h2><a class="toc-backref" href="#id197">Filetype extensions</a></h2>
+<h2><a class="toc-backref" href="#id198">Filetype extensions</a></h2>
 <p>To change the default filetype extension used when saving a new file,
 see <a class="reference internal" href="#filetype-definition-files">Filetype definition files</a>.</p>
 <p>You can override the list of file extensions that Geany uses to detect
@@ -5228,7 +5266,7 @@ Make=Makefile*;*.mk;Buildfile;
 </pre>
 </div>
 <div class="section" id="filetype-group-membership">
-<h2><a class="toc-backref" href="#id198">Filetype group membership</a></h2>
+<h2><a class="toc-backref" href="#id199">Filetype group membership</a></h2>
 <p>Group membership is also stored in <tt class="docutils literal">filetype_extensions.conf</tt>. This
 file is used to store information Geany needs at startup, whereas the
 separate filetype definition files hold information only needed when
@@ -5249,13 +5287,13 @@ None=None;
 </div>
 </div>
 <div class="section" id="preferences-file-format">
-<h2><a class="toc-backref" href="#id199">Preferences file format</a></h2>
+<h2><a class="toc-backref" href="#id200">Preferences file format</a></h2>
 <p>The user preferences file <tt class="docutils literal">geany.conf</tt> holds settings for all the items configured
 in the preferences dialog. This file should not be edited while Geany is running
 as the file will be overwritten when the preferences in Geany are changed or Geany
 is quit.</p>
 <div class="section" id="build-menu-section">
-<h3><a class="toc-backref" href="#id200">[build-menu] section</a></h3>
+<h3><a class="toc-backref" href="#id201">[build-menu] section</a></h3>
 <p>The [build-menu] section contains the configuration of the build menu.
 This section can occur in filetype, preferences and project files and
 always has the format described here.  Different menu items are loaded
@@ -5287,11 +5325,11 @@ starting at 00</li>
 </div>
 </div>
 <div class="section" id="project-file-format">
-<h2><a class="toc-backref" href="#id201">Project file format</a></h2>
+<h2><a class="toc-backref" href="#id202">Project file format</a></h2>
 <p>The project file contains project related settings and possibly a
 record of the current session files.</p>
 <div class="section" id="build-menu-additions">
-<h3><a class="toc-backref" href="#id202">[build-menu] additions</a></h3>
+<h3><a class="toc-backref" href="#id203">[build-menu] additions</a></h3>
 <p>The project file also can have extra fields in the [build-menu] section
 in addition to those listed in <a class="reference internal" href="#build-menu-section">[build-menu] section</a> above.</p>
 <p>When filetype menu items are configured for the project they are stored
@@ -5307,7 +5345,7 @@ filetype menu item 0 for the C filetype would be</p>
 </div>
 </div>
 <div class="section" id="templates">
-<h2><a class="toc-backref" href="#id203">Templates</a></h2>
+<h2><a class="toc-backref" href="#id204">Templates</a></h2>
 <p>Geany supports the following templates:</p>
 <ul class="simple">
 <li>ChangeLog entry</li>
@@ -5336,7 +5374,7 @@ save a file in the user's template configuration directory. You can
 also force this by selecting <em>Tools-&gt;Reload Configuration</em>.</p>
 </div>
 <div class="section" id="template-meta-data">
-<h3><a class="toc-backref" href="#id204">Template meta data</a></h3>
+<h3><a class="toc-backref" href="#id205">Template meta data</a></h3>
 <p>Meta data can be used with all templates, but by default user set
 meta data is only used for the ChangeLog and File header templates.</p>
 <p>In the configuration dialog you can find a tab &quot;Templates&quot; (see
@@ -5344,7 +5382,7 @@ meta data is only used for the ChangeLog and File header templates.</p>
 which will be inserted in the templates.</p>
 </div>
 <div class="section" id="file-templates">
-<h3><a class="toc-backref" href="#id205">File templates</a></h3>
+<h3><a class="toc-backref" href="#id206">File templates</a></h3>
 <p>File templates are templates used as the basis of a new file. To
 use them, choose the <em>New (with Template)</em> menu item from the <em>File</em>
 menu.</p>
@@ -5356,7 +5394,7 @@ optional template wildcards like <tt class="docutils literal">{fileheader}</tt>.
 wildcard can be placed anywhere, but it's usually put on the first
 line of the file, followed by a blank line.</p>
 <div class="section" id="adding-file-templates">
-<h4><a class="toc-backref" href="#id206">Adding file templates</a></h4>
+<h4><a class="toc-backref" href="#id207">Adding file templates</a></h4>
 <p>File templates are read from <tt class="docutils literal">templates/files</tt> under the
 <a class="reference internal" href="#configuration-file-paths">Configuration file paths</a>.</p>
 <p>The filetype to use is detected from the template file's extension, if
@@ -5367,7 +5405,7 @@ clicked.</p>
 </div>
 </div>
 <div class="section" id="customizing-templates">
-<h3><a class="toc-backref" href="#id207">Customizing templates</a></h3>
+<h3><a class="toc-backref" href="#id208">Customizing templates</a></h3>
 <p>Each template can be customized to your needs. The templates are
 stored in the <tt class="docutils literal"><span class="pre">~/.config/geany/templates/</span></tt> directory (see the section called
 <a class="reference internal" href="#command-line-options">Command line options</a> for further information about the configuration
@@ -5375,7 +5413,7 @@ directory). Just open the desired template with an editor (ideally,
 Geany ;-) ) and edit the template to your needs. There are some
 wildcards which will be automatically replaced by Geany at startup.</p>
 <div class="section" id="template-wildcards">
-<h4><a class="toc-backref" href="#id208">Template wildcards</a></h4>
+<h4><a class="toc-backref" href="#id209">Template wildcards</a></h4>
 <p>All wildcards must be enclosed by &quot;{&quot; and &quot;}&quot;, e.g. {date}.</p>
 <p><strong>Wildcards for character escaping</strong></p>
 <table border="1" class="docutils">
@@ -5588,7 +5626,7 @@ will only be replaced in file templates.</td>
 </tbody>
 </table>
 <div class="section" id="special-command-wildcard">
-<h5><a class="toc-backref" href="#id209">Special {command:} wildcard</a></h5>
+<h5><a class="toc-backref" href="#id210">Special {command:} wildcard</a></h5>
 <p>The {command:} wildcard is a special one because it can execute
 a specified command and put the command's output (stdout) into
 the template.</p>
@@ -5623,14 +5661,14 @@ standard error and in the Help-&gt;Debug Messages dialog.</p>
 </div>
 </div>
 <div class="section" id="customizing-the-toolbar">
-<h2><a class="toc-backref" href="#id210">Customizing the toolbar</a></h2>
+<h2><a class="toc-backref" href="#id211">Customizing the toolbar</a></h2>
 <p>You can add, remove and reorder the elements in the toolbar by using
 the toolbar editor, or by manually editing the configuration file
 <tt class="docutils literal">ui_toolbar.xml</tt>.</p>
 <p>The toolbar editor can be opened from the preferences editor on the Toolbar tab or
 by right-clicking on the toolbar itself and choosing it from the menu.</p>
 <div class="section" id="manually-editing-the-toolbar-layout">
-<h3><a class="toc-backref" href="#id211">Manually editing the toolbar layout</a></h3>
+<h3><a class="toc-backref" href="#id212">Manually editing the toolbar layout</a></h3>
 <p>To override the system-wide configuration file, copy it to your user
 configuration directory (see <a class="reference internal" href="#configuration-file-paths">Configuration file paths</a>).</p>
 <p>For example:</p>
@@ -5652,7 +5690,7 @@ will be used instead.</p>
 </div>
 </div>
 <div class="section" id="available-toolbar-elements">
-<h3><a class="toc-backref" href="#id212">Available toolbar elements</a></h3>
+<h3><a class="toc-backref" href="#id213">Available toolbar elements</a></h3>
 <table border="1" class="docutils">
 <colgroup>
 <col width="19%" />
@@ -5766,13 +5804,13 @@ use 'SearchEntry')</td>
 </div>
 </div>
 <div class="section" id="plugin-documentation">
-<h1><a class="toc-backref" href="#id213">Plugin documentation</a></h1>
+<h1><a class="toc-backref" href="#id214">Plugin documentation</a></h1>
 <div class="section" id="html-characters">
-<h2><a class="toc-backref" href="#id214">HTML Characters</a></h2>
+<h2><a class="toc-backref" href="#id215">HTML Characters</a></h2>
 <p>The HTML Characters plugin helps when working with special
 characters in XML/HTML, e.g. German Umlauts �� and ��.</p>
 <div class="section" id="insert-entity-dialog">
-<h3><a class="toc-backref" href="#id215">Insert entity dialog</a></h3>
+<h3><a class="toc-backref" href="#id216">Insert entity dialog</a></h3>
 <p>When the plugin is enabled, you can insert special character
 entities using <em>Tools-&gt;Insert Special HTML Characters</em>.</p>
 <p>This opens up a dialog where you can find a huge amount of special
@@ -5784,7 +5822,7 @@ the entity for the character at the current cursor position. You
 might also like to double click the chosen entity instead.</p>
 </div>
 <div class="section" id="replace-special-chars-by-its-entity">
-<h3><a class="toc-backref" href="#id216">Replace special chars by its entity</a></h3>
+<h3><a class="toc-backref" href="#id217">Replace special chars by its entity</a></h3>
 <p>To help make a XML/HTML document valid the plugin supports
 replacement of special chars known by the plugin. Both bulk
 replacement and immediate replacement during typing are supported.</p>
@@ -5800,7 +5838,7 @@ replacement and immediate replacement during typing are supported.</p>
 </dd>
 </dl>
 <div class="section" id="at-typing-time">
-<h4><a class="toc-backref" href="#id217">At typing time</a></h4>
+<h4><a class="toc-backref" href="#id218">At typing time</a></h4>
 <p>You can activate/deactivate this feature using the <em>Tools-&gt;HTML
 Replacement-&gt;Auto-replace Special Characters</em> menu item. If it's
 activated, all special characters (beside the given exceptions from
@@ -5809,7 +5847,7 @@ above) known by the plugin will be replaced by their entities.</p>
 of this feature.</p>
 </div>
 <div class="section" id="bulk-replacement">
-<h4><a class="toc-backref" href="#id218">Bulk replacement</a></h4>
+<h4><a class="toc-backref" href="#id219">Bulk replacement</a></h4>
 <p>After inserting a huge amount of text, e.g. by using copy &amp; paste, the
 plugin allows bulk replacement of all known characters (beside the
 mentioned exceptions). You can find the function under the same
@@ -5819,9 +5857,9 @@ configure a keybinding for the plugin.</p>
 </div>
 </div>
 <div class="section" id="save-actions">
-<h2><a class="toc-backref" href="#id219">Save Actions</a></h2>
+<h2><a class="toc-backref" href="#id220">Save Actions</a></h2>
 <div class="section" id="instant-save">
-<h3><a class="toc-backref" href="#id220">Instant Save</a></h3>
+<h3><a class="toc-backref" href="#id221">Instant Save</a></h3>
 <p>This plugin sets on every new file (<em>File-&gt;New</em> or <em>File-&gt;New (with template)</em>)
 a randomly chosen filename and set its filetype appropriate to the used template
 or when no template was used, to a configurable default filetype.
@@ -5831,7 +5869,7 @@ useful when you often create new files just for testing some code or something
 similar.</p>
 </div>
 <div class="section" id="backup-copy">
-<h3><a class="toc-backref" href="#id221">Backup Copy</a></h3>
+<h3><a class="toc-backref" href="#id222">Backup Copy</a></h3>
 <p>This plugin creates a backup copy of the current file in Geany when it is
 saved. You can specify the directory where the backup copy is saved and
 you can configure the automatically added extension in the configure dialog
@@ -5842,7 +5880,7 @@ copied into the configured backup directory when the file is saved in Geany.</p>
 </div>
 </div>
 <div class="section" id="contributing-to-this-document">
-<h1><a class="toc-backref" href="#id222">Contributing to this document</a></h1>
+<h1><a class="toc-backref" href="#id223">Contributing to this document</a></h1>
 <p>This document (<tt class="docutils literal">geany.txt</tt>) is written in <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a>
 (or &quot;reST&quot;). The source file for it is located in Geany's <tt class="docutils literal">doc</tt>
 subdirectory.  If you intend on making changes, you should grab the
@@ -5862,7 +5900,7 @@ to build the docs. The package is named <tt class="docutils literal"><span class
 and Fedora systems.</p>
 </div>
 <div class="section" id="scintilla-keyboard-commands">
-<h1><a class="toc-backref" href="#id223">Scintilla keyboard commands</a></h1>
+<h1><a class="toc-backref" href="#id224">Scintilla keyboard commands</a></h1>
 <p>Copyright �� 1998, 2006 Neil Hodgson &lt;neilh(at)scintilla(dot)org&gt;</p>
 <p>This appendix is distributed under the terms of the License for
 Scintilla and SciTE. A copy of this license can be found in the file
@@ -5871,7 +5909,7 @@ program and in the appendix of this document. See <a class="reference internal"
 Scintilla and SciTE</a>.</p>
 <p>20 June 2006</p>
 <div class="section" id="keyboard-commands">
-<h2><a class="toc-backref" href="#id224">Keyboard commands</a></h2>
+<h2><a class="toc-backref" href="#id225">Keyboard commands</a></h2>
 <p>Keyboard commands for Scintilla mostly follow common Windows and GTK+
 conventions. All move keys (arrows, page up/down, home and end)
 allows to extend or reduce the stream selection when holding the
@@ -5953,9 +5991,9 @@ menus. Some less common commands with no menu equivalent are:</p>
 </div>
 </div>
 <div class="section" id="tips-and-tricks">
-<h1><a class="toc-backref" href="#id225">Tips and tricks</a></h1>
+<h1><a class="toc-backref" href="#id226">Tips and tricks</a></h1>
 <div class="section" id="document-notebook">
-<h2><a class="toc-backref" href="#id226">Document notebook</a></h2>
+<h2><a class="toc-backref" href="#id227">Document notebook</a></h2>
 <ul class="simple">
 <li>Double-click on empty space in the notebook tab bar to open a
 new document.</li>
@@ -5968,7 +6006,7 @@ shortcut). The interface pref must be enabled for this to work.</li>
 </ul>
 </div>
 <div class="section" id="editor">
-<h2><a class="toc-backref" href="#id227">Editor</a></h2>
+<h2><a class="toc-backref" href="#id228">Editor</a></h2>
 <ul class="simple">
 <li>Alt-scroll wheel moves up/down a page.</li>
 <li>Ctrl-scroll wheel zooms in/out.</li>
@@ -5978,13 +6016,13 @@ shortcut). The interface pref must be enabled for this to work.</li>
 </ul>
 </div>
 <div class="section" id="interface">
-<h2><a class="toc-backref" href="#id228">Interface</a></h2>
+<h2><a class="toc-backref" href="#id229">Interface</a></h2>
 <ul class="simple">
 <li>Double-click on a symbol-list group to expand or compact it.</li>
 </ul>
 </div>
 <div class="section" id="gtk-related">
-<h2><a class="toc-backref" href="#id229">GTK-related</a></h2>
+<h2><a class="toc-backref" href="#id230">GTK-related</a></h2>
 <ul class="simple">
 <li>Scrolling the mouse wheel over a notebook tab bar will switch
 notebook pages.</li>
@@ -5999,7 +6037,7 @@ position without having to drag it.</li>
 </div>
 </div>
 <div class="section" id="compile-time-options">
-<h1><a class="toc-backref" href="#id230">Compile-time options</a></h1>
+<h1><a class="toc-backref" href="#id231">Compile-time options</a></h1>
 <p>There are some options which can only be changed at compile time,
 and some options which are used as the default for configurable
 options. To change these options, edit the appropriate source file
@@ -6011,7 +6049,7 @@ not be changed.</p>
 <p class="last">Most users should not need to change these options.</p>
 </div>
 <div class="section" id="src-geany-h">
-<h2><a class="toc-backref" href="#id231">src/geany.h</a></h2>
+<h2><a class="toc-backref" href="#id232">src/geany.h</a></h2>
 <table border="1" class="docutils">
 <colgroup>
 <col width="33%" />
@@ -6068,7 +6106,7 @@ when building on a non-Win32 system.</em></td>
 </table>
 </div>
 <div class="section" id="project-h">
-<h2><a class="toc-backref" href="#id232">project.h</a></h2>
+<h2><a class="toc-backref" href="#id233">project.h</a></h2>
 <table border="1" class="docutils">
 <colgroup>
 <col width="33%" />
@@ -6093,7 +6131,7 @@ open dialog.</td>
 </table>
 </div>
 <div class="section" id="editor-h">
-<h2><a class="toc-backref" href="#id233">editor.h</a></h2>
+<h2><a class="toc-backref" href="#id234">editor.h</a></h2>
 <table border="1" class="docutils">
 <colgroup>
 <col width="33%" />
@@ -6119,7 +6157,7 @@ underscore.</td>
 </table>
 </div>
 <div class="section" id="keyfile-c">
-<h2><a class="toc-backref" href="#id234">keyfile.c</a></h2>
+<h2><a class="toc-backref" href="#id235">keyfile.c</a></h2>
 <p>These are default settings that can be overridden in the <a class="reference internal" href="#preferences">Preferences</a> dialog.</p>
 <table border="1" class="docutils">
 <colgroup>
@@ -6200,7 +6238,7 @@ Geany provide.</td>
 </table>
 </div>
 <div class="section" id="build-c">
-<h2><a class="toc-backref" href="#id235">build.c</a></h2>
+<h2><a class="toc-backref" href="#id236">build.c</a></h2>
 <table border="1" class="docutils">
 <colgroup>
 <col width="33%" />
@@ -6245,7 +6283,7 @@ overriding the compile setting.</td>
 </div>
 </div>
 <div class="section" id="gnu-general-public-license">
-<h1><a class="toc-backref" href="#id236">GNU General Public License</a></h1>
+<h1><a class="toc-backref" href="#id237">GNU General Public License</a></h1>
 <pre class="literal-block">
             GNU GENERAL PUBLIC LICENSE
                Version 2, June 1991
@@ -6590,7 +6628,7 @@ Public License instead of this License.
 </pre>
 </div>
 <div class="section" id="license-for-scintilla-and-scite">
-<h1><a class="toc-backref" href="#id237">License for Scintilla and SciTE</a></h1>
+<h1><a class="toc-backref" href="#id238">License for Scintilla and SciTE</a></h1>
 <p>Copyright 1998-2003 by Neil Hodgson &lt;neilh(at)scintilla(dot)org&gt;</p>
 <p>All Rights Reserved</p>
 <p>Permission to use, copy, modify, and distribute this software and
@@ -6610,7 +6648,7 @@ USE OR PERFORMANCE OF THIS SOFTWARE.</p>
 <div class="footer">
 <hr class="footer" />
 <a class="reference external" href="geany.txt">View document source</a>.
-Generated on: 2011-07-28 17:42 UTC.
+Generated on: 2011-08-13 17:00 UTC.
 Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
 
 </div>
diff --git a/doc/geany.txt b/doc/geany.txt
index cf73ab9..e5be465 100644
--- a/doc/geany.txt
+++ b/doc/geany.txt
@@ -4050,6 +4050,30 @@ xml_indent_tags
     this setting in their system configuration files.
 
 
+[indentation] section
+`````````````````````
+
+This section allows to define indentation settings specific to the file type,
+overriding the ones configured in the preferences.  This can be useful for
+file types requiring specific indentation settings (e.g. tabs only for
+Makefile).  Please note that these settings also overrides the automatic
+detection.
+
+width
+    The forced indentation width.
+
+type
+    The forced indentation type.
+
+    =====   =======================
+    Value   Indentation type
+    =====   =======================
+    0       Spaces only
+    1       Tabs only
+    2       Mixed (tabs and spaces)
+    =====   =======================
+
+
 [build_settings] section
 ````````````````````````
 
diff --git a/src/document.c b/src/document.c
index ea6cb6f..9484cc3 100644
--- a/src/document.c
+++ b/src/document.c
@@ -1042,30 +1042,13 @@ static gint detect_indent_width(GeanyEditor *editor, GeanyIndentType type)
 }
 
 
-/* returns the forced indent type or -1 if none is forced */
-static gint get_forced_indent_type(GeanyDocument *doc)
-{
-	switch (doc->file_type->id)
-	{
-		case GEANY_FILETYPES_MAKE:
-			/* force using tabs for indentation for Makefiles */
-			return GEANY_INDENT_TYPE_TABS;
-		case GEANY_FILETYPES_F77:
-			/* force using spaces for indentation for Fortran 77 */
-			return GEANY_INDENT_TYPE_SPACES;
-		default:
-			return -1;
-	}
-}
-
-
 void document_apply_indent_settings(GeanyDocument *doc)
 {
 	const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(NULL);
 	gint type;
-	gint width = iprefs->width;
+	gint width;
 
-	type = get_forced_indent_type(doc);
+	type = doc->file_type->indent_type;
 	if (type < 0 && ! iprefs->detect_type)
 		type = iprefs->type;
 	else if (type < 0)
@@ -1094,7 +1077,10 @@ void document_apply_indent_settings(GeanyDocument *doc)
 				DOC_FILENAME(doc));
 		}
 	}
-	if (iprefs->detect_width)
+	width = doc->file_type->indent_width;
+	if (width < 0 && ! iprefs->detect_width)
+		width = iprefs->width;
+	else if (width < 0)
 	{
 		width = detect_indent_width(doc->editor, type);
 
@@ -2499,13 +2485,28 @@ void document_set_filetype(GeanyDocument *doc, GeanyFiletype *type)
 
 	if (ft_changed)
 	{
-		gint forced_indent_type = get_forced_indent_type(doc);
+		GeanyIndentType indent_type = doc->editor->indent_type;
+		gint indent_width = doc->editor->indent_width;
+		const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(NULL);
+
+		if (type->indent_type > -1)
+			indent_type = type->indent_type;
+		/* reset to default when switching from a filetype-defined one */
+		else if (old_ft && old_ft->indent_type > -1)
+			indent_type = iprefs->type;
 
-		if (forced_indent_type >= 0)
-		{	/* update forced indents, like Makefiles and F77 */
-			editor_set_indent_type(doc->editor, forced_indent_type);
+		if (type->indent_width > -1)
+			indent_width = type->indent_width;
+		/* reset to default when switching from a filetype-defined one */
+		else if (old_ft && old_ft->indent_width > -1)
+			indent_width = iprefs->width;
+
+		if (indent_type != doc->editor->indent_type || indent_width != doc->editor->indent_width)
+		{
+			editor_set_indent(doc->editor, indent_type, indent_width);
 			ui_document_show_hide(doc);
 		}
+
 		sidebar_openfiles_update(doc); /* to update the icon */
 		g_signal_emit_by_name(geany_object, "document-filetype-set", doc, old_ft);
 	}
diff --git a/src/filetypes.c b/src/filetypes.c
index 243c0d9..7ebd823 100644
--- a/src/filetypes.c
+++ b/src/filetypes.c
@@ -498,6 +498,8 @@ static GeanyFiletype *filetype_new(void)
 	/* pattern must not be null */
 	ft->pattern = g_new0(gchar*, 1);
 	ft->project_list_entry = -1; /* no entry */
+	ft->indent_width = -1;
+	ft->indent_type = -1;
 
 	ft->priv = g_new0(GeanyFiletypePrivate, 1);
 	return ft;
@@ -1118,6 +1120,27 @@ void filetypes_free_types(void)
 }
 
 
+static void load_indent_settings(GeanyFiletype *ft, GKeyFile *config, GKeyFile *configh)
+{
+	ft->indent_width = utils_get_setting(integer, configh, config, "indentation", "width", -1);
+	ft->indent_type = utils_get_setting(integer, configh, config, "indentation", "type", -1);
+	/* check whether the indent type is OK */
+	switch (ft->indent_type)
+	{
+		case GEANY_INDENT_TYPE_TABS:
+		case GEANY_INDENT_TYPE_SPACES:
+		case GEANY_INDENT_TYPE_BOTH:
+		case -1:
+			break;
+
+		default:
+			g_warning("Invalid indent type %d in file type %s", ft->indent_type, ft->name);
+			ft->indent_type = -1;
+			break;
+	}
+}
+
+
 static void load_settings(gint ft_id, GKeyFile *config, GKeyFile *configh)
 {
 	GeanyFiletype *ft = filetypes[ft_id];
@@ -1188,6 +1211,9 @@ static void load_settings(gint ft_id, GKeyFile *config, GKeyFile *configh)
 	ft->priv->xml_indent_tags = utils_get_setting(boolean, configh, config, "settings",
 		"xml_indent_tags", FALSE);
 
+	/* read indent settings */
+	load_indent_settings(ft, config, configh);
+
 	/* read build settings */
 	build_load_menu(config, GEANY_BCS_FT, (gpointer)ft);
 	build_load_menu(configh, GEANY_BCS_HOME_FT, (gpointer)ft);
diff --git a/src/filetypes.h b/src/filetypes.h
index 63712bb..fb3f593 100644
--- a/src/filetypes.h
+++ b/src/filetypes.h
@@ -136,6 +136,9 @@ struct GeanyFiletype
 	gchar			 *mime_type;
 	GdkPixbuf		 *icon;
 	gchar			 *comment_single; /* single-line comment */
+	/* filetype indent settings */
+	gint			  indent_type;
+	gint			  indent_width;
 
 	struct GeanyFiletypePrivate	*priv;	/* must be last, append fields before this item */
 #ifdef GEANY_PRIVATE
-- 
1.7.5.4

