[Top][All Lists]

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

Re: proposal: edit-rectangle

From: Alain Schneble
Subject: Re: proposal: edit-rectangle
Date: Thu, 6 Oct 2016 23:42:34 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (windows-nt)

John Wiegley <address@hidden> writes:

> This is functionality I'd like to add to rect.el. It allows you to specify a
> rectangular region, and then edit just the contents of that rectangle in a
> separate buffer. When finished (C-c C-c), it replaces the old rectangle using
> insert-rectangle with the new contents.
> I'd appreciate comments on usability, fitness, etc.

There's an edge-case when editing rectangular areas spawning beyond end
of lines.  In this situation 'edit-rectangle' followed by
'restore-rectangle' changes the selected area even though no explicit
changes have been committed to that area.  There are phantom whitespace
characters added to some lines.

This is a simple recipe:

   (insert (mapconcat 'identity '("john" "improved" "rectangle" "editing" 
"capabilities" "of" "emacs") "\n"))
   (goto-char 4) ; joh_n
   (end-of-line 5) ; capabilities_
   (with-current-buffer (edit-rectangle (mark) (point))

I know it's kind of inherent to fill lines with spaces where needed to
get a rectangular area.  But in this round-trip scenario, it feels not
natural to me.  Not sure if this can be considered a bug though.

(Strangely, in my Emacs it fills some lines with tabs AND spaces.  Not
sure where the tabs come from...)


reply via email to

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