Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>the simple answer of setting 2 variables to nil and 0 didn't work for me, so I wrote 2 simple functions: one just splits the window into NX vertical buffers and opens files named (for example) file.1 file.2 ... file.NX in each and another one does the same think, except does it in 2D (NY rows by NX columns for opening files f.1 f.2 ... f.[NX*NY]). To install, add this code to .emacs:</p> <pre><code> (defun grid-files-h (nx wx pfx) "Using dotimes, split the window into NX side-by-side buffers of width WX and load files starting with prefix PFX and ending in numbers 1 through NX" (let (ox fn k) ; ox is not used, but fn is used to store the filename, and k to store the index string (dotimes (x (- nx 1) ox) ; go through buffers, x goes from 0 to nx-2 and ox is not used here ; (print x) (setq k (number-to-string (+ x 1) ) ) ; k is a string that goes from "1" to "nx-1" ; (print k) (setq fn (concat pfx k) ) ; fn is filename - concatenate prefix with k ; (print fn) (find-file fn) ; open the filename in current buffer (split-window-horizontally wx) ; split window (current buffer gets wx-columns) (other-window 1) ; switch to the next (right) buffer ) (setq k (number-to-string nx )) ; last (rightmost) buffer gets the "nx" file (setq fn (concat pfx k) ) ; fn = "pfx"+"nx" (find-file fn ) ; open fn (other-window 1) ; go back to the first buffer ) ) (defun grid-files-sq (ny wy nx wx pfx) "Using dotimes, split the window into NX columns of width WX and NY rows of height WY and load files starting with prefix PFX and ending in numbers 1 through NX*NY" (let (oy ox fn k) (dotimes (y ny oy) ; go through rows, y goes from 0 to ny-1 and oy is not used here (split-window-vertically wy) ; create this row (dotimes (x (- nx 1) ox) ; go through columns, x goes from 0 to nx-2 and ox is not used here (setq k (number-to-string (+ 1 (+ x (* y nx) ) ) ) ) ; k must convert 2 indecies (x,y) into one linear one (like sub2ind in matlab) (setq fn (concat pfx k) ) ; filename (find-file fn ) ; open (split-window-horizontally wx) ; create this column in this row (this "cell") (other-window 1) ; go to the next buffer on the right ) (setq k (number-to-string (+ nx (* y nx) ) ) ) ; rightmost buffer in this row needs a file too (setq fn (concat pfx k) ) ; filename (find-file fn ) ; open (other-window 1) ; go to next row (one buffer down) ) ) ) </code></pre> <p>and then to use the vertical one, I go to *scratch* (<code>C-x b *scratch* RET</code>,<code>C-x 1</code>), type in <code>(grid-files-h 3 20 "file.")</code> then <code>C-x C-e</code>, or if you want to test out the square qrid one, <code>C-x 1</code>, type in <code>(grid-files-sq 2 15 3 20 "f.")</code> and then <code>C-x C-e</code> and you should see something like <img src="https://i.stack.imgur.com/2YPmw.png" alt="2x3 grid"></p> <p>This probably can be done better/more efficiently, but it's a start and it does what I need it to do (display a bunch of sequentially named small files). Feel free to improve or reuse.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload