emacs-devel
[Top][All Lists]
Advanced

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

Re: Variable-width font indentation


From: Clément Pit-Claudel
Subject: Re: Variable-width font indentation
Date: Mon, 5 Mar 2018 20:06:17 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 2018-03-05 17:30, Paul Eggert wrote:
> On 03/05/2018 12:28 PM, Clément Pit-Claudel wrote:
>> Applying this strategy to all lines doesn't work, unfortunately: it
>> indents the `pr ()' and `printf (' lines differently, because the
>> `in' of `int main' and the `vo' of `void' occupy different widths.
> 
> True, but that's a feature not a defect. The code is easier to read
> if every region is indented individually, as opposed to using exactly
> the same indenting everywhere in the buffer.

Hmm.  I hadn't thought of this :)  But I'm not entirely convinced yet.  
Consider this snippet:

def x():
    with open("A") as f:
        while y:
            print(y.v())

or this one in elisp:

(when x
  (if y t
    (unless p
      (cl-loop for x in y
               collect x)))) 

In variable-pitch mode, each new indentation level has a slightly-different 
width, instead of a regular progression of 4 spaces (in Python) and 2 spaces 
(in Elisp) at each level.

Beyond this, there's the problem of inline line-up spaces.  For an example, 
consider this, from xdisp.c, which shows "line-up" spaces in full glory:


   +--------------+   redisplay     +----------------+
   | Lisp machine |---------------->| Redisplay code |<--+
   +--------------+   (xdisp.c)     +----------------+   |
          ^                                  |           |
          +----------------------------------+           |
            Block input to prevent this when             |
            called asynchronously!                       |
                                                         |
                    note_mouse_highlight (asynchronous)  |
                                                         |
                                    X mouse events  -----+
                                                         |
                            expose_frame (asynchronous)  |
                                                         |
                                   X expose events  -----+

The same problem pops up with org-mode tables, etc.

Clément.



reply via email to

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