unofficial mirror of emacs-devel@gnu.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

* Re: rectangle operations - narrowing?
  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
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2006-07-09 14:12 UTC (permalink / raw)
  Cc: emacs-devel

    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.

Ordinary narrowing limits what redisplay includes.  But I think you
would want this new rectangle narrowing to have no effect on redisplay.
Right?

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

* RE: rectangle operations - narrowing?
  2006-07-09 14:12 ` Richard Stallman
@ 2006-07-09 15:49   ` Drew Adams
  0 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2006-07-09 15:49 UTC (permalink / raw)


        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.

    Ordinary narrowing limits what redisplay includes.  But I think you
    would want this new rectangle narrowing to have no effect on redisplay.
    Right?

No, I'd be fine if it worked exactly like narrowing, I think. If I narrow
interactively, then only the region is displayed (redisplay wipes out the
envelope outside the region). But if I do `save-restriction', narrow,
fiddle, then widen, the user never notices the temporary narrowing.

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

* Re: rectangle operations - narrowing?
  2006-07-08 18:34 rectangle operations - narrowing? Drew Adams
  2006-07-09 14:12 ` Richard Stallman
@ 2006-07-10  8:40 ` Klaus Zeitler
  2006-07-10 13:29   ` Drew Adams
  1 sibling, 1 reply; 7+ messages in thread
From: Klaus Zeitler @ 2006-07-10  8:40 UTC (permalink / raw)


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

Did you also look at cua-rect? A great package for dealing with rectangles.
Just for CUA's rectangle mode I tried to switch to cua-mode a while ago. For
those that don't like cua-mode (like me) there's cua-selection-mode which
comes a lot closer to what I want. I wish it'd be possible to use cua-rect
independent from cua.

Klaus

-- 
 ------------------------------------------
|  Klaus Zeitler      Lucent Technologies  |
|  Email:             kzeitler@lucent.com  |
 ------------------------------------------
---
I generally avoid temptation unless I can't resist it.  -- Mae West

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

* RE: rectangle operations - narrowing?
  2006-07-10  8:40 ` Klaus Zeitler
@ 2006-07-10 13:29   ` Drew Adams
  2006-07-10 17:15     ` Ken Manheimer
  0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2006-07-10 13:29 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.
    
    Did you also look at cua-rect?

I haven't yet, but I will. Thanks for mentioning it.

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

* Re: rectangle operations - narrowing?
  2006-07-10 13:29   ` Drew Adams
@ 2006-07-10 17:15     ` Ken Manheimer
  2006-07-10 17:50       ` Drew Adams
  0 siblings, 1 reply; 7+ messages in thread
From: Ken Manheimer @ 2006-07-10 17:15 UTC (permalink / raw)
  Cc: Emacs-Devel

there's a package, table.el, which does some stuff that's related,
though coming from a different direction.  it's concerned with
rectangular regions that are delineated by particular characters - but
it provides for things like auto-fill and motion commands that are
constrained to the bounds of those rectangles.

(i mention this in the hopes that there's some unification of effort
possible.  i am frustrated by the lack of control of the auto-fill in
table.el, for instance, and would love to have it and related
functionality generalized as you're suggesting, to generic emacs
operations confined to rectangular regions.  it's too hard to get the
current, specialized operations to do what i need.)

On 7/10/06, Drew Adams <drew.adams@oracle.com> wrote:
>         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.
>
>     Did you also look at cua-rect?
>
> I haven't yet, but I will. Thanks for mentioning it.
>
>
> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel
>


-- 
ken
ken.manheimer@gmail.com
http://myriadicity.net

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

* RE: rectangle operations - narrowing?
  2006-07-10 17:15     ` Ken Manheimer
@ 2006-07-10 17:50       ` Drew Adams
  0 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2006-07-10 17:50 UTC (permalink / raw)


    there's a package, table.el, which does some stuff that's related,
    though coming from a different direction.  it's concerned with
    rectangular regions that are delineated by particular characters - but
    it provides for things like auto-fill and motion commands that are
    constrained to the bounds of those rectangles.
    
    (i mention this in the hopes that there's some unification of effort
    possible.  i am frustrated by the lack of control of the auto-fill in
    table.el, for instance, and would love to have it and related
    functionality generalized as you're suggesting, to generic emacs
    operations confined to rectangular regions.  it's too hard to get the
    current, specialized operations to do what i need.)
    
Thanks, Ken. I'll take a look at that too.

^ 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 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).