Emacs major mode for Fvwm

Talk about anything related to FVWM, but don't ask support questions here!
User avatar
theBlackDragon
Administrator
Administrator
Posts: 714
Joined: Wed Oct 27, 2004 9:22 pm
Location: Zingem, Belgium
Contact:

Emacs major mode for Fvwm

Postby theBlackDragon » Sun Jul 17, 2005 11:22 pm

I've spent (quite) some time writing an Emacs major mode for Fvwm as I thought the hilighting Fundamental mode provided was insufficient. Before everything I should thank Thomas Adam for giving me his fvmw.vim file, this has spared me the enormous task of having to look up every single Fvwm keyword in the manpages...

Now on with a disclaimer: this is a work in progress, I consider it to be useful, but there are bound to be errors and shortcomings in it. Also it's very well possible that some keywords are wrongly categorized. I have left the expressions I used to generate the optimized regular expressions in the file so you can modify it if you feel so inclined, thouh I would appreciate it if you communitcated any errors you found to me.

Features:
- syntax hilighting on the main Fvwm configuration file
- hilights FvwmScript's syntax

This is what it looks like: shot.

Todo:
- add more keywords
- move wrongly placed keywords around
- add functions to insert Fvwm functions definitions and add keybindings to them

You can grab it here, you should add something like the following to you .emacs configuration file.

Code: Select all

;; Add the ~/.elisp directory to our emacs load-path
(setq load-path (append load-path (list "~/.elisp")))
;; load the fvwm-mode so we can use it
(load "fvwm-mode")

;; Automatically load fvwm mode for fvwm configuration files
(setq auto-mode-alist
      (cons '("config" . fvwm-mode)
       (cons '("FvwmApplet-" . fvwm-mode)
        (cons '("FvwmScript-" . fvwm-mode)
         auto-mode-alist))))


You should modify it depending on the name of your Fvwm configuration file (.fvwm2rc for older Fvwm versions) and the naming convention you use for FvwmScript files.

I hope it is at least of use to some people :)

[EDIT]Added a screenshot
[EDIT]Forgot to show the code on how to include the file in your setup, fixed now :oops:

thomasadam
Administrator
Administrator
Posts: 3046
Joined: Mon Nov 08, 2004 1:12 am
Location: England
Contact:

Re: Emacs major mode for Fvwm

Postby thomasadam » Mon Jul 18, 2005 11:54 pm

theBlackDragon wrote:I've spent (quite) some time writing an Emacs major mode for Fvwm as I thought the hilighting Fundamental mode provided was insufficient. Before everything I should thank Thomas Adam for giving me his fvmw.vim file, this has spared me the enormous task of having to look up every single Fvwm keyword in the manpages...


Heh. You're welcome. It was really nothing.... :) I have to say though, whilst I am not an Emacs user, the colouration looks nice. :) A job well done, tBD. :)

-- Thomas Adam.

taily
Cat in the hat
Cat in the hat
Posts: 39
Joined: Mon Jul 11, 2005 7:34 pm
Location: Finland
Contact:

Postby taily » Tue Jul 19, 2005 6:44 pm

This looks nice! I'll definetly try it out, even though emacs isn't my main editor, who knows, it might become after this ;P

VoiDeR
Pussycat
Pussycat
Posts: 133
Joined: Tue Apr 26, 2005 4:16 am

Postby VoiDeR » Wed Jul 20, 2005 2:55 am

Any chance at explaining to an emacs vargin what to do with this file? :oops: I just finished emergeing emacs and i have no idea whats going on lol.

VoiDeR

Hun
Kitten
Kitten
Posts: 19
Joined: Sun Nov 21, 2004 10:41 am

Postby Hun » Wed Jul 20, 2005 3:09 am

pretty easy

after the first start, you got a dir named .xemacs or .emacs (depending which you use) in your ~

