emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacs Lisp manual issues regarding overlays, display properties, mar


From: Joe Wells
Subject: Re: Emacs Lisp manual issues regarding overlays, display properties, margins, etc.
Date: Tue, 02 Oct 2007 17:23:54 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Richard Stallman <address@hidden> writes:

> There seems to be something totally fishy with the way margin display
> properties work:
>
>       (test-overlays
>        (insert "ABC")
>        (let ((o1 (make-overlay 2 3)))
>        (overlay-put o1 'display '((margin left-margin) "Z")))
>        (set-window-margins (get-buffer-window (current-buffer)) 8))
>
> this causes Z to appear in the margin and causes B not to appear
> in the body of the text.
>
> That seems like a bug to me.  It seems to me that a property that puts
> something in the margin should not alter the appearance of the text
> it is on.

It seems to follow the definition though.  The current definition
seems to be that a display spec of the form ((margin MARGIN) SPEC)
works when SPEC is a display spec that causes something to be
displayed instead of the text that has the display property and the
(margin MARGIN) part acts as a modifier that additionally moves the
replacement material into the margin.

The documentation of margin display spec modifiers is a bit confusing.

> Does anyone think the current behavior is desirable?

I find the current definition of the margin display spec modifier
awkward.  I think part of the reason for the way the current margin
modifier definition is designed is that (image ...) display specs are
not strings and thus can not have display properties of their own.
Also, the only current way to display an image is to have it _replace_
characters (at least one) in a string or in the buffer.

Maybe there should be a margin property (distinct from the current
margin display spec) which specifies material to go in the margin
(like the way the overlay before-string property works).

-- 
Joe

P.S.  For people who want to try the sexp above, the test-overlays
macro is this:

  (defmacro test-overlays (&rest body)
    `(let ((buf (get-buffer-create "xyzzy")))
      (with-current-buffer buf
        (display-buffer buf)
        (erase-buffer)
        (dolist (o (overlays-in (point-min) (point-max)))
          (delete-overlay o))
        ,@body)))




reply via email to

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