emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] master 29d1c72: Introduce new value t for compilation-


From: Stefan Monnier
Subject: Re: [Emacs-diffs] master 29d1c72: Introduce new value t for compilation-context-lines to eliminate scrolling
Date: Tue, 27 Aug 2019 15:59:27 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Hi Alan,

> +(defvar compilation-dummy-string ">"
> +  "A string which is only a placeholder for compilation-margin-string.
> +It's actual value is never used, but must be one character long.")
> +(put-text-property 0 1 'display
> +                   `((margin left-margin) ,compilation-margin-string)
> +                   compilation-dummy-string)

I'd suggest you use a "compilation--" prefix here since this is supposed
to be internal, IIUC.

Also, I'd do it as

    (defvar compilation--dummy-string
      (propertize ">" 'display
                  `((margin left-margin) ,compilation-margin-string))
      "A string which is only a placeholder for `compilation-margin-string'.
    Its actual value is never used, but must be one character long.")

so you can M-C-x it without ill-effect [note I also fixed "It's" to
"Its" and added `...' around the var ref.  ]

> +(defun compilation-tear-down-arrow-spec-in-margin ()
> +  "Restore compilation-arrow-overlay to not using the margin, which is 
> removed."
> +  (overlay-put compilation-arrow-overlay 'before-string nil)
> +  (delete-overlay compilation-arrow-overlay)
> +  (setq compilation-arrow-overlay nil)

I think this `setq` loses the overlay and there's no code to reconstruct
it later on.

> +  (set-window-margins (selected-window) 0))

Of course, the main problem with this approach is that "margins don't
compose": any other package using the margins (e.g. (n)linum) will tend
to interfere with your own use.

> +  (with-selected-window w        ; So the later `goto-char' will work.

An alternative is to use `set-window-point` instead of `goto-char`.


        Stefan




reply via email to

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