bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#11068: 24.0.94; Face-remapped background does not extend to end of w


From: martin rudalics
Subject: bug#11068: 24.0.94; Face-remapped background does not extend to end of window
Date: Fri, 30 Mar 2012 09:35:20 +0200

> ... By putting the
> integer property on the string itself, you allow the
> cursor-positioning code to find out how many buffer positions are
> covered by the overlay string, without knowing what overlay is that.
>
>>       "this way,
>>       Emacs will display the cursor on the character with that property
>>       regardless of whether the current buffer position is actually
>>       covered by the overlay."
>>
>> doesn't make it clearer for me because what is "the character with that
>> property" and what is "the current buffer position" here?
>
> "the character" is the one from the overlay string on which you put
> the `cursor' property; "current buffer position" is point (which
> normally determines where to display the cursor).

I still don't get it.  Suppose I have the following code in a buffer, no
spaces before the first visible character, one newline after the last:


(defvar my-overlay nil)
(defvar my-string nil)

(progn
  (when (overlayp my-overlay)
    (delete-overlay my-overlay))
  (setq my-overlay (make-overlay 0 0))
  (setq my-string
        (propertize "      " 'face 'lazy-highlight 'cursor 1))
  (overlay-put my-overlay 'display my-string)
  (move-overlay my-overlay (- (point-max) 1) (point-max)))


Evaluating this and moving `point' between buffer positions 336 and 337
oscillates the cursor around the overlay.  If I instead use the line

        (propertize "      " 'face 'lazy-highlight 'cursor 2))

in the above and reevaluate, moving `point' doesn't oscillate the cursor
any more.  But if I additionally replace the last line as

  (move-overlay my-overlay (- (point-max) 2) (point-max)))

the cursor oscillates again (but now between positions 335 and 337).

I find the behavior good but am too silly to understand what's going on.
What do I really specify when I write a form like

        (propertize "      " 'face 'lazy-highlight 'cursor 1))

Apparently the "1" doesn't refer to a position within the "      " but
to some position within the buffer from (- (point-max) 1) (point-max))
where that string is eventually placed by the overlay movement.

So apparently that specification neither serves to

(1) move the cursor visually to some position within the string (it
always remains before or after it), nor to

(2) move `point' to some position within the buffer (it's always at the
start and end positions of the overlay).

But what does it do?

> You can see
> this feature in action in cua-rectangle; after you play with it,
> perhaps you could suggest how to improve the documentation.

IIUC in the Emacs sources the 'cursor property is never used in
connection with overlays.

martin





reply via email to

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