emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/visual-fill-column 78a21e1ee2 113/137: Revert "Add `visual


From: ELPA Syncer
Subject: [nongnu] elpa/visual-fill-column 78a21e1ee2 113/137: Revert "Add `visual-fill-column-offset`."
Date: Sun, 2 Jan 2022 22:59:18 -0500 (EST)

branch: elpa/visual-fill-column
commit 78a21e1ee2ae3596af636fd0ed8e8b58da38f156
Author: Joost Kremers <joostkremers@fastmail.fm>
Commit: Joost Kremers <joostkremers@fastmail.fm>

    Revert "Add `visual-fill-column-offset`."
    
    This reverts commit 99d78162d9a524340607c11500ddc8cf6607d3c0.
---
 README.md                       |  4 +---
 test/visual-fill-column-test.el | 13 -------------
 visual-fill-column.el           | 42 +++++------------------------------------
 3 files changed, 6 insertions(+), 53 deletions(-)

diff --git a/README.md b/README.md
index 46da90a437..a37d96e106 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ Note that while `visual-fill-column-mode` was written with 
the purpose of wrappi
 
 `visual-fill-column-mode` works by widening the right window margin. This 
reduces the area that is available for text display, creating the appearance 
that the text is wrapped at `fill-column`. The amount by which the right margin 
is widened depends on the window width and is automatically adjusted when the 
window’s width changes (e.g., when the window is split in two side-by-side 
windows).
 
-In buffers that are explicitly right-to-left (i.e., those where 
`bidi-paragraph-direction` is set to `right-to-left`), the left margin is 
expanded, so that the text appears at the window’s right side, and the meaning 
of `visual-fill-column-offset` is reversed.
+In buffers that are explicitly right-to-left (i.e., those where 
`bidi-paragraph-direction` is set to `right-to-left`), the left margin is 
expanded, so that the text appears at the window’s right side.
 
 Widening the margin normally causes the fringes to be pushed inward. Since 
this is visually less appealing, the fringes are placed outside the margins. 
You can undo this by setting the variable 
`visual-fill-column-fringes-outside-margins` to `nil`.
 
@@ -63,8 +63,6 @@ The customisation group `visual-fill-column` has four options 
(beside `global-vi
 
 `visual-fill-column-center-text`: if set to `t`, centre the text area in the 
window. By default, the text is displayed at the window’s (left) edge, 
mimicking the effect of `fill-column`.
 
-`visual-fill-column-offset`: offset the text area by a certain number of 
columns. The value can be positive (offset to the left) or negative (offset to 
the right). A negative value only makes sense if 
`visual-fill-column-center-text` is set.
-
 `visual-fill-column-fringes-outside-margins`: if set to `t`, put the fringes 
outside the margins.
 
 These three options are buffer-local, so the values you set in your init file 
are default values. They can also be set in mode hooks or directory or file 
local variables in order to customise particular files or file types.
diff --git a/test/visual-fill-column-test.el b/test/visual-fill-column-test.el
index bbd4071a25..0d51b61457 100644
--- a/test/visual-fill-column-test.el
+++ b/test/visual-fill-column-test.el
@@ -1,16 +1,3 @@
 ;;; visual-fill-column-test.el --- Tests for visual-fill-column
 
-;;; Commentary:
-;; Tests for the visual-fill-column package.
-
-;;; Code:
-
-(require 'visual-fill-column)
-
-(ert-deftest visual-fill-column--calculate-margin-shift ()
-  (should (equal (visual-fill-column--calculate-margin-shift 0  80 4)  '(4 . 
76)))
-  (should (equal (visual-fill-column--calculate-margin-shift 10 80 -4) '(6 . 
84)))
-  (should (equal (visual-fill-column--calculate-margin-shift 0  80 -4) '(0 . 
80)))
-  (should (equal (visual-fill-column--calculate-margin-shift 80 0  4)  '(80 . 
0))))
-
 ;;; visual-fill-column-test.el ends here
diff --git a/visual-fill-column.el b/visual-fill-column.el
index 0b96498f5a..950951e79f 100644
--- a/visual-fill-column.el
+++ b/visual-fill-column.el
@@ -66,15 +66,6 @@ this option is set to a value, it is used instead."
 (make-variable-buffer-local 'visual-fill-column-center-text)
 (put 'visual-fill-column-center-text 'safe-local-variable 'symbolp)
 
-(defcustom visual-fill-column-offset 0
-  "Number of columns to shift the text area.
-The text area is shifted to the right (positive value) or
-left (negative value).  A negative value only makes sense if
-`visual-fill-column-center-text' is set."
-  :group 'visual-fill-column
-  :type '(integer :tag "Offset (in columns)"))
-(put 'visual-fill-column-center-text 'safe-local-variable 'integerp)
-
 (defcustom visual-fill-column-inhibit-sensible-window-split nil
   "Do not set `split-window-preferred-function' to allow vertical window 
splits.
 By default, `split-window-preferred-function' is set to
@@ -278,24 +269,6 @@ selected window.  The return value is scaled to account for
                       0))
                  (float scale)))))
 
-(defun visual-fill-column--calculate-margin-shift (left right offset)
-  "Calculate new margins for LEFT and RIGHT based on OFFSET.
-OFFSET is added to LEFT and subtracted from RIGHT.  If either
-value then becomes less than zero, it is set to zero and the
-other value is compensated for the difference.
-
-Return a cons cell of the new left and right margins."
-  (let ((shifted-left (+ left offset))
-        (shifted-right (- right offset)))
-    (cond
-     ((< shifted-left 0)
-      (setq shifted-right (+ shifted-right shifted-left))
-      (setq shifted-left 0))
-     ((< shifted-right 0)
-      (setq shifted-left (+ shifted-left shifted-right))
-      (setq shifted-right 0)))
-    (cons shifted-left shifted-right)))
-
 (defun visual-fill-column--set-margins (window)
   "Set window margins for WINDOW."
   ;; Calculate left & right margins.
@@ -310,16 +283,11 @@ Return a cons cell of the new left and right margins."
                  0))
          (right (- margins left)))
 
-    (if (/= visual-fill-column-offset 0)
-        (let ((shift (visual-fill-column--calculate-margin-shift left right 
visual-fill-column-offset)))
-          (setq left (car shift)
-                right (cdr shift))))
-
-    ;; In an explicitly R2L buffer, swap left and right margins.
-    (when (eq bidi-paragraph-direction 'right-to-left)
-      (setq left (prog1
-                     right
-                   (setq right left))))
+    ;; put an explicitly R2L buffer on the right side of the window
+    (when (and (eq bidi-paragraph-direction 'right-to-left)
+               (= left 0))
+      (setq left right)
+      (setq right 0))
 
     (set-window-margins window left right)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]