update packages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
(define-package "visual-fill-column" "20230102.1830" "fill-column for visual-line-mode"
|
||||
(define-package "visual-fill-column" "20250204.2336" "fill-column for visual-line-mode"
|
||||
'((emacs "25.1"))
|
||||
:commit "695a59789209c42fa08a5bce92963ee32f4455be" :authors
|
||||
:commit "d4464130a21733671a53f915a697dea65888473f" :authors
|
||||
'(("Joost Kremers" . "joostkremers@fastmail.fm"))
|
||||
:maintainers
|
||||
'(("Joost Kremers" . "joostkremers@fastmail.fm"))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; visual-fill-column.el --- fill-column for visual-line-mode -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2015-2023 Joost Kremers
|
||||
;; Copyright (C) 2015-2025 Joost Kremers
|
||||
;; Copyright (C) 2016 Martin Rudalics
|
||||
;; All rights reserved.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
;; Maintainer: Joost Kremers <joostkremers@fastmail.fm>
|
||||
;; URL: https://codeberg.org/joostkremers/visual-fill-column
|
||||
;; Created: 2015
|
||||
;; Version: 2.5.1
|
||||
;; Version: 2.6.3
|
||||
;; Package-Requires: ((emacs "25.1"))
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defgroup visual-fill-column nil "Wrap lines according to `fill-column' in `visual-line-mode'."
|
||||
(defgroup visual-fill-column nil "Wrap lines according to `fill-column'."
|
||||
:group 'text
|
||||
:prefix "visual-fill-column-")
|
||||
|
||||
@@ -143,7 +143,13 @@ the text scale factor, so that the text is wrapped at
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode visual-fill-column-mode
|
||||
"Wrap lines according to `fill-column' in `visual-line-mode'."
|
||||
"Soft-wrap lines according to `fill-column'.
|
||||
This minor mode narrows the text area. Its primary use is in
|
||||
conjunction with `visual-line-mode', to enable soft word-wrapping
|
||||
of long lines, but it can also be used in other contexts, e.g.,
|
||||
to center the text in a window. To activate it together with
|
||||
`visual-line-mode', it is usually best to use
|
||||
`visual-line-fill-column-mode'."
|
||||
:init-value nil :lighter nil :global nil
|
||||
(if visual-fill-column-mode
|
||||
(visual-fill-column-mode--enable)
|
||||
@@ -154,10 +160,22 @@ the text scale factor, so that the text is wrapped at
|
||||
:require 'visual-fill-column-mode
|
||||
:group 'visual-fill-column)
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode visual-line-fill-column-mode
|
||||
"Enable `visual-line-mode' and soft-wrap lines according to `fill-column'.
|
||||
Use this mode to activate and deactivate `visual-line-mode' and
|
||||
`visual-fill-column-mode' in conjunction."
|
||||
:init-value nil :lighter nil :global nil
|
||||
(cond (visual-line-fill-column-mode
|
||||
(visual-fill-column-mode 1)
|
||||
(visual-line-mode 1))
|
||||
(t
|
||||
(visual-fill-column-mode -1)
|
||||
(visual-line-mode -1))))
|
||||
|
||||
(defun turn-on-visual-fill-column-mode ()
|
||||
"Turn on `visual-fill-column-mode'.
|
||||
Note that `visual-fill-column-mode' is only turned on in buffers
|
||||
in which Visual Line mode is active as well, and only in buffers
|
||||
that actually visit a file."
|
||||
(when buffer-file-name
|
||||
(visual-fill-column-mode 1)))
|
||||
@@ -180,8 +198,7 @@ that actually visit a file."
|
||||
((= emacs-major-version 27)
|
||||
(add-hook 'window-size-change-functions #'visual-fill-column--adjust-window 'append 'local)
|
||||
(setq visual-fill-column--use-split-window-parameter t))
|
||||
|
||||
((< 27 emacs-major-version)
|
||||
((> emacs-major-version 27)
|
||||
(add-hook 'window-state-change-functions #'visual-fill-column--adjust-window 'append 'local)
|
||||
(setq visual-fill-column--use-min-margins t)))
|
||||
|
||||
@@ -197,11 +214,10 @@ that actually visit a file."
|
||||
(remove-hook 'window-size-change-functions #'visual-fill-column--adjust-frame))
|
||||
((= emacs-major-version 27)
|
||||
(remove-hook 'window-size-change-functions #'visual-fill-column--adjust-window 'local))
|
||||
|
||||
((< 27 emacs-major-version)
|
||||
((> emacs-major-version 27)
|
||||
(remove-hook 'window-state-change-functions #'visual-fill-column--adjust-window 'local)
|
||||
(set-window-margins window 0 0)
|
||||
(set-window-parameter window 'min-margins nil)))
|
||||
(set-window-margins window 0 0)
|
||||
(set-window-fringes window nil)))
|
||||
|
||||
(defun visual-fill-column-split-window (&optional window size side)
|
||||
@@ -300,10 +316,14 @@ and `text-scale-mode-step'."
|
||||
(with-current-buffer buffer
|
||||
(expt text-scale-mode-step
|
||||
text-scale-mode-amount))
|
||||
1.0)))
|
||||
(truncate (/ (+ (window-width window)
|
||||
(or (car margins) 0)
|
||||
(or (cdr margins) 0))
|
||||
1.0))
|
||||
(remap-scale
|
||||
(if (>= emacs-major-version 29)
|
||||
(/ (window-width window 'remap) (float (window-width window)))
|
||||
1.0)))
|
||||
(truncate (/ (+ (window-width window (and (>= emacs-major-version 29) 'remap))
|
||||
(* (or (car margins) 0) remap-scale)
|
||||
(* (or (cdr margins) 0) remap-scale))
|
||||
(float scale)))))
|
||||
|
||||
(defun visual-fill-column--add-extra-width (left right add-width)
|
||||
@@ -318,11 +338,15 @@ cell of the new margins, which will never be less than zero."
|
||||
"Set window margins for WINDOW."
|
||||
;; Calculate left & right margins.
|
||||
(let* ((total-width (visual-fill-column--window-max-text-width window))
|
||||
(remap-scale
|
||||
(if (>= emacs-major-version 29)
|
||||
(/ (window-width window 'remap) (float (window-width window)))
|
||||
1.0))
|
||||
(width (or visual-fill-column-width
|
||||
fill-column))
|
||||
(margins (if (< (- total-width width) 0) ; margins must be >= 0
|
||||
0
|
||||
(- total-width width)))
|
||||
(round (/ (- total-width width) remap-scale))))
|
||||
(left (if visual-fill-column-center-text
|
||||
(/ margins 2)
|
||||
0))
|
||||
|
||||
Reference in New Issue
Block a user