bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29246: Possible solution?


From: Stefan Kangas
Subject: bug#29246: Possible solution?
Date: Mon, 11 Nov 2019 03:17:59 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Lele Gaifax <lele@metapensiero.it> writes:

> I'm trying the following, that seems to fix the issue:
>
>   (defun python--flymake-parse-output (source proc report-fn)
>     "Collect diagnostics parsing checker tool's output line by line."
>     (let ((rx (nth 0 python-flymake-command-output-pattern))
>           (lineidx (nth 1 python-flymake-command-output-pattern))
>           (colidx (nth 2 python-flymake-command-output-pattern))
>           (typeidx (nth 3 python-flymake-command-output-pattern))
>           (msgidx (nth 4 python-flymake-command-output-pattern)))
>       (with-current-buffer (process-buffer proc)
>         (goto-char (point-min))
>         (cl-loop
>          while (search-forward-regexp rx nil t)
>          for msg = (match-string msgidx)
>          for (beg . end) = (flymake-diag-region
>                             source
>                             (string-to-number
>                              (match-string lineidx))
>                             (and colidx
>                                  (match-string colidx)
>                                  (string-to-number
>                                   (match-string colidx))))
>          for type = (or (and typeidx
>                              (match-string typeidx)
>                              (assoc-default
>                               (match-string typeidx)
>                               python-flymake-msg-alist
>                               #'string-match))
>                         (assoc-default msg
>                                        python-flymake-msg-alist
>                                        #'string-match)
>                         :error)
>          if (and beg end)
>            collect (flymake-make-diagnostic
>                     source beg end type msg) into diags
>          finally (funcall report-fn diags)))))
>
> where I added an `if (and beg end)' clause around `collect'.
>
> Is that reasonable, or would it be better to make `flymake--highlight-line'
> more robust againt a diagnostic with invalid `beg'/`end' slots?

Could you please provide a recipe for how to reproduce the original
issue?  Otherwise, it's hard to test your suggested patch.

Could you also send a diff (or patch) with your suggested changes
instead of the full function?  Otherwise, it's hard to see what you
have changed.  Preferably the diff should be against the current
development version of Emacs (in git).

Thanks in advance.

Best regards,
Stefan Kangas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]