in this, there are usually 2 files, init.el and custom.el
init.el is for loading stuff on startup, custom.el for customizing look'n'feel (you can mix like you want, but that doesn't make sense)

To use it, add

Code: Select all

(load "PATH/TO/fvwm-mode.el")
(setq auto-mode-alist
         (cons '("config" . fvwm-mode)
         (cons '("FvwmApplet-" . fvwm-mode)
         (cons '("FvwmScript-" . fvwm-mode)
         auto-mode-alist))))
to init.el

It should automatically turn on when entering a fvwm-file named this way. If named different, hit M-x (first hold Meta/Alt and then press x) and type fvwm-mode (you can use tab like in a shell). If it still doesn't work, M-x font-lock-mode (you might want to add

Code: Select all

(font-lock-mode)
to init.el).

hope to have helped

PS: If I understood you wrong and you wanted to find out HOW this file works, please refer to an Emacs Lisp tutorial.

VoiDeR
Pussycat
Pussycat
Posts: 133
Joined: Tue Apr 26, 2005 4:16 am

Postby VoiDeR » Wed Jul 20, 2005 4:29 am

For some reason i didnt have either of thoses files so i made an init.el file and added

Code: Select all


(load "PATH/TO/fvwm-mode.el")
(setq auto-mode-alist
         (cons '("config" . fvwm-mode)
         (cons '("FvwmApplet-" . fvwm-mode)
         (cons '("FvwmScript-" . fvwm-mode)
         auto-mode-alist))))


When i start xemacs down on the bottom of the window it says

Code: Select all

Loading /home/voider/.xemacs/fvwm-mode.el...done

When i open an FvwmScript file i dont get any highlighing. Also im not sure where to add

Code: Select all

;; Add the ~/.elisp directory to our emacs load-path
(setq load-path (append load-path (list "~/.elisp")))
;; load the fvwm-mode so we can use it
(load "fvwm-mode")

;; Automatically load fvwm mode for fvwm configuration files
(setq auto-mode-alist
      (cons '("config" . fvwm-mode)
       (cons '("FvwmApplet-" . fvwm-mode)
        (cons '("FvwmScript-" . fvwm-mode)
         auto-mode-alist))))


Also i dont have a ~/.elisp file. LOL im in all kinds of trouble.

VoiDeR

User avatar
theBlackDragon
Administrator
Administrator
Posts: 714
Joined: Wed Oct 27, 2004 9:22 pm
Location: Zingem, Belgium
Contact:

Postby theBlackDragon » Wed Jul 20, 2005 9:05 am

As it seems to try to load the file I suppose you just haven't pointed it to the right library path, so you'll need to create a directory to store your elisp files in, which is ~/.elisp on my system, them place fvwm-mode.el in it.

Now in your .emacs file you can either do as Hun did and load one single elisp file by using:

Code: Select all

(load "~/.elisp/fvwm-mode.el")

or you could make all files in that directory available by using:

Code: Select all

(setq load-path (append load-path (list "~/.elisp")))

and then loading the mode you want:

Code: Select all

(load "fvwm-mode")

After that you just have to associate Fvwm configuration files with fvwm-mode by using something like:

Code: Select all

;; Automatically load fvwm mode for fvwm configuration files
(setq auto-mode-alist
      (cons '("config" . fvwm-mode)
       (cons '("FvwmApplet-" . fvwm-mode)
        (cons '("FvwmScript-" . fvwm-mode)
         auto-mode-alist))))

Substitute the strings in double quotes with the appropriat values for your case, like "config" with ".fvwm2rc".

Also, be sure to turn on syntax hilighting by putting this in your .emacs for GNU Emacs

Code: Select all

(global-font-lock-mode 1)   

and this for XEmacs:

Code: Select all

(setq font-lock-auto-fontify t)

HTH :)

VoiDeR
Pussycat
Pussycat
Posts: 133
Joined: Tue Apr 26, 2005 4:16 am

Postby VoiDeR » Wed Jul 20, 2005 3:49 pm

Thanks BlackDragon and Hun! Works great now. I guess ill be dumping vim and learing emacs :)

VoiDeR

User avatar
theBlackDragon
Administrator
Administrator
Posts: 714
Joined: Wed Oct 27, 2004 9:22 pm
Location: Zingem, Belgium
Contact:

fvwm-mode 1.1

Postby theBlackDragon » Fri Jul 22, 2005 3:12 pm

