Emacs WML-mode

The place to post your WML questions and answers.

Moderator: Forum Moderators

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.
WildPenguin
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Re: Emacs WML-mode

Post by WildPenguin »

Thanks for reporting this Fabi.

I've uploaded 1.2.5a, which should fix this problem, and a few others.

Let me know how it goes.
User avatar
xtifr
Posts: 414
Joined: February 10th, 2005, 2:52 am
Location: Sol III

Re: Emacs WML-mode

Post by xtifr »

Trying to use it (1.2.5a) with Xemacs, I get "Symbol's value as variable is void: global-font-lock-mode". It mostly seems to work, but it beeps and complains every so often, and I suspect that it's not working 100%.

I know this sort of thing can be made to be reasonably emacs-flavor-agnostic, but it does take a little extra work. I haven't done any elisp stuff to speak of in a couple of years, but I did do the first font-lock and easymenu support for Debian-changelog.el, and I did make sure it worked with both flavors of emacs, so I can probably help out if you need it.

I'll throw out a wishlist request for easymenu support too, if you ever happen to feel like it. Sometimes it's nice to be able to mouse through things when it's late and you're tired and your brain's not firing on all cylinders. :)
"When a man is tired of Ankh-Morpork, he is tired of ankle-deep slurry" -- Catroaster

Legal, free live music: Surf Coasters at Double Down Saloon, Las Vegas on 2005-03-06. Tight, high-energy Japanese Surf-Rock.
WildPenguin
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Re: Emacs WML-mode

Post by WildPenguin »

Thanks for reporting this.

Indeed; if it's complaining, it is certainly not working 100%.

The problems should be sorted out and easymenu support has been implemented for the upcoming release. I hope to make the changes available within the next few days.
fabi
Inactive Developer
Posts: 1260
Joined: March 21st, 2004, 2:42 pm
Location: Germany

Re: Emacs WML-mode

Post by fabi »

The new version of the mode is working very well for me now.
It's definitely a huge improvement to the standard emacs mode.

My greatest problems when coding wml is that unknown tags or attributes aren't reported by the wesnoth engine.
If the mode could colour only known tags and attributes and had even completion for attributes or tags that are subtags of the current
context I would cry from happiness. :wink:

Greetings, Fabi
WildPenguin
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Re: Emacs WML-mode

Post by WildPenguin »

Wesnoth-mode-1.3.0 is now available.

1.3.0 adds support for macro completion and context-sensitive completion of attributes and tags. Attributes, tags and macros can be inserted via C-c C-a, C-c C-t and C-c C-m, respectively, with completion for the current context. Similarly, TAB will attempt to complete any partially inserted elements. A numeric prefix argument can be given to C-c C-t and TAB to insert the completed tag around the next n blocks.

WML checking in wesnoth-mode has also been enhanced: all elements are checked to ensure they're valid in their current context with all warnings reported in a separate buffer.

As a result, some other keybindings have changed:
C-c C-n has been made obsolete; use C-c C-c instead.
C-c C-m (jump to matching tag) has been moved to C-c C-o.
Alias bindings for these commands (for example, C-c /) have been removed to avoid potential shadowing of user-specified bindings. Please use the full form (E.g. C-c C-/) instead.

By default wesnoth-mode-1.3.0 includes support based on WML in wesnoth-1.5.5. As WML changes between versions of wesnoth, a new utility, wesnoth-update, has been added to allow generation of WML data using WML for specific versions of wesnoth. This can be set-up as follows:

Code: Select all

(setq wesnoth-root-directory "/path/to/wesnoth/"
wesnoth-addition-file "/path/to/wesnoth-mode/wesnoth-mode/wesnoth-wml-additions.cfg"
wesnoth-update-output-directory "/path/to/wesnoth-mode/")
Where:
* wesnoth-root-directory should be the path to an existing wesnoth installation;
* wesnoth-addition-file should be the path to a WML additions file (a sample file is included in wesnoth-mode), which adds WML data not found in the wesnoth installation;
* wesnoth-update-output-directory which is the path to store the WML data (this path must be in your 'load-path' -- for simplicity, I recommend this to be the same directory is wesnoth-mode).

Once set, running 'M-x wesnoth-update' will regenerate all known WML data for the version of wesnoth found in 'wesnoth-root-directory'. Running wesnoth-update may take a minute or two.

Due to the method used to find WML information, some less-common attributes and subtags may not initially be available for completion, the missing elements can be made known by adding them to the file specified in 'wesnoth-addition-file' and running 'M-x wesnoth-update'. See the sample addition file, wesnoth-wml-additions.cfg, for more information.

By default, only built-in macros are known to exist, but project-specific macros can be added by running 'M-x wesnoth-update-project-information' which will locate any macro definitions within WML files in the current directory.

Other changes include additional functionality from the WML menu; support for Xemacs 21 and some minor bug-fixes.
fabi wrote:If the mode could colour only known tags and attributes and had even completion for attributes or tags that are subtags of the current
context I would cry from happiness.
I'll see if I can implement this in a way that does not slow font-locking too much, but if these changes make you cry anyway, I'm sorry. ;)

