Emacs Line Height

I am trying to set the height of a line of text in an Emacs buffer so that there is space above and below the letters. From the documentation, I conclude that a text property line-heightcan help me with this.

There is also a variable line-spacingthat I can set as (setq-default line-spacing 0.25). This type of work, except that it does not create a space before the text, only after it. I don’t like how it looks when using such modes as show-paren-mode, as it “falls” down:

Unwanted current behavior ("freeze")

Undesired current behavior

Layout of desired behavior (vertically centered)

Desired behavior

I would like to center the text.

I found that I can temporarily get the desired effect with the following code:

(add-text-properties (point-min) (point-max)
                     '(line-spacing 0.25 line-height 1.25))

, . ? ( .)

+7
3

, line-height ( ). .

(setq-default line-spacing 20).

line-spacing - . , . , (32 64).


Emacs , . :

On text terminals, the line spacing cannot be altered.
+4

TL;DR: - :

;; Set the padding between lines
(defvar line-padding 3)
(defun add-line-padding ()
  "Add extra padding between lines"

  ; remove padding overlays if they already exist
  (let ((overlays (overlays-at (point-min))))
    (while overlays
      (let ((overlay (car overlays)))
        (if (overlay-get overlay 'is-padding-overlay)
            (delete-overlay overlay)))
      (setq overlays (cdr overlays))))

  ; add a new padding overlay
  (let ((padding-overlay (make-overlay (point-min) (point-max))))
    (overlay-put padding-overlay 'is-padding-overlay t)
    (overlay-put padding-overlay 'line-spacing (* .1 line-padding))
    (overlay-put padding-overlay 'line-height (+ 1 (* .1 line-padding))))
  (setq mark-active nil))


(add-hook 'buffer-list-update-hook 'add-line-padding)

line-padding .

, , .

, ( /).

buffer-list-update-hook , , , , .

, , , .

+2

Try "Help => More Guides => Emacs Lisp Link" and enter from there i text properties RET. This, I hope, will clarify the situation. As for your specific request, I don't think there is an easy way to get what you want right now. You may like M-x report-emacs-bugthe appearance of the highlight highlight.

+1
source

All Articles