Mercurial > emacs
comparison lisp/progmodes/compile.el @ 30878:13a1a0ec31e5
(grep): Provide a default set of files.
(next-error): Docstring fix.
(compilation-find-file): Avoid find-file (fails in a dedicated window).
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 16 Aug 2000 20:20:43 +0000 |
parents | f0a91dd9685b |
children | e0870d1a8c33 |
comparison
equal
deleted
inserted
replaced
30877:e55b142a5369 | 30878:13a1a0ec31e5 |
---|---|
595 While grep runs asynchronously, you can use \\[next-error] (M-x next-error), | 595 While grep runs asynchronously, you can use \\[next-error] (M-x next-error), |
596 or \\<compilation-minor-mode-map>\\[compile-goto-error] in the grep \ | 596 or \\<compilation-minor-mode-map>\\[compile-goto-error] in the grep \ |
597 output buffer, to go to the lines | 597 output buffer, to go to the lines |
598 where grep found matches. | 598 where grep found matches. |
599 | 599 |
600 This command uses a special history list for its arguments, so you can | 600 This command uses a special history list for its COMMAND-ARGS, so you can |
601 easily repeat a grep command. | 601 easily repeat a grep command. |
602 | 602 |
603 A prefix argument says to default the argument based upon the current | 603 A prefix argument says to default the argument based upon the current |
604 tag the cursor is over, substituting it into the last grep command | 604 tag the cursor is over, substituting it into the last grep command |
605 in the grep command history (or into `grep-command' | 605 in the grep command history (or into `grep-command' |
615 ;; We use grep-tag-default instead of | 615 ;; We use grep-tag-default instead of |
616 ;; find-tag-default, to avoid loading etags. | 616 ;; find-tag-default, to avoid loading etags. |
617 'grep-tag-default)))) | 617 'grep-tag-default)))) |
618 (setq grep-default (or (car grep-history) grep-command)) | 618 (setq grep-default (or (car grep-history) grep-command)) |
619 ;; Replace the thing matching for with that around cursor | 619 ;; Replace the thing matching for with that around cursor |
620 (if (string-match "[^ ]+\\s +\\(-[^ ]+\\s +\\)*\\(\"[^\"]+\"\\|[^ ]+\\)" grep-default) | 620 (when (string-match "[^ ]+\\s +\\(-[^ ]+\\s +\\)*\\(\"[^\"]+\"\\|[^ ]+\\)\\(\\s-+\\S-+\\)?" grep-default) |
621 (setq grep-default (replace-match tag-default t t | 621 (unless (or (match-beginning 3) (not (stringp buffer-file-name))) |
622 (setq grep-default (concat grep-default "*." | |
623 (file-name-extension buffer-file-name)))) | |
624 (setq grep-default (replace-match tag-default t t | |
622 grep-default 2))))) | 625 grep-default 2))))) |
623 (list (read-from-minibuffer "Run grep (like this): " | 626 (list (read-from-minibuffer "Run grep (like this): " |
624 (or grep-default grep-command) | 627 (or grep-default grep-command) |
625 nil nil 'grep-history)))) | 628 nil nil 'grep-history)))) |
626 | 629 |
1403 "Visit next compilation error message and corresponding source code. | 1406 "Visit next compilation error message and corresponding source code. |
1404 | 1407 |
1405 If all the error messages parsed so far have been processed already, | 1408 If all the error messages parsed so far have been processed already, |
1406 the message buffer is checked for new ones. | 1409 the message buffer is checked for new ones. |
1407 | 1410 |
1408 A prefix arg specifies how many error messages to move; | 1411 A prefix ARGP specifies how many error messages to move; |
1409 negative means move back to previous error messages. | 1412 negative means move back to previous error messages. |
1410 Just C-u as a prefix means reparse the error message buffer | 1413 Just \\[universal-argument] as a prefix means reparse the error message buffer |
1411 and start at the first error. | 1414 and start at the first error. |
1412 | 1415 |
1413 \\[next-error] normally uses the most recently started compilation or | 1416 \\[next-error] normally uses the most recently started compilation or |
1414 grep buffer. However, it can operate on any buffer with output from | 1417 grep buffer. However, it can operate on any buffer with output from |
1415 the \\[compile] and \\[grep] commands, or, more generally, on any | 1418 the \\[compile] and \\[grep] commands, or, more generally, on any |
1645 (set-window-start w (car next-error)) | 1648 (set-window-start w (car next-error)) |
1646 (compilation-set-window-height w))) | 1649 (compilation-set-window-height w))) |
1647 | 1650 |
1648 (defun compilation-find-file (marker filename dir &rest formats) | 1651 (defun compilation-find-file (marker filename dir &rest formats) |
1649 "Find a buffer for file FILENAME. | 1652 "Find a buffer for file FILENAME. |
1650 Search the directories in compilation-search-path. | 1653 Search the directories in `compilation-search-path'. |
1651 A nil in compilation-search-path means to try the | 1654 A nil in `compilation-search-path' means to try the |
1652 current directory, which is passed in DIR. | 1655 current directory, which is passed in DIR. |
1653 If FILENAME is not found at all, ask the user where to find it. | 1656 If FILENAME is not found at all, ask the user where to find it. |
1654 Pop up the buffer containing MARKER and scroll to MARKER if we ask the user." | 1657 Pop up the buffer containing MARKER and scroll to MARKER if we ask the user." |
1655 (or formats (setq formats '("%s"))) | 1658 (or formats (setq formats '("%s"))) |
1656 (save-excursion | 1659 (save-excursion |
1668 fmts formats) | 1671 fmts formats) |
1669 ;; For each directory, try each format string. | 1672 ;; For each directory, try each format string. |
1670 (while (and fmts (null buffer)) | 1673 (while (and fmts (null buffer)) |
1671 (setq name (expand-file-name (format (car fmts) filename) thisdir) | 1674 (setq name (expand-file-name (format (car fmts) filename) thisdir) |
1672 buffer (and (file-exists-p name) | 1675 buffer (and (file-exists-p name) |
1673 (find-file name)) | 1676 (find-file-noselect name)) |
1674 fmts (cdr fmts))) | 1677 fmts (cdr fmts))) |
1675 (setq dirs (cdr dirs))) | 1678 (setq dirs (cdr dirs))) |
1676 (or buffer | 1679 (or buffer |
1677 ;; The file doesn't exist. | 1680 ;; The file doesn't exist. |
1678 ;; Ask the user where to find it. | 1681 ;; Ask the user where to find it. |