[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
(with-temp-buffer
(insert (mapconcat 'identity '("john" "improved" "rectangle" "editing"
"capabilities" "of" "emacs") "\n"))
(goto-char 4) ; joh_n
(rectangle-mark-mode)
(end-of-line 5) ; capabilities_
(with-current-buffer (edit-rectangle (mark) (point))
(restore-rectangle))
(buffer-string)))
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...)
Alain
- Re: proposal: edit-rectangle, (continued)
- Re: proposal: edit-rectangle, Thierry Volpiatto, 2016/10/06
- Re: proposal: edit-rectangle, Thierry Volpiatto, 2016/10/06
- Re: proposal: edit-rectangle, Dmitri Paduchikh, 2016/10/06
- Re: proposal: edit-rectangle, John Mastro, 2016/10/06
- Re: proposal: edit-rectangle, Alain Schneble, 2016/10/06
- Re: proposal: edit-rectangle, Stefan Monnier, 2016/10/06
- Re: proposal: edit-rectangle,
Alain Schneble <=