[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/golden-ratio f5807212d3 88/95: Merge pull request #81 from
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/golden-ratio f5807212d3 88/95: Merge pull request #81 from wictory/pr_20190406 |
Date: |
Thu, 7 Sep 2023 22:02:16 -0400 (EDT) |
branch: elpa/golden-ratio
commit f5807212d3349c1065cfeebf3e895aebba862bbf
Merge: 9059e1d139 c5e916d238
Author: Roman Gonzalez <roman@users.noreply.github.com>
Commit: GitHub <noreply@github.com>
Merge pull request #81 from wictory/pr_20190406
Add fixed width feature
---
README.md | 15 +++++++++++++++
golden-ratio.el | 12 ++++++++++--
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 9a7b913bfb..1276fdba87 100644
--- a/README.md
+++ b/README.md
@@ -72,6 +72,21 @@ screens with a width ~100 columns wide.
golden-ratio-wide-adjust-factor .8)
```
+## Fixed width
+
+When working with files that are required to have a maximum line width or when
writing text it's
+sometimes good to have a fixed width on the window you are typing in. For
example when editing this
+files it's nice to set:
+```elisp
+(setq golden-ratio-max-width 100)
+```
+
+When I write I like to have two empty buffers on the side and set
+```elisp
+(setq golden-ratio-max-width 72)
+```
+to get a distraction free experience.
+
## Credits
Code inspired by ideas from [Tatsuhiro Ujihisa](http://twitter.com/ujm)
diff --git a/golden-ratio.el b/golden-ratio.el
index 728f480b35..0b6103e62b 100644
--- a/golden-ratio.el
+++ b/golden-ratio.el
@@ -80,6 +80,11 @@ will not cause the window to be resized to the golden ratio."
:group 'golden-ratio
:type 'boolean)
+(defcustom golden-ratio-max-width nil
+ "Set a maximum column width on the active window."
+ :group 'golden-ratio
+ :type 'integer)
+
(defcustom golden-ratio-exclude-buffer-regexp nil
"A list of regexp's used to match buffer names.
Switching to a buffer whose name matches one of these regexps
@@ -114,8 +119,11 @@ will prevent the window to be resized to the golden ratio."
(defun golden-ratio--dimensions ()
(list (floor (/ (frame-height) golden-ratio--value))
- (floor (* (/ (frame-width) golden-ratio--value)
- (golden-ratio--scale-factor)))))
+ (let ((width (floor (* (/ (frame-width) golden-ratio--value)
+ (golden-ratio--scale-factor)))))
+ (if golden-ratio-max-width
+ (min golden-ratio-max-width width)
+ width))))
(defun golden-ratio--resize-window (dimensions &optional window)
(with-selected-window (or window (selected-window))
- [nongnu] elpa/golden-ratio b343baac28 69/95: Added automatic scaling of width according to frame size., (continued)
- [nongnu] elpa/golden-ratio b343baac28 69/95: Added automatic scaling of width according to frame size., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio d5413c832b 75/95: Fix types in golden-ratio-exclude-modes., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio e47c29f87e 78/95: Trigger after split-window as well, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio f7bee8e221 65/95: Added width adjustment to adjust for very wide frames., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 76f5307ad0 72/95: Merge pull request #43 from EricGebhart/master, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 0287ac76fd 76/95: Simplify `golden-ratio-mode', ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 7593ba59b3 79/95: Merge pull request #48 from abo-abo/master, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio ac9bcedc63 81/95: Reenable improvements removed by error when reverting last PR., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 5e5b6c805b 85/95: Call window-configuration-change-hook only once, after the golden-ratio command., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio c5e916d238 86/95: Add fixed width feature, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio f5807212d3 88/95: Merge pull request #81 from wictory/pr_20190406,
ELPA Syncer <=
- [nongnu] elpa/golden-ratio 1325ecac07 92/95: support minimal change, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 656117e490 93/95: change default minimal change to 1, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio bf0035fd6a 95/95: Merge pull request #89 from skangas/nongnu-elpa-fixes, ELPA Syncer, 2023/09/07