Function: gnus-pad-form

gnus-pad-form is a byte-compiled function defined in gnus-spec.el.gz.

Signature

(gnus-pad-form EL PAD-WIDTH)

Documentation

Return a form that pads EL to PAD-WIDTH accounting for multi-column characters correctly. This is because format may pad to columns or to characters when given a pad value.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-spec.el.gz
(defun gnus-pad-form (el pad-width)
  "Return a form that pads EL to PAD-WIDTH accounting for multi-column
characters correctly.  This is because `format' may pad to columns
or to characters when given a pad value."
  (let ((pad (abs pad-width))
	(side (< 0 pad-width)))
    (if (symbolp el)
	`(let ((need (- ,pad (string-width ,el))))
	   (if (> need 0)
	       (concat ,(when side '(make-string need ?\ ))
		       ,el
		       ,(when (not side) '(make-string need ?\ )))
	     ,el))
      `(let* ((val (eval ,el))
	      (need (- ,pad (string-width val))))
	 (if (> need 0)
	     (concat ,(when side '(make-string need ?\ ))
		     val
		     ,(when (not side) '(make-string need ?\ )))
	   val)))))