emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: syntax for ?= in sh-mode


From: Stefan Monnier
Subject: Re: syntax for ?= in sh-mode
Date: Tue, 21 Sep 2004 16:46:50 -0400
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux)

>> > I guess that's an improvement, but I am not sure it is
>> > a very useful one.  I would encourage people to write these
>> > things with parentheses for increased clarity anyway,
>> > and with the parentheses, Emacs will indent correctly now.
>> 
>> Well, but it applies at many more places than just arithmetic.
>> E.g. the `,' that separates arguments in so many languages can be treated
>> similarly, so that C-M-t properly transposes two arguments.
>> Placing parentheses there would be excruciating.

> It sounds very nice actually; sometimes adding parentheses is the right thing
> to do, but other times it's not, and I often feel annoyed that I'm force to
> add otherwise unwanted parentheses just get emacs to indent correctly.
> Improvements in expression manipulation also seem verty handy.

The indentation part is rarely a problem (in most cases, the indentation
code is already hairy and adding cases to deal with it is "natural"), but
the C-M-f and C-M-t aspect is very nice.

Now, to be honest, it has a fairly serious fundamental problem:
say you're at the beginning of the following expression:

    a * b + c * d, e

where should C-M-f go?  Only the user knows what he wants and it's pretty
difficult to see how he could tell us (the best I can think of is
something like C-u + C-M-f to jump over an expression "of a precedence
higher than +", but that's pretty heavyweight.  I wonder what
syntax-directed editors do here).
With the current Emacs code, successive C-M-f get you to:

    a * b + c * d, e * f, g * h
     ^   ^   ^   ^  ^   ^  ^   ^

In sml-mode, successive C-M-f do the following:

    a * b + c * d, e * f, g * h
     ^   ^       ^      ^      ^


-- Stefan




reply via email to

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