diff options
| author | João Távora | 2020-12-18 15:38:27 +0000 |
|---|---|---|
| committer | João Távora | 2020-12-18 15:38:35 +0000 |
| commit | fdaaf886b71fc41d0d6d717af55e4927ed4cd2c1 (patch) | |
| tree | 14dc4ae7e86afe6436e86a44a14ef1bbbead7381 | |
| parent | eeade2b64767bfce9118eae36c25363a7fb6ea76 (diff) | |
| download | emacs-fdaaf886b71fc41d0d6d717af55e4927ed4cd2c1.tar.gz emacs-fdaaf886b71fc41d0d6d717af55e4927ed4cd2c1.zip | |
Document that flymake-diag-region saves match data
The typical use of this function (which is parsing compiler diagnostic
messages), lends itself too easily to one the problems in bug#29193.
Make it a friendlier API.
* doc/misc/flymake.texi (Flymake utility functions): Document that
flymake-diag-region saves match data.
* lisp/progmodes/flymake.el (flymake-diag-region): Document that
this saves match data.
| -rw-r--r-- | doc/misc/flymake.texi | 2 | ||||
| -rw-r--r-- | lisp/progmodes/flymake.el | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index b4757938e99..f4fc26d896b 100644 --- a/doc/misc/flymake.texi +++ b/doc/misc/flymake.texi | |||
| @@ -581,7 +581,7 @@ can use the following function: | |||
| 581 | Compute @var{buffer}'s region (@var{beg} . @var{end}) corresponding | 581 | Compute @var{buffer}'s region (@var{beg} . @var{end}) corresponding |
| 582 | to @var{line} and @var{col}. If @var{col} is @code{nil}, return a | 582 | to @var{line} and @var{col}. If @var{col} is @code{nil}, return a |
| 583 | region just for @var{line}. Return @code{nil} if the region is | 583 | region just for @var{line}. Return @code{nil} if the region is |
| 584 | invalid. | 584 | invalid. This function saves match data (@pxref{Saving Match Data}). |
| 585 | @end deffn | 585 | @end deffn |
| 586 | 586 | ||
| 587 | @cindex add a log message | 587 | @cindex add a log message |
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index dfb4f18cff7..40bb90d0f15 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el | |||
| @@ -412,7 +412,7 @@ verify FILTER, a function, and sort them by COMPARE (using KEY)." | |||
| 412 | (defun flymake-diag-region (buffer line &optional col) | 412 | (defun flymake-diag-region (buffer line &optional col) |
| 413 | "Compute BUFFER's region (BEG . END) corresponding to LINE and COL. | 413 | "Compute BUFFER's region (BEG . END) corresponding to LINE and COL. |
| 414 | If COL is nil, return a region just for LINE. Return nil if the | 414 | If COL is nil, return a region just for LINE. Return nil if the |
| 415 | region is invalid." | 415 | region is invalid. This function saves match data." |
| 416 | (condition-case-unless-debug _err | 416 | (condition-case-unless-debug _err |
| 417 | (with-current-buffer buffer | 417 | (with-current-buffer buffer |
| 418 | (let ((line (min (max line 1) | 418 | (let ((line (min (max line 1) |