[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/visual-fill-column d05a7e9c62 004/137: Allow `visual-fill-
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/visual-fill-column d05a7e9c62 004/137: Allow `visual-fill-column-width` to be set to an integer. |
Date: |
Sun, 2 Jan 2022 22:59:07 -0500 (EST) |
branch: elpa/visual-fill-column
commit d05a7e9c62ca8cd17d8ac73e55f53dfb94142b03
Author: Joost Kremers <joostkremers@fastmail.fm>
Commit: Joost Kremers <joostkremers@fastmail.fm>
Allow `visual-fill-column-width` to be set to an integer.
---
visual-fill-column.el | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/visual-fill-column.el b/visual-fill-column.el
index e66e887971..a2dd473ca0 100644
--- a/visual-fill-column.el
+++ b/visual-fill-column.el
@@ -36,14 +36,16 @@
(defcustom visual-fill-column-width nil
"Width of the text area.
-By default, the global value of `fill-column' is used.
-Alternatively, the value can be specified relative to the window
-width. In this case, it must be a value between 0 and 1."
+By default, the global value of `fill-column' is used, but if
+this option is set to a value, it is used instead. Alternatively,
+the value can be specified relative to the window width. In this
+case, it must be a value between 0 and 1."
:group 'visual-fill-column
- :type '(choice (const :tag "Use `fill-column'" nil)
+ :type '(choice (const :tag "Use `fill-column'" :value nil)
+ (integer :tag "Absolute width" :value 70)
(float :tag "Relative width:" :value 0.5)))
(make-variable-buffer-local 'visual-fill-column-width)
-(put 'visual-fill-column-width 'safe-local-variable 'floatp)
+(put 'visual-fill-column-width 'safe-local-variable 'numberp)
(defcustom visual-fill-column-disable-fringe t
"Disable the fringe when `visual-fill-column-mode' is active."
@@ -114,14 +116,16 @@ in which `visual-line-mode' is active as well."
"Set window margins for the current window."
;; calculate left & right margins
(let* ((window (selected-window))
- (current-width (window-total-width window))
+ (total-width (window-total-width window))
+ (width (or visual-fill-column-width
+ fill-column))
(margins (cond
- ((and (floatp visual-fill-column-width)
- (< 0 visual-fill-column-width 1))
- (- current-width (truncate (* current-width
visual-fill-column-width))))
- (t (if (< (- current-width fill-column) 0) ; margins must
be >= 0
+ ((and (floatp width)
+ (< 0 width 1))
+ (- total-width (truncate (* total-width width))))
+ (t (if (< (- total-width width) 0) ; margins must be >= 0
0
- (- current-width fill-column)))))
+ (- total-width width)))))
(left (if visual-fill-column-center-text
(/ margins 2)
0))
- [nongnu] elpa/visual-fill-column bd78372bd3 131/137: Fix link to writeroom-mode., (continued)
- [nongnu] elpa/visual-fill-column bd78372bd3 131/137: Fix link to writeroom-mode., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column a2657f20f6 128/137: Add note about centring text., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column a44fe8d78c 135/137: Point URL header to Codeberg., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 2df643827a 134/137: Add adaptive-wrap screen shots., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column dde0aa6535 061/137: Update README, ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 5f5928fd7f 045/137: Merge pull request #19 from cpitclaudel/master, ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 34ce0d22da 072/137: Guard against non-existing mouse events, ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 0044394939 054/137: Make some changes to the README.md, ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 982606896e 077/137: Change :group parameter of defgroup to `text`., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column d97017e9bc 058/137: Use correct option `visual-fill-column-fringes-outside-margins' in README., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column d05a7e9c62 004/137: Allow `visual-fill-column-width` to be set to an integer.,
ELPA Syncer <=
- [nongnu] elpa/visual-fill-column b63174ec24 006/137: Update README, ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column d3ebba9e60 009/137: Update version number in header block., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 7bf332089a 012/137: Fix typo., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 261e27c062 024/137: Update version number to 1.5, ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 043485d16a 026/137: Rename ::window-body-width to ::window-max-text-width, ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 96ac324638 031/137: Remove spurious empty line., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 4329831dd0 030/137: Add alternative function for `split-window-preferred-function'., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 9cae9dbfd9 041/137: Set window-parameter `split-window' only in Emacs 25 and up., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 98438fa2b8 048/137: Update version number., ELPA Syncer, 2022/01/02
- [nongnu] elpa/visual-fill-column 57c2a72d46 053/137: Merge pull request #26 from sten0/master, ELPA Syncer, 2022/01/02