Rudolf Adamkovič <[email protected]> writes:
> Subjectively, not sure if this extract is worth it.

However, the function is a bit complicated, so I would prefer to at
least extract one fragment into another function.

> No more `pcase-lambda`?

Oh yes, I actually missed that. Thanks for the reminder. 
The entire function once again below:

#+begin_src emacs-lisp

(defun org-columns--set-widths (rows)
  ".."
  (setq org-columns-current-maxwidths
        (let ((widths (mapcar (pcase-lambda (`(,_ ,title ,width . ,_))
                                (if (wholenump width)
                                    width
                                  (string-width title)))
                              org-columns-current-fmt-compiled)))
          (dolist (row rows)
            (let ((remaining-triplets (cdr row))
                  (remaining-specs org-columns-current-fmt-compiled)
                  (remaining-widths widths))
              (while (and remaining-triplets remaining-specs remaining-widths)
                (org-columns--update-column-width
                 (car remaining-specs) (car remaining-triplets) 
remaining-widths)
                (pop remaining-triplets)
                (pop remaining-specs)
                (pop remaining-widths))))
          (apply #'vector widths))))

#+end_src

Best,
-- 
Slawomir Grochowski

Reply via email to