Function: erc-fill-wrap-mode

erc-fill-wrap-mode is an interactive and byte-compiled function defined in erc-fill.el.gz.

Signature

(erc-fill-wrap-mode &optional ARG)

Documentation

Toggle ERC fill-wrap mode locally.

If called interactively, enable erc-fill-wrap-mode(var)/erc-fill-wrap-mode(fun) if ARG is positive, and disable it otherwise. If called from Lisp, enable the mode if ARG is omitted or nil.

Fill style leveraging visual-line-mode(var)/visual-line-mode(fun).

This module displays nicks overhanging leftward to a common offset, as determined by the option erc-fill-static-center. It also "wraps" messages at a common width, as determined by the option erc-fill-wrap-margin-width. To use it, either include fill-wrap in erc-modules or set erc-fill-function to erc-fill-wrap.

Once enabled, use M-x erc-fill-wrap-nudge (erc-fill-wrap-nudge) to adjust the width of the indent and the stamp margin. For cycling between logical- and screen-line oriented command movement, see M-x erc-fill-wrap-toggle-truncate-lines (erc-fill-wrap-toggle-truncate-lines). Similarly, use M-x erc-fill-wrap-refill-buffer (erc-fill-wrap-refill-buffer) to fix alignment problems after running certain commands, like text-scale-adjust. Also see related stylistic options erc-fill-wrap-merge and erc-fill-wrap-merge-indicator. (Hint: in narrow windows, try setting erc-fill-static-center to 1 and choosing "Leading MIDDLE DOT sans gap" for erc-fill-wrap-merge-indicator.)

This module imposes various restrictions on the appearance of timestamps. Most notably, it insists on displaying them in the margins. Users preferring left-sided stamps may notice that ERC also displays the prompt in the left margin, possibly truncating or padding it to constrain it to the margin's width. Additionally, this module assumes that users providing their own erc-insert-timestamp-function have also customized the option erc-fill-wrap-margin-side to an explicit side. When stamps appear in the right margin, which they do by default, users may find that ERC actually appends them to copy-as-killed messages. This normally poses at most a minor inconvenience. Users of the log module wanting to avoid this effect in logs should see erc-stamp-prefix-log-filter, which strips trailing stamps from logged messages and instead prepends them to every line.

A so-called "local" module, fill-wrap depends on the global modules fill, stamp, button, and scrolltobottom. It activates them as needed when initializing and leaves them enabled when shutting down. To opt out of scrolltobottom specifically, disable its minor mode, erc-scrolltobottom-mode(var)/erc-scrolltobottom-mode(fun), via erc-fill-wrap-mode-hook.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-fill.el.gz
;;;###autoload(put 'fill-wrap 'erc--feature 'erc-fill)
(define-erc-module fill-wrap nil
  "Fill style leveraging `visual-line-mode'.

This module displays nicks overhanging leftward to a common
offset, as determined by the option `erc-fill-static-center'.  It
also \"wraps\" messages at a common width, as determined by the
option `erc-fill-wrap-margin-width'.  To use it, either include
`fill-wrap' in `erc-modules' or set `erc-fill-function' to
`erc-fill-wrap'.

Once enabled, use \\[erc-fill-wrap-nudge] to adjust the width of
the indent and the stamp margin.  For cycling between
logical- and screen-line oriented command movement, see
\\[erc-fill-wrap-toggle-truncate-lines].  Similarly, use
\\[erc-fill-wrap-refill-buffer] to fix alignment problems after
running certain commands, like `text-scale-adjust'.  Also see
related stylistic options `erc-fill-wrap-merge' and
`erc-fill-wrap-merge-indicator'.  (Hint: in narrow windows, try
setting `erc-fill-static-center' to 1 and choosing \"Leading
MIDDLE DOT sans gap\" for `erc-fill-wrap-merge-indicator'.)

This module imposes various restrictions on the appearance of
timestamps.  Most notably, it insists on displaying them in the
margins.  Users preferring left-sided stamps may notice that ERC
also displays the prompt in the left margin, possibly truncating
or padding it to constrain it to the margin's width.
Additionally, this module assumes that users providing their own
`erc-insert-timestamp-function' have also customized the option
`erc-fill-wrap-margin-side' to an explicit side.  When stamps
appear in the right margin, which they do by default, users may
find that ERC actually appends them to copy-as-killed messages.
This normally poses at most a minor inconvenience.  Users of the
`log' module wanting to avoid this effect in logs should see
`erc-stamp-prefix-log-filter', which strips trailing stamps from
logged messages and instead prepends them to every line.

A so-called \"local\" module, `fill-wrap' depends on the global
modules `fill', `stamp', `button', and `scrolltobottom'.  It
activates them as needed when initializing and leaves them
enabled when shutting down.  To opt out of `scrolltobottom'
specifically, disable its minor mode, `erc-scrolltobottom-mode',
via `erc-fill-wrap-mode-hook'."
  ((erc-fill--wrap-ensure-dependencies)
   (when erc-fill-wrap-merge-indicator
     (erc-fill--wrap-massage-legacy-indicator-type))
   (erc--restore-initialize-priors erc-fill-wrap-mode
     erc-fill--wrap-visual-keys erc-fill-wrap-visual-keys
     erc-fill--wrap-value erc-fill-static-center
     erc-stamp--margin-width erc-fill-wrap-margin-width
     left-margin-width left-margin-width
     right-margin-width right-margin-width)
   (setq erc-stamp--margin-left-p
         (or (eq erc-fill-wrap-margin-side 'left)
             (eq (default-value 'erc-insert-timestamp-function)
                 #'erc-insert-timestamp-left)))
   (when erc-fill-wrap-align-prompt
     (add-hook 'erc--refresh-prompt-hook
               #'erc-fill--wrap-indent-prompt nil t))
   (when erc-stamp--margin-left-p
     (if erc-fill-wrap-align-prompt
         (setq erc-stamp--skip-left-margin-prompt-p t)
       (setq erc--inhibit-prompt-display-property-p t)))
   (add-hook 'erc-stamp--insert-date-hook
             #'erc-fill--wrap-unmerge-on-date-stamp 20 t)
   (setq erc-fill--function #'erc-fill-wrap)
   (when erc-fill-wrap-merge
     (add-hook 'erc-button--prev-next-predicate-functions
               #'erc-fill--wrap-merged-button-p nil t))
   (erc-stamp--display-margin-mode +1)
   (visual-line-mode +1))
  ((visual-line-mode -1)
   (erc-stamp--display-margin-mode -1)
   (kill-local-variable 'erc-fill--wrap-value)
   (kill-local-variable 'erc-fill--function)
   (kill-local-variable 'erc-fill--wrap-visual-keys)
   (kill-local-variable 'erc-fill--wrap-last-msg)
   (kill-local-variable 'erc--inhibit-prompt-display-property-p)
   (kill-local-variable 'erc-fill--wrap-merge-indicator-pre)
   (remove-hook 'erc--refresh-prompt-hook
                #'erc-fill--wrap-indent-prompt t)
   (remove-hook 'erc-button--prev-next-predicate-functions
                #'erc-fill--wrap-merged-button-p t)
   (remove-hook 'erc-stamp--insert-date-hook
                #'erc-fill--wrap-unmerge-on-date-stamp t))
  'local)