emacs-devel
[Top][All Lists]
Advanced

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

Re: Variable-width font indentation


From: Eli Zaretskii
Subject: Re: Variable-width font indentation
Date: Wed, 07 Mar 2018 22:09:54 +0200

> Cc: address@hidden, address@hidden
> From: Clément Pit-Claudel <address@hidden>
> Date: Wed, 7 Mar 2018 13:27:35 -0500
> 
> > Not AFAIU, no.  It is an implementation of a different indentation
> > method.  I don't see why we should want to go that way, since there's
> > nothing wrong with the existing algorithm, except for handling of
> > variable-pitch fonts.
> 
> Can you clarify what you call an indentation method? I think that's the 
> source of my confusion.
> I wouldn't call what I wrote an indentation method.  Maybe I'm not 
> understanding you because of that?

I feel that we are somehow bogged down in a miscommunication from
which I see no way out...

An "indentation method" is a method used to determine the indentation
of a line and to insert whitespace in order to achieve that
indentation.

> >> In your world, concretely, what happens when I open xdisp.c and press M-x 
> >> variable-pitch-mode? Does everything look misaligned until I M-x 
> >> indent-region the whole file?
> > 
> > Yes.  It isn't different from what happens when you change tab-width.
> 
> But changing tab-width doesn't change the contents of the buffer, whereas 
> what you're advocating for does, right?

No, it doesn't.  I'm advocating a way of changing the width of
whitespace characters on display to account for variable-pitch font,
not any change in the buffer.

> Maybe I just don't understand what you're advocating for.  AFAIU, you're 
> suggesting that we should teach indentation methods about variable-pitch 
> fonts, so that they indent text to a particular pixel offset instead of a 
> particular column.  Is that correct?

Yes, correct.

> If it is correct, then it solves a problem that's different from the one I 
> was thinking in, which is to display existing code with a variable pitch 
> font, without the indentation function.

We cannot possibly DTRT with indentation without an indentation
function.

> * What happens in major modes that don't provide indentation support?

The same as what happens today: the default functions are invoked.

> * What happens in indentation-sensitive languages (Python, F#, Haskell, etc)?

Same as today (the buffer contents will not change from what it is
today).

> * What happens in comments?

Nothing special.

> * Do I need to call M-x indent-region every time I switch between 
> variable-pitch and fixed-pitch?

Not necessarily, not if the idea of controlling the SPC width is
workable.  If it is, then the mode will simply set the value of two
buffer-local variables, calculating them from the font in use.

> * If I close and reopen a file in variable-pitch mode, do I need to re-run 
> M-x indent-region?

See above.

> * In variable-pitch mode, what gets saved to disk after I run M-x 
> indent-region?

Same as what we have now.



reply via email to

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