help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Insert appropriate line-end character (like ';' for C*)


From: David Hansen
Subject: Re: Insert appropriate line-end character (like ';' for C*)
Date: Wed, 11 Jun 2008 06:17:31 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux)

On Tue, 10 Jun 2008 15:11:07 -0700 (PDT) Josh <address@hidden> wrote:

> I think I've seen this behavior in Emacs somewhere, but I can't
> remember where and I'm either using the wrong terms when searching or
> I'm looking in the wrong places because I can't find anything about
> it. What I'm looking for is a emacs command that inserts the
> appropriate end-of-line character based on mode. For example, if
> you're in c-mode or java-mode or whatever it would insert a ';'.
>
> Ideally it would be context aware so that if you were in python-mode
> it would add a ':' where appropriate, but not elsewhere (and even a
> ',' if you're making a list), but that's not essential.
>
> Does this already exist? If not, does anyone have any pointers on how
> I could go about writing it? The only part I can't figure out is how
> to determine what the right character is.

`;' is not a "line-end" character in C but a "end-of-statement"
character.  Not even a full featured C parser can know if you want to
continue the statement on the next line or not:

foo = bar () 
        && baz ();

David





reply via email to

[Prev in Thread] Current Thread [Next in Thread]