I have released version 1.1 of fvwm-mode.el, it contains many fixes and improvements over the previous version. So what has changed?
  • I (nearly) totally rewrote the hilighting code, it's now much easier to add keywords yourself, this however turned up a shortcoming in emacs versions prior to emacs 22, regexp-opt only supported a limited size for it's arguments, so I had to create a workaround.
  • I have added functions and keybindings to insert skeletons for Fvwm menu's (C-c i m) and functions (C-c i f).
  • Fixed another font-lock related bug that could create a nasty crash when font-lock wasn't turned on at emacs start.

You can get the new version on my page for the project whick resides here.

I would like to hear from any bugs you might encounter, I'd also like to know if the mode still works properly in xemacs as I do some version checking in the file and I don't know how xemacs will react to that... :?

User avatar
theBlackDragon
Administrator
Administrator
Posts: 714
Joined: Wed Oct 27, 2004 9:22 pm
Location: Zingem, Belgium
Contact:

Postby theBlackDragon » Sun Jul 24, 2005 12:22 pm

Released 1.2 today, this release fixes some issues with the hilighting not being honoured when trying to comment out something containing doublequotes (thanks to Hun for reporting this bug).

The full changelog is in the file, which still can be found on my site here.

[EDIT]Did a bugfix release (1.2.1), this should fix another syntax-table issue, if you experience a bug where keywords get coloured in the middle of normal words (eg names of self defined functions) then this version should fix it. I just replaced the old version, so you should use the same link as before :)
[EDIT]Did another bugfix release today (1.2.2), now syntax colouring should work perfectly (until I break it again, of course :wink:)

User avatar
theBlackDragon
Administrator
Administrator
Posts: 714
Joined: Wed Oct 27, 2004 9:22 pm
Location: Zingem, Belgium
Contact:

Postby theBlackDragon » Sun Sep 11, 2005 1:58 pm

1.5.0 was released today with a lot of new features.

  • There is now a menu (which looks kind of broken in XEmacs :( )
  • You can now complete Fvwm keywords by pressing M-Tab (or Esc-Tab for those using alt-tab for other stuff)
  • Quite some fixed in the syntax colouring
  • You can now choose if you want the syntax to be hilighted in a case sensitive or a case insensitive way, Fvwm doesn't care about style, but some of us do (well, I do :wink: )
  • Also got rid of the size limitation on fvwm-execute-region, you can now execute arbitrarily large regions.

You can grab it at the link from the first post or from it's project page.

Enjoy, and don't hesitate to report bug or to post feature requests! :)

shaozi
Cat in the hat
Cat in the hat
Posts: 69
Joined: Thu Dec 23, 2004 9:28 am
Location: California, USA

Postby shaozi » Sat Nov 26, 2005 7:18 am

Great! I have been asking for an Emacs mode in this forum long time ago.

This is really cool!

There are two small things:

1. Each time when load a config, emacs tooks a few seconds to generating list of completions. It is a little bit slow.
2. If indention can be done, it will be perfect.

Great job

User avatar
theBlackDragon
Administrator
Administrator
Posts: 714
Joined: Wed Oct 27, 2004 9:22 pm
Location: Zingem, Belgium
Contact:

Postby theBlackDragon » Sun Nov 27, 2005 10:23 pm

shaozi wrote:Great! I have been asking for an Emacs mode in this forum long time ago.

This is really cool!

There are two small things:

1. Each time when load a config, emacs tooks a few seconds to generating list of completions. It is a little bit slow.
2. If indention can be done, it will be perfect.

Great job


I am aware of the slowness, it's gone in emacs 22.x.x (CVS Emacs) though as that version supports hashmaps which dramatically speeds up the generation of the completion list. As an other option you could delay generating the completion list until you first use completion by putting the following in your ~/.emacs:

Code: Select all

(setq fvwm-preload-completions nil)

Note however that you will then get the delay the first time you try to complete a word, which might be annoying as it interrupts your train of thought, I'm still trying to figure out a solution to make this faster...

Yeah, indentation is next on my todo list, unfortunately I don't get much work on it done due to schoolwork being really over the limit atm... :(

PS: I have released a 1.5.1 version which fixes a rather serious bug in fvwm-script-insert-skeleton.

PPS: I'm really glad at least some people seem to actively use it besides myself :D

User avatar
theBlackDragon
Administrator
Administrator
Posts: 714
Joined: Wed Oct 27, 2004 9:22 pm
Location: Zingem, Belgium
Contact:

Postby theBlackDragon » Wed Feb 15, 2006 10:42 pm

It's been a longtime but now I've release another version, version 1.5.2, mostly bugfixes though.

  • Fixed the automatic timestamp insertion to always insert a timestamp if you save a changed file (it does nothing when the file wasn't modified or you have undone all of the modifications since the last save)
  • Fixed a font lock issue, FVWM doesn't support end-of-line comments, only start-of-line comments but Fvwm Mode hilighted both, now it no longer does.
Things that still haven't been fixed:
  • The slow creation of the completion list in XEmacs and Emacs 21.x this is the next item on my todo list...
  • The broken menu appearance in XEmacs, which I suspect is more of an XEmacs issue anyway...

If you find any bugs or have any suggestions don't hesitate to let me know :)

Rebecca
Kitten
Kitten
Posts: 8
Joined: Mon Feb 13, 2006 7:49 pm
Location: Germany

Postby Rebecca » Sat Feb 18, 2006 11:37 pm

I've just downloaded fvwm-mode.el, and it looks really nice! 8)

Just two small things:

1) Line 3 of fvwm-mode.el says it's release 1.5.1, but it's 1.5.2, isn't it?

2) I have the following line in my config:

