From dd0205a7ad3e96587471482cd8f46a6d7efb472d Mon Sep 17 00:00:00 2001 From: Chris Mann Date: Sun, 12 Oct 2008 14:43:17 +1030 Subject: [PATCH] * wesnoth-mode.el: Updated mode description. (wesnoth-history-list): New variable. (wesnoth-element-completion, wesnoth-insert-tag): Use it to provide contained completion history. --- wesnoth-mode.el | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/wesnoth-mode.el b/wesnoth-mode.el index 774d9b2..8cd0e9e 100644 --- a/wesnoth-mode.el +++ b/wesnoth-mode.el @@ -20,9 +20,9 @@ ;;; Description: ;; wesnoth-mode is a major mode for Emacs which assists in the editing -;; of Wesnoth Markup Language (WML) files. Currently, this mode +;; of Wesnoth Markup Language (WML) files. Currently, this major-mode ;; features syntax highlighting support, automatic indentation, -;; tag-completion and preliminary support for syntax checking. +;; context-sensitive completion and support for WML checking. ;;; Commentary: ;; Add the following to your .emacs: @@ -170,6 +170,9 @@ level as their parent.") (defvar wesnoth-define-blocks '() "Cache of all toplevel #define and #enddef pairs.") +(defvar wesnoth-history-list '() + "History of inserted WML elements.") + (defvar wesnoth-mode-hook nil) (defvar wesnoth-mode-map @@ -255,13 +258,15 @@ PARTIAL is the partial string on which to attempt completion." (setq element nil)) ((null element) (setq element - (completing-read ,prompt ,completions))) + (completing-read ,prompt ,completions nil nil nil + wesnoth-history-list))) ((not (if (listp (car ,completions)) (assoc element ,completions) (member element ,completions))) (setq element (completing-read ,prompt ,completions - nil nil ,partial)))) + nil nil ,partial + wesnoth-history-list)))) element)) (defun wesnoth-parent-tag () @@ -423,7 +428,8 @@ tag should wrap around. TAGNAME is the name of the tag to be inserted." (interactive "Ps") (unless tagname - (setq tagname (completing-read "Tag: " (wesnoth-build-completion 1)))) + (setq tagname (completing-read "Tag: " (wesnoth-build-completion 1) + nil nil nil wesnoth-history-list))) (when (or (not elements) (looking-at (concat "[\t ]*\\(:?\\[/\\|" wesnoth-preprocessor-regexp "\\)"))) -- 2.11.4.GIT