[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#55828: Add command to edit a rectangle arbitrarily in a separate buf
From: |
Phil Sainty |
Subject: |
bug#55828: Add command to edit a rectangle arbitrarily in a separate buffer |
Date: |
Wed, 08 Jun 2022 21:57:52 +1200 |
User-agent: |
Orcon Webmail |
On 2022-06-08 18:58, Juri Linkov wrote:
As Michael pointed out, it could be based on string-edit,
Perhaps. I just compiled from master to have a look at this,
and I don't know whether that's an obvious way to go. I'm not
seeing a particularly nice way to pass the information about the
source of the rectangle through to the success callback, unless
that function was a closure generated at call time, or the data
was passed as text properties, both of which seem a bit ugly to
me in this scenario (the latter more so than the former, but
neither feels ideal).
Perhaps `string-edit' is missing a `data' argument to be passed
along to the callback functions?
There's also no obvious facility for preparing the edit buffer.
In my command I'm setting the syntax-table to match the original
buffer, and setting fill-column to the rectangle width, both of
which seem like sensible things for the purpose at hand; but
there's no way of doing such things with `string-edit' other
than `string-edit-mode-hook' which I think is going to be
awkward to deal with for such a purpose. I guess you can
let-bind the hook variable around the `string-edit' call to add
a set-up function, but it again feels like there should be a
nicer option.
It does provide some boilerplate, but I'm not sure it makes
sense to shoe-horn the rectangle command into that framework
in its current form. Maybe with some enhancements it makes
sense, though.
-Phil