OLD | NEW |
1 ; To use this, | 1 ; To use this, |
2 ; 1) Add to init.el: | 2 ; 1) Add to init.el: |
3 ; (setq-default chrome-root "/path/to/chrome/src/") | 3 ; (setq-default chrome-root "/path/to/chrome/src/") |
4 ; (add-to-list 'load-path (concat chrome-root "tools/emacs")) | 4 ; (add-to-list 'load-path (concat chrome-root "tools/emacs")) |
5 ; (require 'trybot) | 5 ; (require 'trybot) |
6 ; 2) Run on trybot output: | 6 ; 2) Run on trybot output: |
7 ; M-x trybot | 7 ; M-x trybot |
8 ; | 8 ; |
9 ; To hack on this, | 9 ; To hack on this, |
10 ; M-x eval-buffer | 10 ; M-x eval-buffer |
(...skipping 27 matching lines...) Expand all Loading... |
38 (if corrected-path | 38 (if corrected-path |
39 (file-relative-name (directory-file-name corrected-path) | 39 (file-relative-name (directory-file-name corrected-path) |
40 (get-chrome-root)) | 40 (get-chrome-root)) |
41 nil)))) | 41 nil)))) |
42 | 42 |
43 (defun trybot-fixup-win () | 43 (defun trybot-fixup-win () |
44 "Fix up Windows-specific output." | 44 "Fix up Windows-specific output." |
45 | 45 |
46 ; Fix Windows paths ("d:\...\src\"). | 46 ; Fix Windows paths ("d:\...\src\"). |
47 (save-excursion | 47 (save-excursion |
48 (while (re-search-forward "\\(^.:\\\\.*\\\\src\\\\\\)\\(.*?\\)[(:]" nil t) | 48 ; This regexp is subtle and rather hard to read. :~( |
| 49 ; Use regexp-builder when making changes to it. |
| 50 (while (re-search-forward |
| 51 (concat |
| 52 ; First part: path leader, either of the form |
| 53 ; e:\...src\ or ..\ |
| 54 "\\(^.:\\\\.*\\\\src\\\\\\|\\.\\.\\\\\\)" |
| 55 ; Second part: path, followed by error message marker. |
| 56 "\\(.*?\\)[(:]") nil t) |
49 (replace-match "" nil t nil 1) | 57 (replace-match "" nil t nil 1) |
50 ; Line now looks like: | 58 ; Line now looks like: |
51 ; foo\bar\baz.cc error message here | 59 ; foo\bar\baz.cc error message here |
52 ; We want to fixup backslashes in path into forward slashes, | 60 ; We want to fixup backslashes in path into forward slashes, |
53 ; without modifying the error message - by matching up to the | 61 ; without modifying the error message - by matching up to the |
54 ; first colon above (which will be just beyond the end of the | 62 ; first colon above (which will be just beyond the end of the |
55 ; filename) we can use the end of the match as a limit. | 63 ; filename) we can use the end of the match as a limit. |
56 (subst-char-in-region (point) (match-end 0) ?\\ ?/) | 64 (subst-char-in-region (point) (match-end 0) ?\\ ?/) |
57 ; See if we can correct the file name casing. | 65 ; See if we can correct the file name casing. |
58 (let ((filename (buffer-substring (match-beginning 2) (match-end 2)))) | 66 (let ((filename (buffer-substring (match-beginning 2) (match-end 2)))) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 (setq url (concat url "/text"))) | 167 (setq url (concat url "/text"))) |
160 | 168 |
161 (let ((type-hint (cond ((string-match "/[Ww]in" url) 'win) | 169 (let ((type-hint (cond ((string-match "/[Ww]in" url) 'win) |
162 ((string-match "/mac/" url) 'mac) | 170 ((string-match "/mac/" url) 'mac) |
163 ; Match /linux, /linux_view, etc. | 171 ; Match /linux, /linux_view, etc. |
164 ((string-match "/linux" url) 'linux) | 172 ((string-match "/linux" url) 'linux) |
165 (t 'unknown)))) | 173 (t 'unknown)))) |
166 (trybot-fetch type-hint url))) | 174 (trybot-fetch type-hint url))) |
167 | 175 |
168 (provide 'trybot) | 176 (provide 'trybot) |
OLD | NEW |