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

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

Re: Indenting Emacs Lisp only with tabs?


From: Oliver Scholz
Subject: Re: Indenting Emacs Lisp only with tabs?
Date: Wed, 02 Sep 2009 19:19:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Helmut Eller <eller.helmut@gmail.com> writes:

> * Elena [2009-09-02 15:11+0200] writes:
>
>> On 2 Set, 12:56, Peter Dyballa <Peter_Dyba...@Web.DE> wrote:
>>> Am 02.09.2009 um 12:38 schrieb Elena:
>>>
>>> > I'd like to use a proportional font, but that messes up indentation.
>>>
>>> That's the trouble with proportional fonts...
>>
>> Well, that's a trouble with editors - like Emacs - where you can't
>> move characters with pixel precision.
>
> To me it seems more like a limitation of text files.
>
>> However, if the indenting function does not try to overcome editor's
>> limitations by adding spaces to line things up, tabs work quite well.
>
> You can set tab-width to 1 and the indent function will only insert
> tabs.  It's more common though, to not use tabs at all by disabling
> indent-tab-mode.

Not a good idea, though, if anybody else (including a future self which
uses a different editor) is ever supposed to read that code.

> However, the indent function doesn't control how existing files are
> displayed and that's the trouble with proportional fonts: code that uses
> tabs and spaces looks messed up.

I actually thought about this some time ago. I believe it would be
possible, not really complicated even, to fix this. Emacs could simply
put a display property with the value

`(space :align-to <number of whitespace chars from line beginning to first 
non-whitespace>)

on the leading space or tab characters on each line. And there you go:
proportional fonts with flawless indentation.

The only complication would be that font-lock does not naturally handle
the `display' property; but if my memory serves well, all the necessary
mechanics are in place and this would only be a minor obstacle.


    Oliver
-- 
16 Fructidor an 217 de la Révolution
Liberté, Egalité, Fraternité!


reply via email to

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