unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Lele Gaifax <lele@metapensiero.it>
Cc: 29246@debbugs.gnu.org
Subject: bug#29246: Possible solution?
Date: Mon, 11 Nov 2019 03:17:59 +0100	[thread overview]
Message-ID: <8736evrwa0.fsf@marxist.se> (raw)
In-Reply-To: <87374u1zd1.fsf@metapensiero.it> (Lele Gaifax's message of "Fri,  01 Dec 2017 12:06:34 +0100")

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	other threads:[~2019-11-11  2:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10 16:08 bug#29246: 26.0.90; Wrong type argument: integer-or-marker-p, nil in flymake--highlight-line Lele Gaifax
2017-12-01 11:06 ` bug#29246: Possible solution? Lele Gaifax
2019-11-11  2:17   ` Stefan Kangas [this message]
2019-11-23  8:19     ` Lele Gaifax
2019-11-23 16:34       ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736evrwa0.fsf@marxist.se \
    --to=stefan@marxist.se \
    --cc=29246@debbugs.gnu.org \
    --cc=lele@metapensiero.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).