Let me know if you have any problems.
fabi
Inactive Developer
Posts: 1260
Joined: March 21st, 2004, 2:42 pm
Location: Germany

Re: Emacs WML-mode

Post by fabi »

Works like a charm.

I commited it to trunk.
Please continue the good work.

Greetings, Fabi
WildPenguin
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Re: Emacs WML-mode

Post by WildPenguin »

Wesnoth-mode-1.3.1 is now available.

Changes include:
* Performance for completion, WML checking, and insertion of missing tags has been improved significantly
* Arguments in macro definitions are now checked and available for completion
* Preprocessor statements are now complete-able via TAB and C-c C-p
* Macro information from the current buffer is updated prior to attempting macro completion, and can be updated manually via C-c C-u
* Completion history is specific to wesnoth-mode
* WML checking is more thorough

Many minor bugs and inconsistencies are also corrected. Let me know if you find any more.

Have fun.

UPDATE:
1.3.1a removes superfluous messages and boosts performance when checking WML.
Last edited by WildPenguin on October 27th, 2008, 9:26 am, edited 1 time in total.
fabi
Inactive Developer
Posts: 1260
Joined: March 21st, 2004, 2:42 pm
Location: Germany

Re: Emacs WML-mode

Post by fabi »

The new version works for me.
I wasn't able to figure out how the scanning for local macros of a campaign works.
Please attach a README file to the distribution.

commited to svn trunk.

Greetings, Fabi
WildPenguin
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Re: Emacs WML-mode

Post by WildPenguin »

Additional macro definitions are automatically made known to wesnoth-mode for each WML file which is loaded in the session. So, if you have some specific macros defined outside the current buffer (say, in utils/), 'C-x C-f /path/to/campaign/utils/*' will make them known. C-c C-u can be used to update the known macro definitions for any buffer which has since been modified. (Note that this is not required when the macro is defined in the WML file currently being edited as such definitions will be automatically updated when needed.). If there is any behaviour which you would find more convenient, please let me know and I'll do my best to add it.

A README will be added to the next release which will document such functionality.

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

Re: Emacs WML-mode

Post by WildPenguin »

Wesnoth Mode 1.3.2 is now available.

Indention and WML checking have received major performance improvements in this release.

A manual has been added to Wesnoth Mode. The documentation aims to be comprehensive; please let me know if anything is unclear or undocumented.

Wesnoth Mode can now be byte-compiled using 'make', and, if texinfo is available, documentation can be produced as a PDF and info file using 'make doc'. Otherwise, an online version of the manual can be found at http://www.wesnoth.org/wiki/Wesnoth_Mode.

Many minor bugs have also been fixed.

Have fun.
fabi
Inactive Developer
Posts: 1260
Joined: March 21st, 2004, 2:42 pm
Location: Germany

Re: Emacs WML-mode

Post by fabi »

WildPenguin wrote:Wesnoth Mode 1.3.2 is now available.

Indention and WML checking have received major performance improvements in this release.

A manual has been added to Wesnoth Mode. The documentation aims to be comprehensive; please let me know if anything is unclear or undocumented.

Wesnoth Mode can now be byte-compiled using 'make', and, if texinfo is available, documentation can be produced as a PDF and info file using 'make doc'. Otherwise, an online version of the manual can be found at http://www.wesnoth.org/wiki/Wesnoth_Mode.

Many minor bugs have also been fixed.

Have fun.
Commited to trunk.
What about the wesnoth-wml-additions.cfg file, it is no longer included in the release. Shall I remove it from svn as well?

Greetings, Fabi
WildPenguin
Posts: 161
Joined: September 6th, 2005, 10:41 pm
Location: Australia

Re: Emacs WML-mode

Post by WildPenguin »

Thanks for this Fabi.

wesnoth-wml-additions.cfg should still be included in the release. Could you re-check? I grabbed a copy of the archive to make sure it packaged correctly, and everything looks to be intact.
fabi
Inactive Developer
Posts: 1260
Joined: March 21st, 2004, 2:42 pm
Location: Germany

Re: Emacs WML-mode

Post by fabi »

WildPenguin wrote:Thanks for this Fabi.

wesnoth-wml-additions.cfg should still be included in the release. Could you re-check? I grabbed a copy of the archive to make sure it packaged correctly, and everything looks to be intact.
It is there. My fault was that it didn't change so no svn upload. That confused me.
uzytkownik
Posts: 126
Joined: April 19th, 2008, 7:12 pm
Contact:

Re: Emacs WML-mode

Post by uzytkownik »

I would like to thank for writing WML Mode. However I've found several issues:
1. The TAB should not move to the begin of the line if used after =. It may indent but it should not move pointer in relation to the text
2. I would prefere to have something more unix-shell like with TAB. If no match met I'm not moved into mini-buffer. After second the list of possible matches is shown.
3. The leader secription (type,{user_,}description,...) are not completed automatically
4. When I enetered commented textdomain and tried to clicked RET it showed error (I'll post it here next time I will met this).
fabi
Inactive Developer
Posts: 1260
Joined: March 21st, 2004, 2:42 pm
Location: Germany

Re: Emacs WML-mode

Post by fabi »

When tab-completing a macro, can the arguments' names be inserted as well?
Post Reply