Loading ...
Sorry, an error occurred while loading the content.

692Re: [jasspa] Digest Number 164

Expand Messages
  • Jon Green
    Dec 5, 2002
    • 0 Attachment
      Thanks Dan,

      Sorry for the delay. This has been re-bundled as a
      contribution (sub22.txt). I think this is a good
      candidate to roll into the standard c/c++ macros in
      the future.

      Regards
      Jon.

      Dan Perry wrote:
      >
      > I Just wanted to share a macro that I wrote. I work with a lot of enums in C/C++ and I hate when my fellow developers don't align all the equal signs("=") in the enumeration. So I wrote this little macro to do it for me. To use it, adjust the first = to the proper column and run the macro. It stops if it attempts to delete characters other then spaces. Please let me know what you think and any way to improve it. Like possibly aligning tables or more then one character on each line...
      >
      > Dan
      >
      > 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
      >
      >
      > __________________________________________________________________________
      >
      > This is an unmoderated list. JASSPA is not responsible for the content of
      > any material posted to this list.
      >
      > To unsubscribe, send a mail message to
      >
      > mailto:jasspa-unsubscribe@yahoogroups.com
      >
      > or visit http://groups.yahoo.com/group/jasspa and
      > modify your account settings manually.
      >
      >
      >
      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    • Show all 2 messages in this topic