From e917098fef91910d714a607d5a17c8ed5e98d1cc Mon Sep 17 00:00:00 2001 From: Chris Mann Date: Sun, 5 Oct 2008 09:39:36 +1030 Subject: [PATCH] * wesnoth-mode.el (wesnoth-indent-default-style): Renamed to `wesnoth-indent-savefile'. Alias with that name removed, as defvaralias not supported in GNU Emacs 21. (wesnoth-preprocessor-best-face): Fix an error when global-font-lock-mode is disabled. (wesnoth-indent): Don't use `multiple-value-bind' as it's not supported in GNU Emacs 21. Revert to using wesnoth-indent-savefile. (wesnoth-determine-context): Don't use `values', as it's not supported in GNU Emacs 21. --- wesnoth-mode.el | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/wesnoth-mode.el b/wesnoth-mode.el index 6e19fdb..b29232f 100644 --- a/wesnoth-mode.el +++ b/wesnoth-mode.el @@ -115,15 +115,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,7 +197,7 @@ level as their parent.") (defun wesnoth-preprocessor-best-face () "Use `font-lock-preprocessor-face' when available." - (if (boundp 'font-lock-preprocessor-face) + (if (and global-font-lock-mode (boundp 'font-lock-preprocessor-face)) (copy-face 'font-lock-preprocessor-face 'wesnoth-preprocessor-face) (copy-face 'font-lock-keyword-face 'wesnoth-preprocessor-face))) @@ -472,18 +470,19 @@ CONTEXT represents the type of element which precedes the current element." (beginning-of-line) (let ((cur-indent 0)) (unless (first-column-indent-p (point)) - (multiple-value-bind (context ref-indent) - (wesnoth-determine-context (point)) + (let* ((ref-con (wesnoth-determine-context (point))) + (context (car ref-con)) + (ref-indent (cadr ref-con))) (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)))))) @@ -559,9 +558,9 @@ determine the context." (setq match "")) (cond ((string-match "\\[/\\|#enddef" match) - (values 'closing (current-indentation))) + (list 'closing (current-indentation))) ((string-match "\\[[^/]?\\|#define" match) - (values 'opening (current-indentation))))))) + (list 'opening (current-indentation))))))) (defun wesnoth-newline-and-indent (&optional indent) "Indent both the current line and the newline created. -- 2.11.4.GIT