A modern Emacs major mode for editing TinTin++ configuration files.
TinTin++ is a terminal-based MUD client that uses scripting files with .tin
and .tt
extensions. This mode provides comprehensive syntax highlighting, indentation, and editing support for TinTin++ scripts.
- Syntax highlighting for TinTin++ commands, variables, functions, strings, and comments
- Theme-aware - inherits colors from your Emacs theme instead of hardcoded colors
- Command completion - tab completion for TinTin++ commands (type
#ac
+TAB
?#action
) - Smart indentation - automatic indentation with customizable offset
- Code navigation - Imenu integration for jumping to functions and variables
- Code folding - outline mode support for collapsing sections
- Function context - which-function-mode shows current function in mode line
- Electric pairs - automatic brace and parenthesis pairing
- Robust font-lock - handles complex variable syntax like
*GMCP_PACKAGES[%*]
The recommended way to install tintin-mode
is through MELPA:
M-x package-install RET tintin-mode RET
- Download
tintin-mode.el
- Place it in your
load-path
- Add to your Emacs configuration:
(require 'tintin-mode)
tintin-mode
automatically activates for files with .tin
and .tt
extensions.
#nop This is a comment
#variable {hp} {100}
#variable {max_hp} {150}
#action {%0 tells you '%1'} {
#if {"%1" == "hello"} {
tell %0 Hello there!
}
}
#function {heal} {
#if {$hp < 50} {
cast heal;
#showme {Healing - HP: $hp/$max_hp}
}
}
#foreach {*GMCP_PACKAGES[%*]} {package} {
#if {$GMCP_PACKAGES[$package]} {
#showme {Package $package is enabled}
}
}
Key | Function |
---|---|
C-c C-c | Comment region |
C-c C-u | Uncomment region |
C-c C-f | Jump to function/variable |
C-c C-o | Toggle code folding |
C-j | Newline and indent |
Customize the indentation offset:
(setq tintin-indent-offset 4) ; Default is 2
All faces inherit from standard font-lock faces and automatically adapt to your theme. You can customize individual faces:
;; Customize variable highlighting
(set-face-attribute 'tintin-var-face nil :foreground "yellow" :weight 'bold)
Available faces:
tintin-var-face
- Variables (%var
,$var
,*var
)tintin-var-def-face
- Variable definitions (#variable
)tintin-function-face
- Function calls (@function
)tintin-function-def-face
- Function definitions (#function
)tintin-conditional-face
- Conditionals and loops (#if
,#loop
, etc.)tintin-comment-face
- Comments (#nop
)tintin-hash-face
- TinTin++ commands (#action
,#alias
, etc.)tintin-ansi-face
- ANSI color codes (<123>
)tintin-symbol-face
- Brackets and operators
(add-hook 'tintin-mode-hook
(lambda ()
;; Enable line numbers
(display-line-numbers-mode 1)
;; Enable which-function-mode
(which-function-mode 1)))
- Commands - All major TinTin++ commands with completion
- Variables -
%var
,$var
,*var
with array syntax[index]
- Functions - User-defined functions with
@function{args}
calls - Conditionals -
#if
,#else
,#elseif
,#loop
,#while
,#foreach
- Comments -
#nop
,#no
comments - Strings - Double and single quoted strings
- ANSI Colors -
<color_code>
highlighting
This mode replaces the outdated tintin-mode
linked from the TinTin++ website. Key improvements:
- Modern Emacs integration - uses
define-derived-mode
and inherits fromprog-mode
- Theme compatibility - respects your color scheme instead of hardcoded colors
- Robust font-lock - doesn’t break on complex syntax or when scrolling
- Enhanced features - completion, navigation, folding, and indentation
- Better regex patterns - handles complex variable syntax and nested structures
- Active maintenance - built with modern Emacs best practices
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
Report bugs or request features through the issue tracker.
GPL-3.0 or later. See LICENSE file for details.