Emacs Golf
1 :unicorn: :golf: Emacs Golf
1.1 Challege Rural Posts
1.1.1 Solution
;; Keyboard Macro Editor. Press C-c C-c to finish; press C-x k RET to cancel. ;; Original keys: C-e M-b S-C-a C-w C-n Command: last-kbd-macro Key: none Macro: C-e ;; move-end-of-line M-b ;; backward-word S-C-a C-w ;; kill-region C-n ;; next-line
1.1.2 Start File
RD 5 Gore 9775 RD 6 Gore 9776 RD 7 Gore 9777 RD 1 Great Barrier Island 0991 RD 1 Greta Valley 7387 RD 1 Greytown 5794 RD 1 Hamilton 3281 RD 2 Hamilton 3282
1.1.3 End File
9775 9776 9777 0991 7387 5794 3281 3282
1.2 Challenge Prepend * to every non-blank line
1.2.1 Solution
Run the macro 6 times since there are six non blank lines after the first one.
;; Keyboard Macro Editor. Press C-c C-c to finish; press C-x k RET to cancel. ;; Original keys: C-a * C-e M-f Command: last-kbd-macro Key: none Macro: C-a ;; move-beginning-of-line * ;; self-insert-command C-e ;; move-end-of-line M-f ;; forward-word
1.2.2 Start File
This is a very short file, but it is still full of surpises.
1.2.3 End File
*This is a *very short *file, but it is *still *full *of *surpises.
1.3 Challenge Satisfy the Go linter
1.3.1 Solution
C-M-d to go down into the parens, C-n for next line and then M-m to place the cursor at the correct indentation point
;; Keyboard Macro Editor. Press C-c C-c to finish; press C-x k RET to cancel. ;; Original keys: M-@ C-w // SPC C-y SPC TODO RET TAB C-y C-n M-m Command: last-kbd-macro Key: none Macro: M-@ ;; mark-word C-w ;; kill-region // ;; self-insert-command * 2 SPC ;; self-insert-command C-y ;; yank SPC ;; self-insert-command TODO ;; self-insert-command * 4 RET ;; newline TAB ;; indent-for-tab-command C-y ;; yank C-n ;; next-line M-m ;; back-to-indentation
1.3.2 Start File
package vars var ( Version string Debug bool )
1.3.3 End File
package vars var ( // Version TODO Version string // Debug TODO Debug bool )