Function: treemacs--inplace-map-when-unrolled

treemacs--inplace-map-when-unrolled is a macro defined in treemacs-rendering.el.

Signature

(treemacs--inplace-map-when-unrolled ITEMS INTERVAL &rest MAPPER)

Documentation

Unrolled in-place mapping operation.

Maps ITEMS at given index INTERVAL using MAPPER function.

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-rendering.el
(defmacro treemacs--inplace-map-when-unrolled (items interval &rest mapper)
  "Unrolled in-place mapping operation.
Maps ITEMS at given index INTERVAL using MAPPER function."
  (declare (indent 2))
  (let ((l (make-symbol "list"))
        (tail-op (cl-case interval
                   (2 'cdr)
                   (3 'cddr)
                   (4 'cdddr)
                   (_ (error "Interval %s is not handled yet" interval)))))
    `(let ((,l ,items))
       (while ,l
          (setq ,l (,tail-op ,l))
          (let ((it (car ,l)))
            (setf (car ,l) ,@mapper)
            (pop ,l)))
       ,items)))