Function: erc-fill-wrap-nudge

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

Signature

(erc-fill-wrap-nudge ARG)

Documentation

Adjust erc-fill-wrap by ARG columns.

Offer to repeat command in a manner similar to text-scale-adjust.

   \= Increase indentation by one column
   \- Decrease indentation by one column
   \0 Reset indentation to the default
   \+ Shift margin boundary rightward by one column
   \_ Shift margin boundary leftward by one column
   \) Reset the right margin to the default

Note that misalignment may occur when messages contain decorations applied by third-party modules.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-fill.el.gz
(defun erc-fill-wrap-nudge (arg)
  "Adjust `erc-fill-wrap' by ARG columns.
Offer to repeat command in a manner similar to
`text-scale-adjust'.

   \\`=' Increase indentation by one column
   \\`-' Decrease indentation by one column
   \\`0' Reset indentation to the default
   \\`+' Shift margin boundary rightward by one column
   \\`_' Shift margin boundary leftward by one column
   \\`)' Reset the right margin to the default

Note that misalignment may occur when messages contain
decorations applied by third-party modules."
  (interactive "p")
  (unless erc-fill--wrap-value
    (cl-assert (not erc-fill-wrap-mode))
    (user-error "Minor mode `erc-fill-wrap-mode' disabled"))
  (unless (get-buffer-window)
    (user-error "Command called in an undisplayed buffer"))
  (let* ((total (erc-fill--wrap-nudge arg))
         (leftp erc-stamp--margin-left-p)
         ;; Anchor current line vertically.
         (line (count-screen-lines (window-start) (window-point))))
    (when (zerop arg)
      (setq arg 1))
    (compat-call
     set-transient-map
     (let ((map (make-sparse-keymap)))
       (dolist (key '(?= ?- ?0))
         (let ((a (pcase key
                    (?0 0)
                    (?- (- (abs arg)))
                    (_ (abs arg)))))
           (define-key map (vector (list key))
                       (lambda ()
                         (interactive)
                         (cl-incf total (erc-fill--wrap-nudge a))
                         (recenter line)))))
       (dolist (key '(?\) ?_ ?+))
         (let ((a (pcase key
                    (?\) 0)
                    (?_ (if leftp (abs arg) (- (abs arg))))
                    (?+ (if leftp (- (abs arg)) (abs arg))))))
           (define-key map (vector (list key))
                       (lambda ()
                         (interactive)
                         (erc-stamp--adjust-margin (- a) (zerop a))
                         (when leftp (erc-stamp--refresh-left-margin-prompt))
                         (recenter line)))))
       map)
     t
     (lambda ()
       (message "Fill prefix: %d (%+d col%s); Margin: %d"
                erc-fill--wrap-value total (if (> (abs total) 1) "s" "")
                (if leftp left-margin-width right-margin-width)))
     "Use %k for further adjustment"
     1)
    (recenter line)))