From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,316008d62b7d637e X-Google-Attributes: gid103376,public From: Mattias Sj�sv�rd Subject: Re: Emacs Ada-Mode Date: 1998/05/22 Message-ID: <35654CD9.316C@aom.ericsson.se>#1/1 X-Deja-AN: 355506920 Content-Transfer-Encoding: 8bit References: <356680b9.18964466@news.geccs.gecm.com> <35693157.3762034@news.geccs.gecm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Organization: Ericsson Newsgroups: comp.lang.ada Date: 1998-05-22T00:00:00+00:00 List-Id: Brian Orpin wrote: > It still doesn't align elements in a record declaration (where all this > started). :-(( > I have a small lisp utility that might help; dwimtab (see doc later in this posting). It doesn't automagically line up record declarations, but it's a step on the way. I've used it in C, C++, Java and Ada mode. Mail me if you want the source. /Sj�sv�rd Doc best viewed with fixed width font (apologies for examples in C; I work in a multilingual environment! :) Do-What-I-Mean tab. This function uses the original keybinding for the TAB key when it is used (e.g. c-indent-line). If this does not change the position of the point, an attempt is made to position the point under the next 'interesting' point in the first non-blank line above the current line. An interesting point is a start of a new column (signified by multiple whitespace), a ':' or a '='. If no interesting point is found, a tab-to-tab-stop is performed. This sounds weird but it is of good use if one wants to line up declarations like: VeryLongTypeName VeryLongVariableName = VERY_LONG_CONSTANT; int Count = 0; char * Str = (char *)NULL; A single TAB is required between ('int' - 'Count'), ('Count' - '=') etc. To add this feature to your favourite major mode (e.g. c-mode), put this file in your load path, compile it and place this in your .emacs: (autoload 'dwimtab-tab "dwimtab") (add-hook 'c-mode-hook (lambda () (define-key c-mode-map "\t" 'dwimtab-tab)))