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

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

[nongnu] elpa/visual-fill-column cf3e2bc632 137/137: Add option `visual-


From: ELPA Syncer
Subject: [nongnu] elpa/visual-fill-column cf3e2bc632 137/137: Add option `visual-fill-column-adjust-for-text-scale`.
Date: Sun, 2 Jan 2022 22:59:30 -0500 (EST)

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

    Add option `visual-fill-column-adjust-for-text-scale`.
    
    This option controls whether the text scaling factor is taken into account 
in
    calculating the width of the margins.
    
    See Github issue
    [#54](https://github.com/joostkremers/visual-fill-column/issues/54) for 
details.
---
 README.md             | 13 ++++++++++---
 visual-fill-column.el | 12 +++++++++++-
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index bbfdedcd63..b3dbfc5631 100644
--- a/README.md
+++ b/README.md
@@ -71,10 +71,12 @@ Alternatively, you can advise the function 
`text-size-adjust` with the function
 
     (advice-add 'text-scale-adjust :after #'visual-fill-column-adjust)
 
+Note that this functionality is controlled by the option 
`visual-fill-column-adjust-for-text-scale`. If this is set to `nil`, the 
margins are not adjusted for the text size.
+
 
 ## Customisation ##
 
-The customisation group `visual-fill-column` has five options (beside 
`global-visual-fill-column-mode`) that can be used to customise 
`visual-fill-column`:
+The customisation group `visual-fill-column` has several options that can be 
used to customise the package.
 
 `visual-fill-column-width`: column at which to wrap lines. If set to `nil` 
(the default), use the value of `fill-column` instead.
 
@@ -84,8 +86,13 @@ The customisation group `visual-fill-column` has five 
options (beside `global-vi
 
 `visual-fill-column-fringes-outside-margins`: if set to `t`, put the fringes 
outside the margins. Widening the margin would normally cause the fringes to be 
pushed inward, because by default, they appear between the margins and the 
text. This effect may be visually less appealing, therefore, 
`visual-fill-column-mode` places the fringes outside the margins. If you prefer 
to have the fringes inside the margins, unset this option.
 
-These four 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.
+These 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.
+
+The following options apply to all buffers with `visual-fill-column-mode` 
enabled:
+
+`visual-fill-column-inhibit-sensible-window-split` can be set to keep 
`visual-fill-column-mode` from setting `split-window-preferred-function`, as 
discussed above.
+
+`visual-fill-column-adjust-for-text-scale` determines whether text scaling is 
taken into account when computing the width of the margins.
 
-The fifth option, `visual-fill-column-inhibit-sensible-window-split` can be 
set to keep `visual-fill-column-mode` from setting 
`split-window-preferred-function`, as discussed above.
 
 `visual-fill-column-mode` also binds several mouse events for the left and 
right margins, so that scrolling or clicking on the margins does what you'd 
expect (rather than cause an "event not bound" error). If you wish to adjust 
these bindings, you should do so in `visual-fill-column-mode-map`.
diff --git a/visual-fill-column.el b/visual-fill-column.el
index a36a5992eb..f5f22f99fb 100644
--- a/visual-fill-column.el
+++ b/visual-fill-column.el
@@ -95,6 +95,15 @@ If this option is set, `visual-fill-column' sets the variable
   :type '(choice (const :tag "Allow vertical window split" nil)
                  (const :tag "Use standard window split" t)))
 
+(defcustom visual-fill-column-adjust-for-text-scale t
+  "Adjust the margins for text scaling.
+If set to t, the calculated margins are additionally adjusted for
+the text scale factor, so that the text is wrapped at
+`fill-column'."
+  :group 'visual-fill-column
+  :type '(choice (const :tag "Adjust margins for text scaling" t)
+                 (const :tag "Do not adjust margins for text scaling" nil)))
+
 (defvar visual-fill-column--use-split-window-parameter nil "If set, the window 
parameter `split-window' is used.")
 
 (defvar visual-fill-column--use-min-margins nil "If set, the window parameter 
`min-margins' is used.")
@@ -273,7 +282,8 @@ and `text-scale-mode-step'."
   (or window (setq window (selected-window)))
   (let* ((margins (window-margins window))
          (buffer (window-buffer window))
-         (scale (if (and (boundp 'text-scale-mode-step)
+         (scale (if (and visual-fill-column-adjust-for-text-scale
+                         (boundp 'text-scale-mode-step)
                          (boundp 'text-scale-mode-amount))
                     (with-current-buffer buffer
                       (expt text-scale-mode-step



reply via email to

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