Code: Select all

#default styles (fonts, window styles, window decorations,...)

Obviously, that's a comment, but fvwm-mode thinks that #def is the html notation of a colour. So the first part of the line is displayed in that pinkish colour, the rest of the line is treated as normal code. (Well, well, why must I use such a tricky comment? :wink: )


Whatever, now I'm going to have fun with Emacs and Fvwm... :D

User avatar
theBlackDragon
Administrator
Administrator
Posts: 714
Joined: Wed Oct 27, 2004 9:22 pm
Location: Zingem, Belgium
Contact:

Postby theBlackDragon » Mon Feb 20, 2006 10:28 pm

Rebecca wrote:I've just downloaded fvwm-mode.el, and it looks really nice! 8)

Just two small things:

1) Line 3 of fvwm-mode.el says it's release 1.5.1, but it's 1.5.2, isn't it?

2) I have the following line in my config:

Code: Select all

#default styles (fonts, window styles, window decorations,...)

Obviously, that's a comment, but fvwm-mode thinks that #def is the html notation of a colour. So the first part of the line is displayed in that pinkish colour, the rest of the line is treated as normal code. (Well, well, why must I use such a tricky comment? :wink: )


Whatever, now I'm going to have fun with Emacs and Fvwm... :D


Thanks for the bugreport :wink: I've fixed both issues for the next version, if you can't wait that long you can grab a path here.

More font-lock issues are on the 'ToFix list' for the next release :)

I hope you like what I have managed to hack together so far :)

Link182
Kitten
Kitten
Posts: 17
Joined: Wed Jun 15, 2005 7:37 pm

About highlights...

Postby Link182 » Tue Feb 21, 2006 1:06 am

Hi, is there a highlight file for something like gedit or vim? I just don't want to install such a big thing like emacs just for editing my fvwm config files.

Thanks

User avatar
theBlackDragon
Administrator
Administrator
Posts: 714
Joined: Wed Oct 27, 2004 9:22 pm
Location: Zingem, Belgium
Contact:

Re: About highlights...

Postby theBlackDragon » Tue Feb 21, 2006 8:52 pm

Link182 wrote:Hi, is there a highlight file for something like gedit or vim? I just don't want to install such a big thing like emacs just for editing my fvwm config files.

Thanks


I wouldn't exactly call Vim small, but anyway. Vim higlights FVWM configuration files by default if they are called .fvwm2rc iirc :)

