diff options
author | João Távora <joaotavora@gmail.com> | 2020-12-18 11:29:28 +0000 |
---|---|---|
committer | João Távora <joaotavora@gmail.com> | 2020-12-18 11:29:28 +0000 |
commit | 95eaf45ddfd6ea639c1d31ff7627c48601f74594 (patch) | |
tree | d5bcaa922cb9b57b10320efaf67a632ff749b342 /lisp/progmodes | |
parent | c5f2eb56c0164e87abc881955552e0b718921186 (diff) | |
download | emacs-95eaf45ddfd6ea639c1d31ff7627c48601f74594.tar.gz emacs-95eaf45ddfd6ea639c1d31ff7627c48601f74594.tar.bz2 emacs-95eaf45ddfd6ea639c1d31ff7627c48601f74594.zip |
Save match data in flymake-diag-region (bug#29193)
* lisp/progmodes/flymake.el (flymake-diag-region): Move
save-match-data up.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r-- | lisp/progmodes/flymake.el | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index da026da86a2..dfb4f18cff7 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -418,40 +418,40 @@ region is invalid." (let ((line (min (max line 1) (line-number-at-pos (point-max) 'absolute)))) (save-excursion - (goto-char (point-min)) - (forward-line (1- line)) - (cl-flet ((fallback-bol - () - (back-to-indentation) - (if (eobp) - (line-beginning-position 0) - (point))) - (fallback-eol - (beg) - (progn - (end-of-line) - (skip-chars-backward " \t\f\n" beg) - (if (eq (point) beg) - (line-beginning-position 2) - (point))))) - (if (and col (cl-plusp col)) - (let* ((beg (progn (forward-char (1- col)) - (point))) - (sexp-end (or (ignore-errors (end-of-thing 'sexp)) - (save-match-data - (ignore-errors (end-of-thing 'symbol))))) - (end (or (and sexp-end - (not (= sexp-end beg)) - sexp-end) - (and (< (goto-char (1+ beg)) (point-max)) - (point))))) - (if end - (cons beg end) - (cons (setq beg (fallback-bol)) - (fallback-eol beg)))) - (let* ((beg (fallback-bol)) - (end (fallback-eol beg))) - (cons beg end))))))) + (save-match-data + (goto-char (point-min)) + (forward-line (1- line)) + (cl-flet ((fallback-bol + () + (back-to-indentation) + (if (eobp) + (line-beginning-position 0) + (point))) + (fallback-eol + (beg) + (progn + (end-of-line) + (skip-chars-backward " \t\f\n" beg) + (if (eq (point) beg) + (line-beginning-position 2) + (point))))) + (if (and col (cl-plusp col)) + (let* ((beg (progn (forward-char (1- col)) + (point))) + (sexp-end (or (ignore-errors (end-of-thing 'sexp)) + (ignore-errors (end-of-thing 'symbol)))) + (end (or (and sexp-end + (not (= sexp-end beg)) + sexp-end) + (and (< (goto-char (1+ beg)) (point-max)) + (point))))) + (if end + (cons beg end) + (cons (setq beg (fallback-bol)) + (fallback-eol beg)))) + (let* ((beg (fallback-bol)) + (end (fallback-eol beg))) + (cons beg end)))))))) (error (flymake-log :warning "Invalid region line=%s col=%s" line col) nil))) |