From 1bece9466f18b7864c85b519b7ede067e52d2058 Mon Sep 17 00:00:00 2001 From: Chris Mann Date: Mon, 6 Oct 2008 22:13:27 +1030 Subject: [PATCH] * wesnoth-update.el: (require 'cl) (wesnoth-root-directory): Added type and group information. (wesnoth-determine-details): Fixed an error due to missing parens. Fixed an error due to referencing unbound variable. (wesnoth-handle-file): Use insert-file-contents. (wesnoth-extract-tag-information, wesnoth-determine-macro-information): No longer use wesnoth-wml-start-pos. Use point-min instead. --- wesnoth-update.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/wesnoth-update.el b/wesnoth-update.el index ca6d9b9..9903545 100644 --- a/wesnoth-update.el +++ b/wesnoth-update.el @@ -45,11 +45,13 @@ ;; (wesnoth-update-teach-wesnoth-mode "/path/to/structured/wml.cfg"))) ;;; Code: -(require 'wesnoth-mode) +(require 'cl) (defcustom wesnoth-root-directory nil "Path to the root directory of wesnoth. -Path must end in trailing slash.") +Path must end in trailing slash." + :type 'directory + :group 'wesnoth-mode) (defvar wesnoth-macro-directory (concat wesnoth-root-directory "data/core/macros")) (defvar wesnoth-found-cfgs '()) (defvar wesnoth-tag-data '()) @@ -83,9 +85,9 @@ DIR is the directory to check." (defun wesnoth-determine-details (dir-or-file function) "Process .cfg files in DIR-OR-FILE using FUNCTION." (if (and (file-exists-p dir-or-file) - (not file-directory-p dir-or-file)) + (not (file-directory-p dir-or-file))) (wesnoth-handle-file function dir-or-file) - (wesnoth-fetch-all-dirs directory) + (wesnoth-fetch-all-dirs dir-or-file) (while wesnoth-found-cfgs (unless (string-match "^\\..+" (file-name-nondirectory (car wesnoth-found-cfgs))) @@ -95,13 +97,13 @@ DIR is the directory to check." (defun wesnoth-handle-file (function file) "Perform FUNCTION on FILE." (with-temp-buffer - (insert-file file) + (insert-file-contents file) (funcall function))) (defun wesnoth-extract-tag-information () "Retrieve relevant tag and attribute information." (let ((unmatched-tag-list '())) - (goto-char (or (wesnoth-wml-start-pos) (point-min))) + (goto-char (point-min)) (while (search-forward-regexp "^[\t ]*\\(\\[[+/]?\\(\\(\\w\\|_\\)+\\)\\]\\|\\(\\w\\|_\\)+=\\)" (point-max) t) @@ -145,7 +147,7 @@ SUBTAG and ATTRIBUTE are a children of TAG to be added." "Process the buffer, retrieving macro definition information. MACRO-LIST is the variable to append macro information." `(progn - (goto-char (or (wesnoth-wml-start-pos) (point-min))) + (goto-char (point-min)) (while (search-forward-regexp "#define \\(\\(\\w\\|_\\)+\\)\\([\t ]+\\(\\w\\|_\\)+\\)?" (point-max) t) -- 2.11.4.GIT