diff options
| author | Dmitry Gutov | 2016-05-04 01:59:29 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2016-05-04 01:59:29 +0300 |
| commit | 4d8fd9cf338cf9b5dfc613657adfeabff2d9c14e (patch) | |
| tree | 6878332f280455e3a9a513246b1eccfcea04fc97 /lisp | |
| parent | f559b374a30f3615261f7a902fc3428cac6289f4 (diff) | |
| download | emacs-4d8fd9cf338cf9b5dfc613657adfeabff2d9c14e.tar.gz emacs-4d8fd9cf338cf9b5dfc613657adfeabff2d9c14e.zip | |
Handle "empty line" regexp in xref searches
* lisp/progmodes/xref.el (xref--collect-matches-1): Stop after one
match if re-search-forward doesn't move point (bug#23426).
* test/automated/xref-tests.el
(xref-collect-matches-finds-an-empty-line-regexp-match):
Uncomment test.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/progmodes/xref.el | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 540c7b0e925..62cef235988 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el | |||
| @@ -1016,7 +1016,11 @@ directory, used as the root of the ignore globs." | |||
| 1016 | (syntax-propertize line-end) | 1016 | (syntax-propertize line-end) |
| 1017 | ;; FIXME: This results in several lines with the same | 1017 | ;; FIXME: This results in several lines with the same |
| 1018 | ;; summary. Solve with composite pattern? | 1018 | ;; summary. Solve with composite pattern? |
| 1019 | (while (re-search-forward regexp line-end t) | 1019 | (while (and |
| 1020 | ;; REGEXP might match an empty string. Or line. | ||
| 1021 | (or (null matches) | ||
| 1022 | (> (point) line-beg)) | ||
| 1023 | (re-search-forward regexp line-end t)) | ||
| 1020 | (let* ((beg-column (- (match-beginning 0) line-beg)) | 1024 | (let* ((beg-column (- (match-beginning 0) line-beg)) |
| 1021 | (end-column (- (match-end 0) line-beg)) | 1025 | (end-column (- (match-end 0) line-beg)) |
| 1022 | (loc (xref-make-file-location file line beg-column)) | 1026 | (loc (xref-make-file-location file line beg-column)) |