Bored and unwilling so doing some emacs vintage timewasting using this : http://vimgolf.com/challenges/4d29ae2107e0177c7e000036
; solution
; making a template, then iterate/expand through input once
; repeat until EOF
;; in
cow moo
horse neigh
duck quack
goose honk
hen cluck
chick peep
pig oink
sheep baa
;;out
Old MacDonald had a farm, E I E I O.
And on that farm he had a cow, E I E I O.
With a moo, moo here and a moo, moo there.
Here a moo, there a moo, everywhere a moo, moo.
Old MacDonald had a farm, E I E I O.
Old MacDonald had a farm, E I E I O.
And on that farm he had a horse, E I E I O.
With a neigh, neigh here and a neigh, neigh there.
Here a neigh, there a neigh, everywhere a neigh, neigh.
Old MacDonald had a farm, E I E I O.
Old MacDonald had a farm, E I E I O.
And on that farm he had a duck, E I E I O.
With a quack, quack here and a quack, quack there.
Here a quack, there a quack, everywhere a quack, quack.
Old MacDonald had a farm, E I E I O.
Old MacDonald had a farm, E I E I O.
And on that farm he had a goose, E I E I O.
With a honk, honk here and a honk, honk there.
Here a honk, there a honk, everywhere a honk, honk.
Old MacDonald had a farm, E I E I O.
Old MacDonald had a farm, E I E I O.
And on that farm he had a hen, E I E I O.
With a cluck, cluck here and a cluck, cluck there.
Here a cluck, there a cluck, everywhere a cluck, cluck.
Old MacDonald had a farm, E I E I O.
Old MacDonald had a farm, E I E I O.
And on that farm he had a chick, E I E I O.
With a peep, peep here and a peep, peep there.
Here a peep, there a peep, everywhere a peep, peep.
Old MacDonald had a farm, E I E I O.
Old MacDonald had a farm, E I E I O.
And on that farm he had a pig, E I E I O.
With an oink, oink here and an oink, oink there.
Here an oink, there an oink, everywhere an oink, oink.
Old MacDonald had a farm, E I E I O.
Old MacDonald had a farm, E I E I O.
And on that farm he had a sheep, E I E I O.
With a baa, baa here and a baa, baa there.
Here a baa, there a baa, everywhere a baa, baa.
Old MacDonald had a farm, E I E I O.
;; tmpl
Old MacDonald had a farm, E I E I O.
And on that farm he had a {{wat}}, E I E I O.
With a {{snd}}, {{snd}} here and a {{snd}}, {{snd}} there.
Here a {{snd}}, there a {{snd}}, everywhere a {{snd}}, {{snd}}.
Old MacDonald had a farm, E I E I O.
;; pre
;; clipboard contains input data
C-x b i n C-j ;; (buffer in)
C-y ;; input
;; preprocess input
M-< C-M-% s SPC <return> SPC <return> !
M-< C-M-% g e e s e <return> g o o s e <return> !
M-<
;; prepare template from out
C-x b o u t <enter> M-< M-h M-w C-x b t e m p C-j C-y
M-<
C-M-% c o w <enter> { { w a t } } <enter>
C-M-% m o o <enter> { { s n d } } <enter>
C-x b i n <enter>
;; main macro
<f3>
;; copy and paste template
C-x o C-x o
M-h M-w
C-x o C-y
;; put animal, sound in kill-ring
C-k
;; move 2 'Old' up
C-r O l d C-r
C-a
;; replace wat -> animal
C-s w a t <return>
M-b <delete> <delete> <delete> <delete> <delete> <backspace> <backspace> C-y
M-b M-d <backspace>
;; replace snd -> sound
C-SPC M-} C-M-% { { s n d } } <return> C-y <return> !
;; next
M-}
C-f
C-u 8 <f4>
Aucun commentaire:
Enregistrer un commentaire