emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: no good way to highlight rectangle while region is highlighted


From: Joe Wells
Subject: Re: no good way to highlight rectangle while region is highlighted
Date: Mon, 23 Jul 2007 08:46:31 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Richard Stallman <address@hidden> writes:

>     Summary of this message: This is a feature request for (1) the
>     possibility that some overlays can have priority over the use of the
>     region face, and/or (2) a variant of the ?box? face feature where the
>     vertical lines of the box take no extra space.
>
> (2) sounds terribly low-level.  (1) is cleaner.

I agree with you that it is low level.  At the same time, I think it
would make a far better user interface for highlighting the rectangle
I think the ease of the user seeing the rectangle would be much
better.  This is especially important if the rectangle is to be
highlighted at the same time as the region (see below for why this is
desirable).

I think it is worth pointing out (again) that the “box” feature of
faces _already_ supports having the _horizontal_ lines take no extra
space.  It is a bit strange that it supports this but does not support
having the _vertical_ lines take no extra space.

> I think (1) could be implemented with a change in face_at_buffer_position.
> For instance, we could define a certain priority for the region,
> so that overlays whose priority exceeds that cover the region.
> It doesn't look terribly hard, but you need to think carefully
> to prove that you store the value into *ENDPTR in all cases.

It would be lovely to be able to do (1), because that would allow
using background color to distinguish the rectangle while the region
is being shown.  (Note that parts of the rectangle can be outside the
region, so showing it with colors at the same time as the region is a
bit complicated.)

>     It contains some
>     code to make Emacs operations that normally operate on the region
>     switch between operating on the region and the rectangle.  When
>     operating on the region (in transient mark mode), the region is
>     highlighted.  When operating on the rectangle, the rectangle is
>     highlighted.
>
> If you only want to show the region OR a rectangle,
> why do you need any new display features?  You'd need a new
> feature only to show both at once.

You are correct.  I am not using sense-region.el as designed (see
below for why).  I am only using the code from sense-region that
highlights the rectangle.  Using some of the code in sense-region.el,
I am now showing both the region and rectangle at once.  But I am
currently using the stipple feature of faces for the rectangle, and as
a user interface it is visually not so good.

>     I ran into these problems in trying to highlight the
>     region and rectangle simultaneously:
>
> Why do you want to highlight them both simultaneously?

I think it is useful (and is the way Emacs has worked already for
decades) to have both rectangle and region commands available at all
times.  In this case, because Emacs doesn't know whether you are going
to use a region or rectangle command next, it is helpful to be able to
show them both.

I hope these comments are helpful.

-- 
Joe




reply via email to

[Prev in Thread] Current Thread [Next in Thread]