Function: profiler-format

profiler-format is a byte-compiled function defined in profiler.el.gz.

Signature

(profiler-format FMT &rest ARGS)

Source Code

;; Defined in /usr/src/emacs/lisp/profiler.el.gz
(defun profiler-format (fmt &rest args)
  (cl-loop for (width align subfmt) in fmt
	   for arg in args
	   for str = (cond
		      ((consp subfmt)
		       (apply #'profiler-format subfmt arg))
		      ((stringp subfmt)
		       (format subfmt arg))
		      ((and (symbolp subfmt)
			    (fboundp subfmt))
		       (funcall subfmt arg))
		      (t
		       (profiler-ensure-string arg)))
	   for len = (length str)
           if (zerop width)
           collect str into frags
           else
	   if (< width len)
           collect (progn (put-text-property (max 0 (- width 2)) len
                                             'invisible 'profiler str)
                          str)
           into frags
	   else
	   collect
           (let ((padding (make-string (max 0 (- width len)) ?\s)))
	     (cl-ecase align
	       (left (concat str padding))
	       (right (concat padding str))))
	   into frags
	   finally return (apply #'concat frags)))