Skip to content

Comments

fix: Handle cons cell value for line-spacing#269

Merged
dgutov merged 1 commit intodgutov:masterfrom
prashantvithani:master
Feb 8, 2026
Merged

fix: Handle cons cell value for line-spacing#269
dgutov merged 1 commit intodgutov:masterfrom
prashantvithani:master

Conversation

@prashantvithani
Copy link
Contributor

@prashantvithani prashantvithani commented Feb 4, 2026

The line-spacing variable can be a cons cell from Emacs 31, such
as (0.1 . 0.1), in addition to a plain number. Each value in this cons
is spacing above and below the line. The correct value of line-spacing
would be to use total-line-spacing instead of raw value.

The previous code did not handle the cons cell format, leading to a
wrong-type-argument error. For backward compatibility, this change
inlines the definition of total-line-spacing i.e. sums the above and
below spacing in case if it's cons.

@prashantvithani prashantvithani force-pushed the master branch 2 times, most recently from 2ea52af to f423692 Compare February 4, 2026 13:32
@dgutov
Copy link
Owner

dgutov commented Feb 5, 2026

Hi! This is a new feature and the function total-line-spacing is similarly new. But diff-hl aims to support Emacs back until 26.1.

It would be better to inline the definition.

The `line-spacing` variable can be a [cons cell][1] from Emacs 31, such
as `(0.1 . 0.1)`, in addition to a plain number. Each value in this cons
is spacing above and below the line. The correct value of line-spacing
would be to use [`total-line-spacing`][1] instead of raw value.

The previous code did not handle the cons cell format, leading to a
`wrong-type-argument` error. For backward compatibility, this change
inlines the definition of `total-line-spacing` i.e. sums the above and
below spacing in case if it's cons.

[1]: emacs-mirror/emacs@e8f26d5
@prashantvithani
Copy link
Contributor Author

Inlined the definition. Thanks for the suggestion.

@dgutov dgutov merged commit 3eefe68 into dgutov:master Feb 8, 2026
8 checks passed
@dgutov
Copy link
Owner

dgutov commented Feb 8, 2026

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants