From fdaaf886b71fc41d0d6d717af55e4927ed4cd2c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Fri, 18 Dec 2020 15:38:27 +0000 Subject: [PATCH] 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. --- doc/misc/flymake.texi | 2 +- 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: Compute @var{buffer}'s region (@var{beg} . @var{end}) corresponding to @var{line} and @var{col}. If @var{col} is @code{nil}, return a region just for @var{line}. Return @code{nil} if the region is -invalid. +invalid. This function saves match data (@pxref{Saving Match Data}). @end deffn @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)." (defun flymake-diag-region (buffer line &optional col) "Compute BUFFER's region (BEG . END) corresponding to LINE and COL. If COL is nil, return a region just for LINE. Return nil if the -region is invalid." +region is invalid. This function saves match data." (condition-case-unless-debug _err (with-current-buffer buffer (let ((line (min (max line 1) -- 2.39.2