User avatar
theBlackDragon
Administrator
Administrator
Posts: 714
Joined: Wed Oct 27, 2004 9:22 pm
Location: Zingem, Belgium
Contact:

Postby theBlackDragon » Mon Apr 24, 2006 10:18 pm

I've been doing quite some work on fvwm-made lately resulting in much faster completion for Emacsen that support pcomplet. I also added a basic indentation function (off by default) and improved quite a bit on the module's internal documentation (you should try C-h m sometime).

I've also written a small manual for it to get you up and running with most of the mode's features (based on the latest devel release, so expect things to break if you're using a release <= 1.5.2 and try to follow this manual). It's by no means finshed, I at the very least should add ViktorGriph's suggestion from the Fvwm Wiki.

Please post/mail/whatever all comments/suggestions/criticism you might have, all of it is more than appreciated! :D

Oh, before I forget, the manual and mode can still be found here.

Gramphos
Pussycat
Pussycat
Posts: 145
Joined: Sun Aug 28, 2005 6:41 pm
Contact:

Postby Gramphos » Mon Apr 24, 2006 11:16 pm

In section 4.2 you should point out the need of FvwmCommandS to be loaded by fvwm in order for command execution to work.

User avatar
theBlackDragon
Administrator
Administrator
Posts: 714
Joined: Wed Oct 27, 2004 9:22 pm
Location: Zingem, Belgium
Contact:

Postby theBlackDragon » Mon Apr 24, 2006 11:46 pm

Gramphos wrote:In section 4.2 you should point out the need of FvwmCommandS to be loaded by fvwm in order for command execution to work.


Thanks, I totally forgot about that :oops: It's fixed now and I've uploaded a new version (also of the devel version of the mode).

Thanks again :)

shaozi
Cat in the hat
Cat in the hat
Posts: 69
Joined: Thu Dec 23, 2004 9:28 am
Location: California, USA

And convert it into html

Postby shaozi » Wed May 03, 2006 10:16 pm

Maybe this tool is useful for Emacs user too:
http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el

User avatar
theBlackDragon
Administrator
Administrator
Posts: 714
Joined: Wed Oct 27, 2004 9:22 pm
Location: Zingem, Belgium
Contact:

Postby theBlackDragon » Fri Dec 29, 2006 8:36 pm

fvwm-mode 1.6.0 has been released, you can get it here.

Changes in this version (from the release notes):
  • fixed a font-lock issue with colours inside comments, thanks to Rebecca on the FVWM Forums for pointing this out.
  • now using pcomplete for completion resulting in much faster completion, especially on GNU Emacs < 22, XEmacs users however will still need to deal with the older completion algorithm, which is quite a bit slower than pcomplete (unless they somehow install pcomplete of course)
  • started off writing an indentation function, _very_ basic and buggy atm (and turned off by default).
  • improved 'self-documentedness' of this mode.
  • added new keywords introduced in FVWM 2.5.17
  • now also hilights colour names from RGB.txt in Colorsets
  • commented out some superfluous colour definitions


Enjoy!

User avatar
theBlackDragon
Administrator
Administrator
Posts: 714
Joined: Wed Oct 27, 2004 9:22 pm
Location: Zingem, Belgium
Contact:

Re: Emacs major mode for Fvwm

Postby theBlackDragon » Mon Aug 27, 2007 12:19 pm

For the emacsers among us, fvwm-mode 2.6.1 has been released.

The only functional difference with previous versions is the addition of fvwm-execute-buffer (C-c e b) so you can run an entire buffer at once. A pretty good idea from loupgaroublond (go thank him in #fvwm ;) ).

User avatar
theBlackDragon
Administrator
Administrator
Posts: 714
Joined: Wed Oct 27, 2004 9:22 pm
Location: Zingem, Belgium
Contact:

Re: Emacs major mode for Fvwm

Postby theBlackDragon » Thu May 16, 2013 12:00 am

Since we've been dragging up old threads anyway lately a little heads up to those interested: I've moved fvwm-mode to GitHub.

There's been some changes since the last version I announced here but nothing shocking, see the NEWS file for details.


Return to “General FVWM discussion”

Who is online

Users browsing this forum: No registered users and 1 guest