[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/olivetti d40a054 126/134: Fixed olivetti-scale-width fo
From: |
Stefan Monnier |
Subject: |
[elpa] externals/olivetti d40a054 126/134: Fixed olivetti-scale-width for integer heights |
Date: |
Thu, 25 Apr 2019 09:57:43 -0400 (EDT) |
branch: externals/olivetti
commit d40a054420eb0a656732f6b92f52c3ad50860da6
Author: Niels uit de Bos <address@hidden>
Commit: Niels uit de Bos <address@hidden>
Fixed olivetti-scale-width for integer heights
The function `olivetti-scale-width` incorrectly assumes that the height is
always a fraction. However, it can in very normal circumstances be an
integer
such as 120 (see section 39.12.1 from the manual
(https://www.gnu.org/software/emacs/manual/html_node/elisp/Face-Attributes.html)).
In such a case, the old function scales the width by a number that is far
too
large, which results in margins of width 0.
To see how this fails, set the height to something like 120 by using, for
example, buffer-face-mode.
I fixed this by scaling by height/100 if the height is an integer. If it is
a
float or something else entirely, the new function behaves as the old.
---
olivetti.el | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/olivetti.el b/olivetti.el
index 0998e80..16c177f 100644
--- a/olivetti.el
+++ b/olivetti.el
@@ -275,11 +275,15 @@ instead `olivetti-set-mode-line'."
For compatibility with `text-scale-mode', if
`face-remapping-alist' includes a :height property on the default
-face, scale N by that factor, otherwise scale by 1."
- (* n (or (plist-get (cadr (assq 'default
- face-remapping-alist))
- :height)
- 1)))
+face, scale N by that factor if it is a fraction, by (height/100)
+if it is an integer, and otherwise scale by 1."
+ (let
+ ((height (plist-get (cadr (assq 'default face-remapping-alist))
:height)))
+ (cond
+ ((integerp height) (* n (/ height 100.0)))
+ ((floatp height) (* n height))
+ (t n))))
+
(defun olivetti-safe-width (width window)
"Parse WIDTH to a safe value for `olivetti-body-width' for WINDOW.
- [elpa] externals/olivetti c516083 120/134: Merge pull request #21 from smythp/master, (continued)
- [elpa] externals/olivetti c516083 120/134: Merge pull request #21 from smythp/master, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 0227265 125/134: Update package version number, and text keyword, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 46fdcfe 134/134: Assign copyright to Free Software Foundation, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti a7f6477 118/134: Add LICENSE.txt, remove README license badge, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 18a9a8e 071/134: Use min-margins instead of split-window-right-force, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 050815f 113/134: Use internal rounding for olivetti-safe-width, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti da7955a 088/134: Added TODO.md, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 914af43 096/134: Update copyright year to add 2017, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti e824a21 106/134: Remove disparaging remarks about display-line-numbers-mode, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti da1ef8e 114/134: Improving olivetti-safe-width, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti d40a054 126/134: Fixed olivetti-scale-width for integer heights,
Stefan Monnier <=
- [elpa] externals/olivetti 2ae21fa 128/134: Remove redundant turn-on-olivetti-mode function, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 7c4410f 133/134: Rename olivetti-set-environment -> olivetti-set-margins, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 40c64f9 131/134: Remove window-configuration-change-hook, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 26f3db0 050/134: Updated README/Commentary, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 66bdcc7 057/134: lexical-binding: t, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti f53b5f4 062/134: Added mode-map, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti ce4c9f0 068/134: Document split-window-right workaround, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 9d318be 069/134: Added README to Commentary, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti d2c54ac 072/134: Add change-major-mode-hook to reset margins, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 5ac4444 085/134: Use GitHub repo screenshot, Stefan Monnier, 2019/04/25