From 165646699793b885b5d34f0bf3de1d91f537997e Mon Sep 17 00:00:00 2001 From: Chris Mann Date: Sat, 4 Oct 2008 12:06:04 +0930 Subject: [PATCH] * wesnoth-mode.el (wesnoth-indent-default-style): New variable. Reimplementation of old wesnoth-indent-savefile. (wesnoth-indent-savefile): Alias for wesnoth-indent-default-style. (wesnoth-mode-map): Minor clean up; bound M-TAB to `wesnoth-insert-tag'. (wesnoth-indent): Re-implemented support for the old indentation convention. --- wesnoth-mode.el | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/wesnoth-mode.el b/wesnoth-mode.el index b2358ea..170587a 100644 --- a/wesnoth-mode.el +++ b/wesnoth-mode.el @@ -32,11 +32,11 @@ ;;; History: ;; 1.2.5 +;; * Added M-TAB binding for `wesnoth-insert-tag'. ;; * Revised `wesnoth-tags-list' to remove obsoleted tags. ;; * `wesnoth-insert-tag' now takes an optional numeric argument indicating ;; how many blocks to wrap across instead of a region. -;; * Indentation customisation removed; all indentation is performed to -;; current conventions. +;; * Support for `wesnoth-indent-preprocessor-bol' removed. ;; * Fixed a bug in `wesnoth-insert-tag' and `wesnoth-insert-missing-closing' ;; causing tags not to be inserted in the correct position. ;; * Fixed highlighting of array indexes as tags. @@ -114,6 +114,15 @@ :type 'boolean :group 'wesnoth-mode) +(defcustom wesnoth-indent-default-style 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 @@ -138,20 +147,21 @@ (defvar wesnoth-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\C-\M-a" 'wesnoth-backward-element) - (define-key map "\C-\M-e" 'wesnoth-forward-element) - (define-key map "\C-c\C-m" 'wesnoth-jump-to-matching) - (define-key map "\C-cm" 'wesnoth-jump-to-matching) - (define-key map "\C-m" 'wesnoth-newline) - (define-key map "\C-j" 'wesnoth-newline-and-indent) - (define-key map "\C-c\C-c" 'wesnoth-check-structure) - (define-key map "\C-cc" 'wesnoth-check-structure) - (define-key map "\C-c\C-n" 'wesnoth-check-tag-names) - (define-key map "\C-cn" 'wesnoth-check-tag-names) - (define-key map "\C-c\C-e" 'wesnoth-insert-tag) - (define-key map "\C-ce" 'wesnoth-insert-tag) - (define-key map (kbd "C-c C-/") 'wesnoth-insert-missing-closing) + (define-key map (kbd "C-M-a") 'wesnoth-backward-element) + (define-key map (kbd "C-M-e") 'wesnoth-forward-element) + (define-key map (kbd "C-m") 'wesnoth-newline) + (define-key map (kbd "C-j") 'wesnoth-newline-and-indent) + (define-key map (kbd "C-c c") 'wesnoth-check-structure) + (define-key map (kbd "C-c C-c") 'wesnoth-check-structure) + (define-key map (kbd "C-c e") 'wesnoth-insert-tag) + (define-key map (kbd "C-c C-e") 'wesnoth-insert-tag) + (define-key map (kbd "M-TAB") 'wesnoth-insert-tag) + (define-key map (kbd "C-c m") 'wesnoth-jump-to-matching) + (define-key map (kbd "C-c C-m") 'wesnoth-jump-to-matching) + (define-key map (kbd "C-c n") 'wesnoth-check-tag-names) + (define-key map (kbd "C-c C-n") 'wesnoth-check-tag-names) (define-key map (kbd "C-c /") 'wesnoth-insert-missing-closing) + (define-key map (kbd "C-c C-/") 'wesnoth-insert-missing-closing) ;; Menu (define-key map [menu-bar wesnoth] (cons "WML" (make-sparse-keymap "WML"))) @@ -461,9 +471,9 @@ CONTEXT represents the type of element which precedes the current element." (wesnoth-determine-context (point)) (cond ((eq context 'opening) - (if (or (looking-at "^[\t ]*\\[[^/]") - (looking-at wesnoth-element-opening) - (not (looking-at wesnoth-element-closing))) + (if (or (and wesnoth-indent-default-style + (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) -- 2.11.4.GIT