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

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

[nongnu] elpa/visual-fill-column 9863702b53 015/137: Use `fringes-outsid


From: ELPA Syncer
Subject: [nongnu] elpa/visual-fill-column 9863702b53 015/137: Use `fringes-outside-margins` instead of disabling the fringes.
Date: Sun, 2 Jan 2022 22:59:08 -0500 (EST)

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

    Use `fringes-outside-margins` instead of disabling the fringes.
---
 README.md             |  4 ++--
 visual-fill-column.el | 28 ++++++++--------------------
 2 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/README.md b/README.md
index 86985e020b..adfa713b84 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ However, `visual-fill-column-mode` is not tied to 
`visual-line-mode`: it is perf
 
 `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`. 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 causes the fringe to be pushed inward. Since the fringe is 
visible, this has a somewhat disturbing effect, because it looks like there’s 
another window to the left, even though there isn’t. For this reason, the left 
fringe is disabled by default.
+Widening the margin causes the fringe to be pushed inward. For this reason, 
the fringes are placed outside the margins by setting the variable 
`fringes-outside-margins` to `t`.
 
 
 ## Options ##
@@ -25,6 +25,6 @@ Widening the margin causes the fringe to be pushed inward. 
Since the fringe is v
 
 `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-disable-fringe`: if set to `t`, the left fringe is 
disabled. Note that if `visual-fill-column-center-text` is set to `t`, both the 
left and right fringes are disabled.
+`visual-fill-column-fringes-outside-margins`: if set to `t`, put the fringes 
outside the margins.
 
 All three options are buffer-local, so the values you set through Customize 
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/visual-fill-column.el b/visual-fill-column.el
index 099bee3d1b..bd014be6ce 100644
--- a/visual-fill-column.el
+++ b/visual-fill-column.el
@@ -6,7 +6,7 @@
 ;; Author: Joost Kremers <joostkremers@fastmail.fm>
 ;; Maintainer: Joost Kremers <joostkremers@fastmail.fm>
 ;; Created: 2015
-;; Version: 1.2
+;; Version: 1.3
 ;; Package-Requires: ((emacs "24.3"))
 
 ;; This file is NOT part of GNU Emacs.
@@ -48,13 +48,13 @@ this option is set to a value, it is used instead."
 (make-variable-buffer-local 'visual-fill-column-width)
 (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."
+(defcustom visual-fill-column-fringes-outside-margins t
+  "Put the fringes outside the margins."
   :group 'visual-fill-column
-  :type '(choice (const :tag "Do not disable the fringes" nil)
-                 (const :tag "Disable the fringes" t)))
-(make-variable-buffer-local 'visual-fill-column-disable-fringe)
-(put 'visual-fill-column-disable-fringe 'safe-local-variable 'symbolp)
+  :type '(choice (const :tag "Put fringes outside the margins" t)
+                 (const :tag "Keep the fringes inside the margins" nil)))
+(make-variable-buffer-local 'visual-fill-column-fringes-outside-margins)
+(put 'visual-fill-column-fringes-outside-margins 'safe-local-variable 'symbolp)
 
 (defcustom visual-fill-column-center-text nil
   "If set, center the text area in the window."
@@ -98,21 +98,9 @@ in which `visual-line-mode' is active as well."
 
 (defun visual-fill-column--adjust-window ()
   "Adjust the window margins and fringes."
-  (visual-fill-column--set-fringes)
+  (setq fringes-outside-margins visual-fill-column-fringes-outside-margins)
   (visual-fill-column--set-margins))
 
-(defun visual-fill-column--set-fringes ()
-  "Set the fringes for the current window."
-  (when visual-fill-column-disable-fringe
-    ;; the left fringe is only disabled if the text is centered
-    (let ((left (if visual-fill-column-center-text 0 nil))
-          (right 0))
-      ;; swap left & right fringes in explicitly R2L buffers
-      (when (eq bidi-paragraph-direction 'right-to-left)
-        (setq right left)
-        (setq left 0))
-      (set-window-fringes (selected-window) left right))))
-
 (defun visual-fill-column--set-margins ()
   "Set window margins for the current window."
   ;; calculate left & right margins



reply via email to

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