Function: hycontrol-windows-grid-by-file-pattern

hycontrol-windows-grid-by-file-pattern is an autoloaded, interactive and byte-compiled function defined in hycontrol.el.

Signature

(hycontrol-windows-grid-by-file-pattern ARG PATTERN &optional FULL-FLAG)

Documentation

Display up to an abs(prefix ARG)-sized window grid of files matching PATTERN.

Use absolute file paths if called interactively or optional FULL-FLAG is non-nil. PATTERN is a shell file glob pattern.

Left digit of ARG is the number of grid rows and the right digit is the number of grid columns. If ARG is nil, 0, 1, less than
11, greater than 99, then autosize the grid to fit the number of
files matched by PATTERN. Otherwise, if ARG ends in a 0, adjust the grid size to the closest valid size.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hycontrol.el
;;;###autoload
(defun hycontrol-windows-grid-by-file-pattern (arg pattern &optional full-flag)
  "Display up to an abs(prefix ARG)-sized window grid of files matching PATTERN.
Use absolute file paths if called interactively or optional
FULL-FLAG is non-nil.  PATTERN is a shell file glob pattern.

Left digit of ARG is the number of grid rows and the right digit
is the number of grid columns.  If ARG is nil, 0, 1, less than
11, greater than 99, then autosize the grid to fit the number of
files matched by PATTERN.  Otherwise, if ARG ends in a 0, adjust the
grid size to the closest valid size."
  (interactive
   (list current-prefix-arg
	 (read-string "Pattern of files to display in windows grid: ")
	 t))
  (when (memq arg '(0 1))
    (setq arg nil))
  (let* ((find-file-wildcards t)
	 (files (file-expand-wildcards pattern full-flag))
	 (num-files (length files))
	 grid-size
	 num-windows
	 max-files)
    (when (zerop num-files)
      (error "(hycontrol-windows-grid-by-file-pattern): '%s' pattern did not match any files" pattern))
    (setq grid-size (if arg
			(hycontrol-windows-grid-validate arg)
		      (hycontrol-windows-grid-minimum-size num-files)))
    (when (zerop grid-size)
      (error "(hycontrol-windows-grid-by-file-pattern): '%s' pattern produced invalid zero window grid size" pattern))
    (setq num-windows (hycontrol-windows-grid-number-of-windows (or arg grid-size))
	  max-files (min num-files num-windows))
    (when (> num-files max-files)
      ;; Cut off list at max-files items
      (setq files (cl-loop repeat max-files for files in files collect files)))
    (hycontrol-windows-grid-by-file-list grid-size files)))