unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: Emacs Lisp manual issues regarding overlays, display properties, margins, etc.
       [not found] <86d4w2y1ej.fsf@macs.hw.ac.uk>
@ 2007-10-02 15:29 ` Richard Stallman
  2007-10-02 16:07   ` Johan Bockgård
  2007-10-02 16:23   ` Joe Wells
  0 siblings, 2 replies; 6+ messages in thread
From: Richard Stallman @ 2007-10-02 15:29 UTC (permalink / raw)
  To: Joe Wells; +Cc: emacs-devel

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.

Does anyone think the current behavior is desirable?

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

* Re: Emacs Lisp manual issues regarding overlays, display properties, margins, etc.
  2007-10-02 15:29 ` Emacs Lisp manual issues regarding overlays, display properties, margins, etc Richard Stallman
@ 2007-10-02 16:07   ` Johan Bockgård
  2007-10-08 18:04     ` Richard Stallman
  2007-10-02 16:23   ` Joe Wells
  1 sibling, 1 reply; 6+ messages in thread
From: Johan Bockgård @ 2007-10-02 16:07 UTC (permalink / raw)
  To: emacs-devel

Richard Stallman <rms@gnu.org> 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.
>
> Does anyone think the current behavior is desirable?

In any case, it follows the documentation

    If you put such a display specification directly on text in the
    buffer, the specified margin display appears _instead of_ that
    buffer text itself. To put something in the margin _in association
    with_ certain buffer text without preventing or altering the display
    of that text, put a `before-string' property on the text and put the
    display specification on the contents of the before-string.

(info "(elisp)Display Margins")

-- 
Johan Bockgård

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

* Re: Emacs Lisp manual issues regarding overlays, display properties, margins, etc.
  2007-10-02 15:29 ` Emacs Lisp manual issues regarding overlays, display properties, margins, etc Richard Stallman
  2007-10-02 16:07   ` Johan Bockgård
@ 2007-10-02 16:23   ` Joe Wells
  2007-10-02 19:20     ` Stefan Monnier
  1 sibling, 1 reply; 6+ messages in thread
From: Joe Wells @ 2007-10-02 16:23 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Richard Stallman <rms@gnu.org> 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)))

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

* Re: Emacs Lisp manual issues regarding overlays, display properties, margins, etc.
  2007-10-02 16:23   ` Joe Wells
@ 2007-10-02 19:20     ` Stefan Monnier
  2007-10-03 18:38       ` Richard Stallman
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2007-10-02 19:20 UTC (permalink / raw)
  To: Joe Wells; +Cc: rms, emacs-devel

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

IIRC Gerd decided to use a single property `display' rather than several
properties, for reasons of performance.  I do not know or remember what was
the particular performance issue(s), tho,


        Stefan

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

* Re: Emacs Lisp manual issues regarding overlays, display properties, margins, etc.
  2007-10-02 19:20     ` Stefan Monnier
@ 2007-10-03 18:38       ` Richard Stallman
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2007-10-03 18:38 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: jbw, emacs-devel

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

    IIRC Gerd decided to use a single property `display' rather than several
    properties, for reasons of performance.  I do not know or remember what was
    the particular performance issue(s), tho,

That is true, but we COULD have another kind of `margin' display spec
which works like `before-string'.  It would be more logical.  So I
wonder why it was not done that way.  Maybe there was a reason.

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

* Re: Emacs Lisp manual issues regarding overlays, display properties, margins, etc.
  2007-10-02 16:07   ` Johan Bockgård
@ 2007-10-08 18:04     ` Richard Stallman
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2007-10-08 18:04 UTC (permalink / raw)
  To: Johan Bockgård; +Cc: emacs-devel

    > 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.
    >
    > Does anyone think the current behavior is desirable?

    In any case, it follows the documentation

Two parts of the Lisp manual seem to conflict with each other.  It
would be straightforward to fix the one that doesn't agree with the
code.  I will do that.  But is there a good reason for the current
behavior?

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

We don't want to make another property, because each kind of property
that display needs to check for slows it down.

But we could make another kind of margin display specification
that combines the effect of before-string and margin.
That would do what users would naturally expect.

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

end of thread, other threads:[~2007-10-08 18:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <86d4w2y1ej.fsf@macs.hw.ac.uk>
2007-10-02 15:29 ` Emacs Lisp manual issues regarding overlays, display properties, margins, etc Richard Stallman
2007-10-02 16:07   ` Johan Bockgård
2007-10-08 18:04     ` Richard Stallman
2007-10-02 16:23   ` Joe Wells
2007-10-02 19:20     ` Stefan Monnier
2007-10-03 18:38       ` Richard Stallman

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