Emacs WML-mode

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.

Emacs WML-mode

Postby WildPenguin » November 15th, 2006, 10:04 am

Hello,

Wesnoth-mode an Emacs major-mode which adds syntax highlighting, automatic indentation, context-sensitive completion and much more when editing WML.

To use it add:
Code: Select all
(add-to-list 'load-path "path/to/file")
(autoload 'wesnoth-mode "wesnoth-mode" "Major mode for editing WML." t)
to your .emacs.

Optionally, you can add:
Code: Select all
(add-to-list 'auto-mode-alist '("\\.cfg\\'" . wesnoth-mode))
to automatically use wesnoth-mode when opening a .cfg file.

Feedback and questions are of course welcome.
Attachments
wesnoth-mode-1.3.5.tar.gz
Wesnoth Mode 1.3.5
(36.88 KiB) Downloaded 432 times
Last edited by WildPenguin on February 27th, 2009, 8:58 am, edited 66 times in total.
WildPenguin
 
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Postby WildPenguin » January 17th, 2007, 10:03 am

First beta release of wesnoth-mode-1.0 is now available.

There are many improvements over previous versions and it should therefore be more functional and contain far fewer annoyances.

The major change in this release is dropping the mirroring functionality which was available in 0.3.1. If you would still like such support in wesnoth-mode have a look at pair-mode.

Other changes include improvements on syntax highlighting and WML indentation.

The above post contains additional information regarding wesnoth-mode and the download link.

Please report any bugs or feature requests here to help make this mode even better!

Enjoy!
WildPenguin
 
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Postby WildPenguin » March 26th, 2007, 6:16 am

Wesnoth-mode-1.0 has been released.

It features further improvements to syntax-highlighting and indentation and adds some new features.

The new tag-insertion function (bound to C-c C-e, by default) inserts both the opening tag given and its matching closing tag and positions the point on a line between them. Hopefully this will be made even more useful in later versions with tag completion support.

Support for comment-region has been added. Once selected, a region can be commented-out quickly using C-c C-c.

Wesnoth-mode now initiates font-lock-mode as a small section of the indentation functionality depends on it. For most users, this change should be inconsequential.

Instructions for the installation as well as the link to download wesnoth-mode can be found in the original post.

As usual, post suggestions, questions and comments here and let me know if I've broken anything. :wink:

Have fun. :)
WildPenguin
 
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Postby WildPenguin » April 27th, 2007, 10:17 am

Wesnoth-mode-1.0.1 is now available.

As promised, tag-completion has been added to wesnoth-mode. Via C-c C-e you're now able to expand a partially completed tag or view all possible completions. :D

This release also fixes two severe bugs. :oops:
* Some key-bindings no longer become applied to other modes after initialising wesnoth-mode.
* Delays are no longer caused in some WML files when moving within a buffer and the WML rendering.

EDIT: 1.0.2 restores highlighting disabled in 1.0.1; performance issues resolved.

Have fun!
Last edited by WildPenguin on May 22nd, 2007, 9:28 am, edited 1 time in total.
WildPenguin
 
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Postby WildPenguin » May 3rd, 2007, 1:20 am

Wesnoth-mode-1.0.3 has been released.

Indentation no longer requires font-lock-mode to be enabled for indentation to function correctly. Therefore, no longer loads font-lock-mode by default. However, using indent-region upon large regions without font-lock-mode may be slow. This will hopefully be corrected shortly.

outline-minor-mode can now be used in conjunction with wesnoth-mode. Currently only [event] tags are defined as headings, this may change in the future. Thanks go to zero1 for this. :D

wesnoth-insert-tag (C-c C-e) is no longer limited to inserting tags which are have completion available. Useful when new tags are added to WML or if I've missed any. :wink:

{@path/to/file} and {path/to/file} will now highlight correctly.
WildPenguin
 
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Postby WildPenguin » May 6th, 2007, 2:45 am

Version 1.0.4 has been released.

A new indentation style is now available. 'Normal' indentation (as explained here) is now the default indentation style for wesnoth-mode. The old savefile style is however still available for use by adding
Code: Select all
(setq wesnoth-indent-style-savefile t)
to your ~/.emacs.

Automatic tag indentation now operates on both closing and opening tags. However, it will now only attempt indentation once ']' is inserted, making its behavior is more consistent. Automatic tag indentation can now also be disabled by adding
Code: Select all
(setq wesnoth-auto-indent-tag nil)
to your ~/.emacs (Note: this variable is `wesnoth-auto-indent' as of version 1.0.5).

Both of the above options are also available for configuration via 'M-x customize-group RET wesnoth-mode RET', or by typing 'M-x customize-mode' within a wesnoth-mode buffer.

Also, mode-name (the name of the mode displayed on the mode-line) was changed to 'WML' to better reflect the content of the buffer. The name of the mode, is still however, 'wesnoth-mode'. :wink:

Have fun. :D
Last edited by WildPenguin on May 23rd, 2007, 5:09 am, edited 2 times in total.
WildPenguin
 
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Postby WildPenguin » May 23rd, 2007, 5:06 am

1.0.5 is now available.

Additional features have been added in this release to improve the efficiency of buffer navigation. It is now possible to move to the next or previous opening tag using wesnoth-jump-forward-tag (C-M-e) or wesnoth-jump-backward-tag (C-M-a). Also, if on the current line, an opening (or closing tag) is found, point can quickly be moved to the matching closing (or opening) tag using C-c C-m.

All lines can now be indented automatically. When RET (or C-m) is pressed, the current line will be indented correctly. Additionally, when using C-j, the current line will be indented, and the new line created also indented automatically. It should be noted that the name of the variable used in 1.0.4 has undergone a name-change. It is now wesnoth-auto-indent (was wesnoth-auto-indent-tag).

Also, all opening tags are now headings for outline-mode.

A few bug fixes were also made:
* Syntax highlighting is now even more bug-free :wink:
* Comments on the first line of a buffer will no longer break indentation.
WildPenguin
 
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Postby WildPenguin » July 6th, 2007, 2:38 am

Wesnoth mode 1.1.0 is now available.

This release features many bug-fixes, increased indentation performance, as well as enhancements to the new tag-jumping feature. Every known bug has now been fixed. If you find anything which does not appear to work correctly or is the cause of annoyance, please let me know about it.

The functions for jumping forward/backward across tags have been extended. You are now able to use them in conjunction with a numeric argument to move across multiple tags at once. For example, 'M-5 C-M-e' will move forward five opening tags.

Indentation of multiline strings has been significantly improved. Indentation with font-lock-enabled should be slightly faster and indentation without font-lock-mode enabled is now be equally as quick. Also, a bug which could cause multiline strings to be incorrectly indented was fixed.

The 'search failed' error signaled when attempting to indent between the beginning of the buffer and before the start of the actual WML has been corrected. Many enhancements to documentation have also been made.

Have fun.
WildPenguin
 
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Postby WildPenguin » July 22nd, 2007, 4:01 am

Wesnoth-mode 1.1.1 has been released.

A new feature (bound to C-c C-c by default) has been added to provide functionality for checking the tags in the current buffer nest correctly. If any problems are found with the tag structure the expected tag will be reported and point moved to the position which it was expected. Additionally, another function (bound to C-c C-n by default) checks all tags within the buffer for presence within a list of known tags and will also report any problems and position point on the appropriate line. With these features time spent debugging will hopefully be reduced significantly.

Also, jumping between matching tags has no longer requires a buffer to have consistant indentation in order to work correctly; a bug where the wrong matching tag would be jumped to was also fixed and several new tags were added to the list of known tags.

Enjoy.
WildPenguin
 
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Postby WildPenguin » August 13th, 2007, 2:59 am

Wesnoth-mode 1.1.2 is now available.

Support for preprocessor statements has been added to jumping commands. You are now able to jump, for example, from `#define' to it's matching `#enddef' via C-c C-m, as well as move across them in the same way in which you can tags via C-M-e and C-M-a. Additionally, it's now possible to jump to the matching element without a tag or preprocessor statement being on the current line - the element prior to point is now the source of the jump.

Support for preprocessor statements was also added to the new structure checking functionality. This will ensure all preprocessor statements nest nicely with tags and each other. Structure checks should now provide more useful feedback in some circumstances and will no longer produce a success message if no problems were detected.

The ability to fix WML structure automatically has been added to complement structure checking. Bound to C-c C-f by default, the command will seek errors in the structure and insert elements into the appropriate position(s) as well as removing excess elements from the end of a buffer. Although this command will repair the buffer structure, that does not necessarily mean it will insert elements where you want them; use this feature wisely.

The variable `wesnoth-auto-indent' has been renamed to `wesnoth-auto-indent-flag', if you've customised this variable, ensure that the name is updated. `wesnoth-indent-style-savefile' is now deprecated (support will be removed in the next release), instead use `wesnoth-indentation-function' whose value is the name of a function. For example, adding to your .emacs:
Code: Select all
(setq wesnoth-indentation-function 'wesnoth-indent-line-savefile)
will use savefile indentation over default indentation. If you rather default indentation, this is the default and you need not set anything.

In addition to these changes, a large portion of the code been revised which should lead to the correction of a few minor bugs, increased consistency, and a small performance boost.

EDIT: 1.1.2.1 fixes several minor bugs in the default indentation.
WildPenguin
 
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Postby WildPenguin » January 11th, 2008, 10:05 am

Wesnoth-1.2.2 is now available.

Two new indentation styles have been added, one of which performs indentation identically to the wmlindent utility, and has therefore been made the default indentation style. Indentation styles should be set using `wesnoth-indentation-function' (with `wesnoth-indent-savefile' now obsolete).

The following indentation styles are available:
* wesnoth-indent-default indents attributes and sub-elements in a level with preprocessor statements indented to the first column. This is the default indentation.
* wesnoth-indent-withtags indents attributes in-line with their containing elements and indents subtags in a level. Preprocessor statements are indented to the first column.
* wesnoth-indent-default-inline similar to wesnoth-indent-default, however preprocessor statements are treated in the same way as tags in indentation. (Similar to the old wesnoth-indent-line-savefile.)
* wesnoth-indent-withtags-inline similar to wesnoth-indent-withtags, however preprocessor statements are treated in the same way as tags in indentation. (Similar to the old wesnoth-indent-line-default.)

The structure fixing feature has been removed in favour of a more controlled approach. `wesnoth-insert-missing-closing' (C-c /) will attempt to find the next expected closing element and insert it at point. Enabling transient mark mode will cause this command to search the region for the missing tag to insert.

Structure checking and tag insertion will also now work on a region when `transient-mark-mode' is enabled. Structure checks will check only the region selected for incorrectly structured WML and tag insertion will place the requested opening and closing tags around the selected region.

All known bugs from prior versions have been corrected, with font-locking now correctly performed on macro structures and #endif; `wesnoth-newline-and-indent' now obeys the state of `wesnoth-auto-indent-flag'; and some minor indentation bugs have been corrected.

There are also many minor changes, some of which are documented in wesnoth-mode.el. Enjoy.
WildPenguin
 
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Postby WildPenguin » January 25th, 2008, 11:55 pm

Wesnoth-mode 1.2.3 has been released.

There are two significant improvements to this release:
* A menu entry has been added to provide an alternate means of accessing some of the more powerful features of wesnoth-mode.
* GNU Emacs 21 is now supported.

Also, the method of indentation customisation has changed again (sorry). There are now two variables used to control indentation:
Code: Select all
(setq wesnoth-indent-preprocessor-bol nil)

Can be set to indent preprocessor statements as tags instead of being indented to the beginning of the line.
Code: Select all
(setq wesnoth-indent-savefile nil)

Can be used to indent to the same column as the parent element.

Other notable improvements include significantly faster indentation to that available in 1.2.2, support for a number of new tags, and several minor bug-fixes.

Have fun.

EDIT:
* 1.2.3a fixes a preprocessor font-locking bug.
* 1.2.3b removes spurious messages when checking WML structure.
WildPenguin
 
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Re: Emacs WML-mode

Postby WildPenguin » September 6th, 2008, 10:14 am

Wesnoth-mode 1.2.4 is now released.

This is primarily a bug-fix release.

Indentation has been heavily revised resulting in significant improvements in performance, across larger regions in particular as well as a greater level of likeness to that of wmlindent. In addition to this, the minor (but likely annoying) behaviour of moving to the end of the line after indenting has been corrected.

Other improvements include improved syntax highlighting for macro calls; underscore is now treated as a whitespace character and customised keybindings no longer prevent default bindings from being applied.
WildPenguin
 
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Re: Emacs WML-mode

Postby WildPenguin » October 4th, 2008, 7:41 am

Wesnoth-mode-1.2.5 is now available.

1.2.5 is (primarily) another bug fix release. Much of wesnoth-mode has been rewritten entirely, resultingly many minor (and some larger) bugs are fixed in this release.

Tag insertion is now performed across a number of 'blocks', instead of across a region. To insert a pair of matching tags around any number of existing tags, a prefix argument can be given. For example, 'C-u 5 C-c e' will, by default, wrap the given tag around the next five blocks or until the parent element is closed. This should be easier/faster to perform than using transient-mark-mode in most cases and will ensure that tags are nested correctly. M-TAB can now also be used to insert tags (assuming the binding is not shadowed by the Window Manager, etc.)

Other significant changes are as follows:
    * 'wesnoth-indent-preprocessor-bol' has been removed, with preprocessor expressions now always indented to the first column.
    * Incorrect indentation when wesnoth-indent-savefile is nil has been fixed.
    * Wesnoth-mode now works correctly once again in GNU Emacs 21.

Several new tags have also been added to 'wesnoth-tags-list', but I doubt it's comprehensive yet.

Please report anything which does not behave as expected or functionality you feel is missing.

Have fun.
WildPenguin
 
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Re: Emacs WML-mode

Postby fabi » October 4th, 2008, 12:19 pm

Thanks for doing this.

I have an error every time pressing return or the tabulator key.
The error message is:
Code: Select all
Symbol's function definition is void: multiple-value-bind


Greetings, Fabi
fabi
Developer
 
Posts: 1220
Joined: March 21st, 2004, 2:42 pm
Location: Germany

Next

Return to WML Workshop

Who is online

Users browsing this forum: No registered users and 4 guests