Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 1 | #!/usr/bin/emacs --script |
| 2 | |
| 3 | (fset 'fix-foreach |
| 4 | [?\C-u ?\C-s ?_ ?f ?o ?r ?e ?a ?c ?h ? ?* ?\( ?\C-a ?\C-o tab ?/ ?* ? ?* ?I ?N ?D ?E ?N ?T ?- ?O ?F ?F ?* ? ?* ?/ ?\C-u ?\C-s ?\C-s ?\C-b escape ?\C-f ?\C-e ?\C-j ?/ ?* ? ?* ?I ?N ?D ?E ?N ?T ?- ?O ?N ?* ? ?* ?/]) |
| 5 | (fset 'fix-cli-command |
| 6 | [?\C-s ?C ?L ?I ?_ ?C ?O ?M ?M ?A ?N ?D ?\C-a ?\C-o ?/ ?* ? ?* ?I ?N ?D ?E ?N ?T ?- ?O ?F ?F ?* ? ?* ?/ ?\C-s ?\} ?\C-e ?\C-j ?/ ?* ? ?I ?N ?D ?E ?N backspace backspace backspace backspace backspace ?* ?I ?N ?D ?E ?N ?T ?- ?O ?N ?* ? ?* ?/]) |
| 7 | (fset 'fix-node |
| 8 | [?\C-s ?R ?E ?G ?I ?S ?T ?E ?R ?_ ?N ?O ?D ?E ?\C-a ?\C-o ?/ ?* ? ?* ?I ?N ?D ?E ?N ?T ?- ?O ?F ?F ?* ? ?* ?/ ?\C-a ?\C-n ?\C-s ?\{ ?\C-b escape ?\C-f ?\C-e ?\C-j ?/ ?* ?\S- ?* ?I ?N ?D ?E ?N ?T ?- ?O ?N ?* ? ?* ?/]) |
| 9 | |
| 10 | (fset 'fix-elog-type |
| 11 | [?\C-s ?E ?L ?O ?G ?_ ?T ?Y ?P ?E ?_ ?D ?E ?C ?L ?A ?R ?E ?\C-a ?\C-o tab ?/ ?* ? ?* ?I ?N ?D ?E ?N ?T ?- ?O ?F ?F ?* ? ?* ?/ ?\C-a ?\C-n ?\C-n tab escape ?\C-f ?\C-e ?\C-j tab ?/ ?* ? ?* ?I ?N ?D ?E ?N ?T ?- ?O ?N ?* ? ?* ?/ ?\C-a ?\C-n]) |
| 12 | |
| 13 | ;; insert style boilerplate |
| 14 | (defun insert-style-boilerplate () (interactive) |
| 15 | (save-excursion (goto-char (point-max)) |
| 16 | (insert " |
| 17 | /* |
| 18 | * fd.io coding-style-patch-verification: ON |
| 19 | * |
| 20 | * Local Variables: |
| 21 | * eval: (c-set-style \"gnu\") |
| 22 | * End: |
| 23 | */"))) |
| 24 | |
| 25 | ;; Driver routine which runs the set of keyboard macros |
| 26 | ;; defined above, as well as the bottom boilerplate lisp fn. |
| 27 | |
| 28 | (defun fd-io-styleify () (interactive) |
| 29 | (save-excursion (goto-char (point-min)) |
| 30 | (ignore-errors (execute-kbd-macro 'fix-foreach 0))) |
| 31 | (save-excursion (goto-char (point-min)) |
| 32 | (ignore-errors (execute-kbd-macro 'fix-cli-command 0))) |
| 33 | (save-excursion (goto-char (point-min)) |
| 34 | (ignore-errors (execute-kbd-macro 'fix-node 0))) |
| 35 | (save-excursion (goto-char (point-min)) |
| 36 | (ignore-errors (execute-kbd-macro 'fix-elog-type 0))) |
| 37 | (insert-style-boilerplate)) |
| 38 | |
| 39 | ;;(setq index 0) |
| 40 | ;;(while (elt argv index) |
| 41 | ;; (message "Processing argv %d is %s" index (elt argv index)) |
| 42 | ;; (find-file (elt argv index)) |
| 43 | ;; (fd-io-styleify) |
| 44 | ;; (setq index (1+ index))) |
| 45 | ;; (save-buffers-kill-emacs) |