I made an elisp function for parsing some org table-like data in a buffer. My function scans each line of the buffer, and depending on the characters at the start of the line, it jumps to a certain point in the line and inserts some text. The relevant part of the function is below:
(beginning-of-buffer)
(while (not (eobp))
(cond ((looking-at header-re-1)
(search-forward marker1 nil nil count1)
(insert text1))
((looking-at header-re-2)
(search-forward marker2 nil nil count2)
(insert text2))
((looking-at header-re-3)
(search-forward marker3 nil nil count3)
(insert text3))
(t))
(forward-line))
My function works okay, but it seems a little inelegant, because the `cond` consists of three blocks of `looking-at` followed by `search-forward` followed by `insert`, only with different arguments each time. Is there a more clever way to do this that only needs one call to `looking-at`, `search-forward`, and `insert`, using something like, say `pcase`?