From: João Távora Date: Fri, 18 Dec 2020 15:38:27 +0000 (+0000) Subject: Document that flymake-diag-region saves match data X-Git-Tag: emacs-28.0.90~4665 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fdaaf886b71fc41d0d6d717af55e4927ed4cd2c1;p=emacs.git 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. --- 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)