[Asterisk-Users] emacs syntax/keyowrd highlighting: asterisk-mode

Dave Grey lydanynom at mac.com
Fri Oct 21 08:48:41 MST 2005



Hi all.

I've just begun learning *, and as my dialplans and macros have  
gotten more complex I started wishing for a way to more easily follow  
the flow of various Goto, GotoIf, Dial, and etc. commands, especially  
when trying to use priority "n" and labels rather than numbered  
priorities.

Toward this end, I hacked together an emacs general/minor mode for  
basic font-locking (syntax shading) support.  Feel free to grab it here:

http://homepage.mac.com/lydanynom/asterisk-mode.el.zip

Feel even freer to suggest or make changes, or point me to your own  
major or minor asterisk-mode.  A quick search before I started did  
not find any such thing, but in retrospect I probably should have  
just asked here rather than trying to reinvent the wheel.  Lisp  
regexps give me a headache, and this was my first and likely only  
foray into writing emacs modes, so don't expect too much.

For now, though, it seems to do what I want it to, which is, as I  
commented in the file:

;; Assumes applications and functions will be in the same case they  
appear
;; in the documentation:
;;  Dial, BackGround, DISA, CALLERID, Playback, etc.
;; Assumes comma (rather than pipe) will be used as the argument  
delimiter,
;; and that arguments to applicatins will always be enclosed in ():
;;  Goto(context,123,1)
;;
;; The principle goal of this mode is to make it easier to follow the  
flow
;; of a complicated dialplan with many Goto and other context-jumping  
apps
;; geing called.  Extensions, priorities, and labels are handled in a
;; way that attempts to higlight the (potentially) operative bits while
;; subdueing the bits that can't be directly addressed.  Secondarily,  
the
;; applications, functions, variables, and config keywords are  
highlighted as well,
;; each in their own face.

It is intended primarily for use with extensions.conf, but it is  
effective in all of the configuration files.

Of course, it seems that this is rapidly become moot with the advent  
of ael, but I haven't ventured there yet, myself.

Anyway, use and enjoy, comment, or criticize as you feel is warranted.

Big kudos to this list and the * community as a whole.  I have  
learned a ton in the last two weeks, thanks to all of you.

lyd



More information about the asterisk-users mailing list