From 00851ad4f2a540135bd5437046ef624c0a9feb99 Mon Sep 17 00:00:00 2001 From: Chris Mann Date: Wed, 25 Feb 2009 22:05:57 +1030 Subject: [PATCH] * wesnoth-mode.el: Fix over-long lines. (wesnoth-forward-list, wesnoth-backward-list): Updated docstrings. --- wesnoth-mode.el | 69 +++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/wesnoth-mode.el b/wesnoth-mode.el index da0f0e7..e2856f3 100644 --- a/wesnoth-mode.el +++ b/wesnoth-mode.el @@ -40,11 +40,11 @@ ;; child element, respectively. ;; * Fixed a bug where the parent tag would be unknown if point was positioned ;; between a macro and the position of the parent element. -;; * Fixed a bug where incorrect closing tag could be inserted in some -;; circumstances. +;; * Fixed a bug where an incorrectly formatted closing tag could be inserted +;; in some circumstances. ;; 1.3.4a -;; * #ifdef, #ifndef preprocessor statements now indent their contents relative -;; to themselves when `wesnoth-indent-preprocessor-bol' is nil. +;; * #ifdef, #ifndef preprocessor statements now indent their contents +;; relative to themselves when `wesnoth-indent-preprocessor-bol' is nil. ;; * Fixed a bug which could prevent element completion immediately within a ;; preprocessor statement. ;; 1.3.4 @@ -151,8 +151,8 @@ ;; `wesnoth-jump-backward', `wesnoth-jump-forward' to ;; `wesnoth-indent-withtags-inline', `wesnoth-indent-default-inline' and ;; `wesnoth-backward-tag', `wesnoth-forward-tag', respectively. -;; * Fixed a bug in indentation where content was needed between elements pairs -;; for indentation to work. +;; * Fixed a bug in indentation where content was needed between elements +;; pairs for indentation to work. ;; * Fixed `wesnoth-newline-and-indent' ignoring the state of ;; `wesnoth-auto-indent-flag'. ;; * Fixed `{...}' and `#endif' not font-locking correctly. @@ -217,7 +217,8 @@ level as their parent.") :group 'wesnoth-mode) (defconst wesnoth-preprocessor-regexp - "[\t ]*#\\(enddef\\|define \\|e\\(lse\\|nd\\(\\(de\\|i\\)f\\)\\)\\|\\(ifn?\\|un\\)def \\)" + "[\t ]*#\\(enddef\\|define \\|e\\(lse\\|nd\\(\\(de\\|i\\)f\\)\\)\ +\\|\\(ifn?\\|un\\)def \\)" "Regular expression to match all preprocessor statements.") (defconst wesnoth-preprocessor-opening-regexp @@ -303,7 +304,8 @@ level as their parent.") ;; pre-processor statements. (defvar wesnoth-syntactic-keywords (list - '("\\([\t ]*\\(#\\(?:define \\|e\\(?:lse\\|nd\\(?:\\(?:de\\|i\\)f\\)\\)\\|\\(?:ifn?\\|un\\)def \\)\\)\\)" 1 "w")) + '("\\([\t ]*\\(#\\(?:define \\|e\\(?:lse\\|nd\\(?:\\(?:de\\|i\\)f\\)\\)\\|\ +\\(?:ifn?\\|un\\)def \\)\\)\\)" 1 "w")) "Syntactic keywords for preprocessor statements within `wesnoth-mode'.") (defvar wesnoth-font-lock-keywords @@ -409,7 +411,8 @@ of the element." ("\\[\\+?[^/]+?\\]" . tag-opening) ("\\[/.+?\\]" . tag-closing) ("\\(\\w\\|_\\)+[\t ]*=" . attribute) - ("#\\(enddef\\|define \\|e\\(lse\\|nd\\(\\(de\\|i\\)f\\)\\)\\|\\(ifn?\\|un\\)def \\)" + ("#\\(enddef\\|define \\|e\\(lse\\|nd\\(\\(de\\|i\\)f\\)\\)\\|\ +\\(ifn?\\|un\\)def \\)" . preprocessor) ("#.*$" . comment) ("[^\t ]+") . nil))) @@ -431,7 +434,8 @@ of the element." ("\\[/\\(\\w\\|_\\)*$" . tag-closing) ("\\[\\+?\\(\\w\\|_\\)*$" . tag-opening) ("^[\t ]*\\(\\w\\|_\\)+$" . attribute) - ("[\t ]*#\\(enddef\\|define \\|e\\(lse\\|nd\\(\\(de\\|i\\)f\\)\\)\\|\\(ifn?\\|un\\)def \\)" + ("[\t ]*#\\(enddef\\|define \\|e\\(lse\\|nd\ +\\(\\(de\\|i\\)f\\)\\)\\|\\(ifn?\\|un\\)def \\)" . nil) ; not a partial match ("[\t ]*#\\w*$" . preprocessor)))) (catch 'result @@ -524,7 +528,8 @@ Otherwise, return a string containing the name of the parent tag." (string= (match-string 0) "{") (goto-char start-point) (not (and (search-backward parent (point-min) t) - (search-backward-regexp "[}{]" (point-min) t) + (search-backward-regexp "[}{]" (point-min) + t) (string= (match-string 0) "{"))))) (cons t position) (cons (substring parent 1 (1- (length parent))) position)))))))) @@ -602,7 +607,8 @@ If COMPLETEP is non-nil, attempt to complete preprocessor at point." (when preprocessor (unless (string= "#" (substring preprocessor 0 1)) (setq preprocessor (concat "#" preprocessor))) - (when (string-match "#\\(define\\|ifn?def\\|undef\\)" preprocessor) + (when (string-match "#\\(define\\|ifn?def\\|undef\\)" + preprocessor) (setq preprocessor (concat preprocessor " "))) (when partial (delete-region (nth 1 details) (nth 2 details))) @@ -824,7 +830,8 @@ TAGNAME is the name of the tag to be inserted." (if (string= tagname "#define ") "#enddef" "#endif")) - (wesnoth-insert-element-separately "[/" (if (string-match "^+" tagname) + (wesnoth-insert-element-separately "[/" (if (string-match "^+" + tagname) (substring tagname 1) tagname) "]")) @@ -873,7 +880,7 @@ for the matching tag." (when match (if (string= (substring match 0 1) "[") (wesnoth-insert-element-separately - "[/" + "[/" (let ((tagname (substring match 1 (1- (length match))))) (if (string-match "^+" tagname) (substring tagname 1) @@ -971,7 +978,8 @@ BOUND is the bound to be passed to the search function. If SKIP is non-nil, skip the first element and continue from there." (let ((depth 1)) (when (and (or (and (numberp skip) (forward-line skip)) - (funcall search-function (wesnoth-element) (funcall bound) t)) + (funcall search-function (wesnoth-element) + (funcall bound) t)) (or skip (not (string-match search-string (match-string 0))))) (while (and (> depth 0) (funcall search-function (wesnoth-element) @@ -1083,7 +1091,8 @@ CONTEXT represents the type of element which precedes the current element." (setq cur-indent ref-indent) (if (or (and wesnoth-indent-savefile (or (looking-at "[\t ]*{NEXT ") - (and (not (looking-at (wesnoth-element-closing t))) + (and (not + (looking-at (wesnoth-element-closing t))) (not (looking-at "[\t ]*{NEXT "))))) (looking-at (wesnoth-element-opening t)) (looking-at "[\t ]*{FOREACH ")) @@ -1093,11 +1102,12 @@ CONTEXT represents the type of element which precedes the current element." (if (and (looking-at "^[\t ]*#else") (not wesnoth-indent-preprocessor-bol)) (setq cur-indent (- ref-indent wesnoth-base-indent)) - (if (or (looking-at (concat "^[\t ]*\\(\\[/\\|\\#enddef" - (if (not wesnoth-indent-preprocessor-bol) - "\\|#endif" - "") - "\\)")) + (if (or (looking-at + (concat "^[\t ]*\\(\\[/\\|\\#enddef" + (if (not wesnoth-indent-preprocessor-bol) + "\\|#endif" + "") + "\\)")) (and (not wesnoth-indent-savefile) (not (looking-at (wesnoth-element-opening t))) (not (looking-at "[\t ]*{FOREACH ")))) @@ -1117,7 +1127,8 @@ POSITION is the initial cursor position." (wesnoth-find-macro-definitions)))) (unless (equal (car defblocks) 'none) (dolist (element defblocks) - (when (= (cadr (sort (append (mapcar 'marker-position (cadr element)) + (when (= (cadr (sort (append (mapcar 'marker-position + (cadr element)) (list position)) '>)) position) (setq depth (max (car element) depth))))) depth))) @@ -1176,8 +1187,9 @@ determine the context." (and (search-backward-regexp elements (point-min) t) (progn - (while (save-match-data - (looking-at "^[\t ]*\\[[^/].+\\]\\[/.+\\]")) + (while + (save-match-data + (looking-at "^[\t ]*\\[[^/].+\\]\\[/.+\\]")) (search-backward-regexp elements (point-min) t)) t) @@ -1410,7 +1422,8 @@ If ARG is not specified, move backward up one level." (back-to-indentation)) (defun wesnoth-forward-list (&optional arg) - "Move to the end of the next child element." + "Move to forward ARG elements at the current depth. +If ARG is not specifed, move forward one element." (interactive "p") (unless arg (setq arg 1)) @@ -1436,7 +1449,8 @@ If ARG is not specified, move backward up one level." (end-of-line)) (defun wesnoth-backward-list (&optional arg) - "Move to the beginning of the previous child element." + "Move to backward ARG elements at the current depth. +If ARG is not specifed, move backward one element." (interactive "p") (unless arg (setq arg 1)) @@ -1508,7 +1522,8 @@ If ARG is not specified, move backward up one level." (save-match-data (when (looking-at - "{\\(FOREACH\\|NEXT\\).*[\t ]+\\(\\(?:\\w\\|_\\)+\\)}") + "{\\(FOREACH\\|NEXT\\).*[\t ]+\ +\\(\\(?:\\w\\|_\\)+\\)}") (if (string= (match-string-no-properties 1) "FOREACH") (setq foreach (cons (match-string-no-properties 2) foreach)) -- 2.11.4.GIT