Function: erc-stamp--adjust-margin
erc-stamp--adjust-margin is a byte-compiled function defined in
erc-stamp.el.gz.
Signature
(erc-stamp--adjust-margin COLS &optional RESETP)
Documentation
Adjust managed margin by increment COLS.
With RESETP, set margin's width to COLS. However, if COLS is
zero, set the width to a non-nil erc-stamp--margin-width.
Otherwise, go with the string-width of erc-timestamp-format.
However, when erc-stamp--margin-left-p is non-nil and the
prompt is wider, use its width instead.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc-stamp.el.gz
(defun erc-stamp--adjust-margin (cols &optional resetp)
"Adjust managed margin by increment COLS.
With RESETP, set margin's width to COLS. However, if COLS is
zero, set the width to a non-nil `erc-stamp--margin-width'.
Otherwise, go with the `string-width' of `erc-timestamp-format'.
However, when `erc-stamp--margin-left-p' is non-nil and the
prompt is wider, use its width instead."
(let* ((leftp erc-stamp--margin-left-p)
(width
(if resetp
(or (and (not (zerop cols)) cols)
erc-stamp--margin-width
(max (if leftp
(cond ((fboundp 'erc-fill--wrap-measure)
(let* ((b erc-insert-marker)
(e (1- erc-input-marker))
(w (erc-fill--wrap-measure b e)))
(/ (if (consp w) (car w) w)
(frame-char-width))))
((fboundp 'string-pixel-width)
(/ (string-pixel-width (erc-prompt))
(frame-char-width)))
(t (string-width (erc-prompt))))
0)
(1+ (string-width
(or (if leftp
erc-timestamp-last-inserted
erc-timestamp-last-inserted-right)
(erc-format-timestamp
(current-time) erc-timestamp-format))))))
(+ (if leftp left-margin-width right-margin-width) cols))))
(set (if leftp 'left-margin-width 'right-margin-width) width)
(when (eq (current-buffer) (window-buffer))
(set-window-margins nil
(if leftp width left-margin-width)
(if leftp right-margin-width width)))))