![]() |
Emacs modes for mods and maps
1 Attachment(s)
I've thrown together two major modes for Emacs, dommod-mode and dommap-mode, for editing Dominions mods and .map files respectively. The modes mainly do syntax highlighting, and some simple navigation. They're still not up-to-date with Dominions 3 keywords, as I haven't got a copy of the up-to-date modding manuals. Let me know if you have any requests or complaints for them.
Edit: New mode files with support for Dominions 3. Now attached to this post rather than posted elsewhere. |
Re: Emacs modes for mods and maps
Cool, now how do I install it?
|
Re: Emacs modes for mods and maps
Put the two files somewhere in Emacs' loadpath. It varies by system, but you can display yours by entering emacs and asking for help on the variable load-path (C-h i). The directory ~/.emacs.d is often on the load-path for many systems, and if it isn't, you can add it by inserting the following line early in your .emacs file:
(setq load-path (cons "~/.emacs.d" load-path)) Now, add the two lines below to your .emacs file: ('require dommod-mode) ('require dommap-mode) Opening any file with the ending .dm or .map should active the correct mode; although you might have to turn on font lock manually (again, depending on your emacs setup): M-x font-lock-fontify-buffer Alternatively, and easier if you just want to try them out to see if they're useful, you can load them manually. M-x load-file and specify either dommap-mode.el or dommod-mode.el; then open a .map or .dm file. P.S. A really good resource on Emacs is the EmacsWiki |
Re: Emacs modes for mods and maps
Of course you must now do Vi or face a swarm of zelots ;p
|
Re: Emacs modes for mods and maps
This was harder than I thought. I get this cryptic error (I know nothing about emacs lisp files) after having added "require 'dommod-mode" to my .emacs.
File mode specification error: (void-function dommod-mode) Trace: Debugger entered--Lisp error: (void-function delete-duplicates) (delete-duplicates (append dommod-mode-weapon-keywords dommod-mode-armor-keywords dommod-mode-monster-basic-keywords dommod-mode-monster-advanced-keywords dommod-mode-spell-keywords dommod-mode-item-keywords dommod-mode-name-keywords dommod-mode-nation-keywords)) (regexp-opt (delete-duplicates (append dommod-mode-weapon-keywords dommod-mode-armor-keywords dommod-mode-monster-basic-keywords dommod-mode-monster-advanced-keywords dommod-mode-spell-keywords dommod-mode-item-keywords dommod-mode-name-keywords dommod-mode-nation-keywords)) t) (concat "^" (regexp-opt (delete-duplicates ...) t) "\\>") (list (concat "^" (regexp-opt ... t) "\\>") (quote (1 font-lock-function-name-face))) (list (list (concat "^" ... "\\>") (quote ...)) (list (concat "^" ... "\\>") (quote ...)) (list (concat "^" ... "\\>") (quote ...)) (list (concat "^" ... "\\>") (quote ...)) (list (concat "^" "\\(-- ==.*\\)" "\\>") (quote ...)) (list (concat "^" "\\(==.*\\)" "\\>") (quote ...))) (progn (list (list ... ...) (list ... ...) (list ... ...) (list ... ...) (list ... ...) (list ... ...))) (eval-when-compile (list (list ... ...) (list ... ...) (list ... ...) (list ... ...) (list ... ...) (list ... ...))) (defvar dommod-mode-font-lock-keywords (eval-when-compile (list ... ... ... ... ... ...))) eval-buffer(#<buffer *load*<2>> nil "dommod-mode" nil t) load-with-code-conversion("/usr/share/emacs/21.4/lisp/progmodes/dommod-mode.el" "dommod-mode" nil t) require(dommod-mode) eval-buffer(#<buffer *load*> nil "~/.emacs" nil t) load-with-code-conversion("/home/jk/.emacs" "~/.emacs" t t) load("~/.emacs" t t) #[nil "&#133;&#151; |
Re: Emacs modes for mods and maps
Hmm. The error is that I've used a function, delete-duplicates, that's apparently not part of your Emacs environment. Sorry about that, I was under the impression that it was a standard function.
I'll look into removing that function call or finding out where the delete-duplicates function can be found. Okay, found it. delete-duplicates is from a CommonList extension to Emacs. If you're lucky it's already installed, just not automatically loaded. Try adding the line "(require 'cl)" to your .emacs file, before the two require statements for dommod-mode and dommap-mode. If that doesn't sort it, you'll have to find and download this package (it's hopefully a standard package for your distribution); and if that doesn't work, let me know and I'll try to rewrite the code to do away with those function calls. That might take some time before I get the opportunity to do, though. |
Re: Emacs modes for mods and maps
It worked, thanks! http://forum.shrapnelgames.com/images/smilies/happy.gif
|
Re: Emacs modes for mods and maps
where would you find the loadpath or .emacs file on windows?
|
Re: Emacs modes for mods and maps
I think it's easier if I just refer to what the Emacs Wiki has to say on loadpaths. (Read the bit at the bottom about debugging first.)
|
Re: Emacs modes for mods and maps
Note!
There's a new version of the emacs modes with support for the Dominions 3 specific keywords. They can be found attached to the first post of this thread. |
Re: Emacs modes for mods and maps
I got it working! This is so much easier when you just use Linux http://forum.shrapnelgames.com/images/smilies/happy.gif
only wokrs if I use M-x load-file manually before opening a dm file. I wonder why my .emacs file isn't working. but its great just having a syntax |
Re: Emacs modes for mods and maps
Quote:
http://forum.shrapnelgames.com/showt...ewpost&t=42064 |
All times are GMT -4. The time now is 03:40 AM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.