all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* rectangle operations - narrowing?
@ 2006-07-08 18:34 Drew Adams
  2006-07-09 14:12 ` Richard Stallman
  2006-07-10  8:40 ` Klaus Zeitler
  0 siblings, 2 replies; 7+ messages in thread
From: Drew Adams @ 2006-07-08 18:34 UTC (permalink / 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-07-10 17:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-08 18:34 rectangle operations - narrowing? Drew Adams
2006-07-09 14:12 ` 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

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.