unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Phil Sainty <psainty@orcon.net.nz>
To: Juri Linkov <juri@linkov.net>
Cc: Michael Heerdegen <michael_heerdegen@web.de>, 55828@debbugs.gnu.org
Subject: bug#55828: Add command to edit a rectangle arbitrarily in a separate buffer
Date: Wed, 08 Jun 2022 21:57:52 +1200	[thread overview]
Message-ID: <df77b9fdc10b7b0048b428e704007835@webmail.orcon.net.nz> (raw)
In-Reply-To: <868rq7myfs.fsf@mail.linkov.net>

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






  reply	other threads:[~2022-06-08  9:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07  9:24 bug#55828: Add command to edit a rectangle arbitrarily in a separate buffer Phil Sainty
2022-06-08  6:58 ` Juri Linkov
2022-06-08  9:57   ` Phil Sainty [this message]
2022-06-08 16:18     ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=df77b9fdc10b7b0048b428e704007835@webmail.orcon.net.nz \
    --to=psainty@orcon.net.nz \
    --cc=55828@debbugs.gnu.org \
    --cc=juri@linkov.net \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).