all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
Subject: rectangle operations - narrowing?
Date: Sat, 8 Jul 2006 11:34:22 -0700	[thread overview]
Message-ID: <MEEKKIABFKKDFJMPIOEBMEPIDCAA.drew.adams@oracle.com> (raw)

I was thinking of perhaps doing some stuff on rectangular areas of text
(e.g. columns of text) - in particular, searching over them, and I'd like to
know what, if anything already exists for this, before I start trying to
roll my own. I looked at the Emacs manual Rectangles stuff and library
rect.el, but I didn't notice what I'm looking for.

I also looked briefly in ses.el and went through the SES Info manual. SES
lets you do things like insert and delete columns and cut and paste
rectangular areas, but I didn't see what I'm looking for there either.

What I'd like to do, to start with, is, in effect, "narrow" to a region that
has the content of a given rectangle of text. The idea would be to operate
on this region in some way, and then widen again - in effect putting the
(possibly modified) rectangle back in context. Any modifications could be
considered to be limited to the rectangle boundaries, so, for example, any
insertion of text would make text overflow out of the rectangle at the right
(and be lost).

I mostly want to do things with the rectangle that don't modify the text. A
good example would be to search over text within a rectangle (only). The
search might, in effect, need to "narrow" to the rectangle and then "widen"
afterward, but the user might not see any narrowing. An isearch that is
limited to a rectangle could be useful in some contexts.

Think of tabular data, such as Dired, and searching within only a certain
column of text. Likewise query-replace and other operations. (This wouldn't
be very useful for Dired itself, because the columns have such dissimilar
data - regular search is fine. But some tabular data has similar data in
different columns, and it can useful to restrict the search.)

I could, I guess, use extract-rectangle to grab a rectangle's strings, put
those in another, empty buffer, operate on the text there (simulating
"narrowing"), and then track back to the original buffer. Or, for
modification, I could use kill-rectangle, change the rectangle (e.g. apply
an overlay, for searching), then yank-rectangle. Alternatively, some things
could be done via apply-on-rectangle, and even sort(-regexp)-fields, but I
don't think they would help with, say, isearch over a rectangle.

I was hoping there would already exist some analogous functions, for
rectangles, to `narrow-to-region', `widen', and `save-restriction', but I
guess not.

How would you approach this - any ideas or pointers? Thx.

             reply	other threads:[~2006-07-08 18:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-08 18:34 Drew Adams [this message]
2006-07-09 14:12 ` rectangle operations - narrowing? Richard Stallman
2006-07-09 15:49   ` Drew Adams
2006-07-10  8:40 ` Klaus Zeitler
2006-07-10 13:29   ` Drew Adams
2006-07-10 17:15     ` Ken Manheimer
2006-07-10 17:50       ` Drew Adams

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

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

  git send-email \
    --in-reply-to=MEEKKIABFKKDFJMPIOEBMEPIDCAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.