Title: C Programming Language - enum alignment Ref: sub22 Author: Dan Perry Date: 2002-10-11 Working with a lot of enums in C/C++ and I hate it when my fellow developers do not align all the equal signs ("=") in the enumeration. This macro performs the re-alignment job. To use it, adjust the first "=" to the required column and run the macro. It stops if it attempts to delete characters other then spaces. To run the macro it must be installed in the system (see below) then "M-x align-enums" Suggest that the macro is installed by pasting into your 'user.emf' file which is automatically run at start up. ==== cenum.emf start ================================================ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Created By : Dan Perry ; Created : Fri, 11 Oct 2002 10:44:46 -0400 ; Last Modified : <021011.1044> ; ; Description : C programming language - enum alignment. ; ; Notes ; ; History ; ; Copyright (c) 2002 Dan Perry ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; define-macro align-enums set-variable .TheChar @wc set-variable .TheColumn $window-acol *nextline forward-line !if &or &xsequal @wl "^[ \t]*$" &xsequal @wl "^[ \t]*//.*$" !goto nextline !endif !if ¬ &xsequal @wl &cat &cat ".*" .TheChar ".*" !goto finish !endif beginning-of-line !while ¬ &sin @wc .TheChar forward-char !done !if &equal .TheColumn $window-acol !goto nextline !endif !if &less $window-acol .TheColumn !while &less $window-acol .TheColumn insert-space !done !goto nextline !endif !if &great $window-acol .TheColumn !while &great $window-acol .TheColumn backward-char !if ¬ &seq @wc " " !bell !abort !endif 1 forward-delete-char !done !goto nextline !endif *finish ml-write "Finished" !return !emacro ==== cenum.emf end =================================================