[Top][All Lists]

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

Re: Line height issues with display-line-number-mode

From: Kévin Le Gouguec
Subject: Re: Line height issues with display-line-number-mode
Date: Fri, 10 May 2019 08:15:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

> Maybe we should simply add a feature that would allow display of a
> thin line across the window.  Then all of the problems we discussed
> will just go away.

There does seem to several use-cases for this feature (in addition to
Clément's), where it is emulated in various ways each, having its own

I don't think I saw a post in this thread cataloguing all of these
methods (though most of them have been mentioned), so for the record, if
it helps anyone:

- describe-symbol

    (insert "\n\n"
              (propertize "\n" 'face '(:height 0.1 :inverse-video t)))

- custom-group-value-create

    ;; Draw a horizontal line (this works for both graphical
    ;; and text displays):
    (let ((p (point)))
      (insert "\n")
      (put-text-property p (1+ p) 'face '(:underline t))
      (overlay-put (make-overlay p (1+ p))
                   (propertize "\n" 'face '(:underline t)
                               'display '(space :align-to 999))))

- log-edit-font-lock-keywords

    (0 '(:height 0.1 :inverse-video t))


- magit-blame--format-separator

    (concat (propertize "\s" 'display '(space :height (2)))
            (propertize "\n" 'line-height t))

- transient--show

    (insert (propertize "__" 'face 'transient-separator
                        'display '(space :height (1))))
    (insert (propertize "\n" 'face 'transient-separator 'line-height t)))

- page-break-lines.el

    (let ((default-height (face-attribute 'default :height nil 'default)))
      (set-face-attribute 'page-break-lines nil :height default-height)
      (let* ((cwidth (char-width page-break-lines-char))
             (wwidth-pix (- (window-width nil t)
                            (if (bound-and-true-p display-line-numbers)
                                (line-number-display-width t)
             (width (- (/ wwidth-pix (frame-char-width) cwidth)
                       (if (display-graphic-p) 0 1)))
             (glyph (make-glyph-code page-break-lines-char 'page-break-lines))
             (new-display-entry (vconcat (make-list width glyph))))
        (unless (equal new-display-entry (elt buffer-display-table ?\^L))
          (aset buffer-display-table ?\^L new-display-entry))))

- form-feed.el

(The latter two are both packages for displaying ^L as thin lines; I
wasn't sure which sections of form-feed would be relevant to include.)

FWIW, page-break-lines does seem to behave correctly when
display-line-numbers is enabled; not sure how applicable its method is
in the general case.

reply via email to

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