From cd7fc55c38f24438c66ffe08d61413e00fee6477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Thu, 9 Oct 2008 21:50:19 +0000 Subject: [PATCH] new version of the emacs wesnoth mode --- data/tools/wesnoth-mode.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/data/tools/wesnoth-mode.el b/data/tools/wesnoth-mode.el index 6e19fdbc8b3..1aa43c63fe3 100644 --- a/data/tools/wesnoth-mode.el +++ b/data/tools/wesnoth-mode.el @@ -103,7 +103,9 @@ ;; * Added support for #ifndef. ;;; Code: -(defconst wesnoth-mode-version "1.2.5" +(require 'cl) + +(defconst wesnoth-mode-version "1.2.5a" "The current version of `wesnoth-mode'.") (defgroup wesnoth-mode nil "Wesnoth-mode access" @@ -115,15 +117,13 @@ :type 'boolean :group 'wesnoth-mode) -(defcustom wesnoth-indent-default-style t +(defcustom wesnoth-indent-savefile t "Non-nil means to use the current indentation conventions. If nil, use the old convention for indentation. The current convention is all attributes are indented a level deeper than their parent; in the past attributes were indented to the same level as their parent.") -(defvaralias 'wesnoth-indent-savefile 'wesnoth-indent-default-style) - (defcustom wesnoth-base-indent 4 "The number of columns to indent WML." :type 'integer @@ -199,9 +199,10 @@ level as their parent.") (defun wesnoth-preprocessor-best-face () "Use `font-lock-preprocessor-face' when available." - (if (boundp 'font-lock-preprocessor-face) - (copy-face 'font-lock-preprocessor-face 'wesnoth-preprocessor-face) - (copy-face 'font-lock-keyword-face 'wesnoth-preprocessor-face))) + (when global-font-lock-mode + (if (boundp 'font-lock-preprocessor-face) + (copy-face 'font-lock-preprocessor-face 'wesnoth-preprocessor-face) + (copy-face 'font-lock-keyword-face 'wesnoth-preprocessor-face)))) (defvar wesnoth-font-lock-keywords (list @@ -476,14 +477,14 @@ CONTEXT represents the type of element which precedes the current element." (wesnoth-determine-context (point)) (cond ((eq context 'opening) - (if (or (and wesnoth-indent-default-style + (if (or (and wesnoth-indent-savefile (not (looking-at wesnoth-element-closing))) (looking-at wesnoth-element-opening)) (setq cur-indent (+ ref-indent wesnoth-base-indent)) (setq cur-indent ref-indent))) ((eq context 'closing) (if (or (looking-at "^[\t ]*\\[/") - (and (not wesnoth-indent-default-style) + (and (not wesnoth-indent-savefile) (not (looking-at wesnoth-element-opening)))) (setq cur-indent (- ref-indent wesnoth-base-indent)) (setq cur-indent ref-indent))))))