unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29246: 26.0.90; Wrong type argument: integer-or-marker-p, nil in flymake--highlight-line
@ 2017-11-10 16:08 Lele Gaifax
  2017-12-01 11:06 ` bug#29246: Possible solution? Lele Gaifax
  0 siblings, 1 reply; 5+ messages in thread
From: Lele Gaifax @ 2017-11-10 16:08 UTC (permalink / raw)
  To: 29246

I recompiled my Emacs this morning, to get advantage of the fix to issue
#29174:

In GNU Emacs 26.0.90 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.22.25)
 of 2017-11-10 built on nautilus
Repository revision: e6f1fd40916afb692bd25e845ee87e73549201f4

I got an error with the following backtrace, keeping the backspace key pressed
to delete a dozen of characters on the last line of a Python buffer:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  make-overlay(nil nil)
  (and t (make-overlay (progn (or (and (memq (type-of diagnostic) cl-struct-flymake--diag-tags) t) (signal 'wrong-type-argument (list 'flymake--diag diagnostic))) (aref diagnostic 2)) (progn (or (and (memq (type-of diagnostic) cl-struct-flymake--diag-tags) t) (signal 'wrong-type-argument (list 'flymake--diag diagnostic))) (aref diagnostic 3))))
  (let* ((ov (and t (make-overlay (progn (or (and (memq (type-of diagnostic) cl-struct-flymake--diag-tags) t) (signal 'wrong-type-argument (list 'flymake--diag diagnostic))) (aref diagnostic 2)) (progn (or (and (memq (type-of diagnostic) cl-struct-flymake--diag-tags) t) (signal 'wrong-type-argument (list 'flymake--diag diagnostic))) (aref diagnostic 3)))))) (if ov (progn (let ((alist (assoc-default (progn (or (and (memq (type-of diagnostic) cl-struct-flymake--diag-tags) t) (signal 'wrong-type-argument (list 'flymake--diag diagnostic))) (aref diagnostic 4)) flymake-diagnostic-types-alist))) (overlay-put ov 'category (assoc-default 'flymake-category alist)) (let* ((--cl-var-- alist) (v nil) (k nil)) (while (consp --cl-var--) (setq v (car --cl-var--) k (car-safe (prog1 v (setq v (cdr v))))) (if (eq k 'category) (progn) (overlay-put ov k v)) (setq --cl-var-- (cdr --cl-var--))) nil)) (let* ((--cl-default-maybe-- (function (lambda (prop value) (if (or (plist-member (overlay-properties ov) prop) (let ((cat (overlay-get ov 'flymake-category))) (and cat (plist-member (symbol-plist cat) prop)))) nil (overlay-put ov prop value)))))) (progn (funcall --cl-default-maybe-- 'bitmap 'flymake-error-bitmap) (funcall --cl-default-maybe-- 'face 'flymake-error) (funcall --cl-default-maybe-- 'before-string (flymake--fringe-overlay-spec (overlay-get ov 'bitmap))) (funcall --cl-default-maybe-- 'help-echo (function (lambda (window _ov pos) (let ((save-selected-window--state (internal--before-with-selected-window window))) (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) 'norecord) (mapconcat (function flymake--diag-text) (flymake-diagnostics pos) "\n")) (internal--after-with-selected-window save-selected-window--state))))))) (funcall --cl-default-maybe-- 'severity (warning-numeric-level :error)) (funcall --cl-default-maybe-- 'priority (+ 100 (overlay-get ov 'severity))))) (overlay-put ov 'evaporate t) (overlay-put ov 'flymake-diagnostic diagnostic))))
  flymake--highlight-line(#s(flymake--diag :buffer #<buffer ddl.py> :beg nil :end nil :type :note :text "W292 no newline at end of file" :backend nil))
  #f(compiled-function (diag) #<bytecode 0x19f668d>)(#s(flymake--diag :buffer #<buffer ddl.py> :beg nil :end nil :type :note :text "W292 no newline at end of file" :backend nil))
  mapc(#f(compiled-function (diag) #<bytecode 0x19f668d>) (#s(flymake--diag :buffer #<buffer ddl.py> :beg 2915 :end 2916 :type :error :text "F821 undefined name 'pdb'" :backend python-flymake) #s(flymake--diag :buffer #<buffer ddl.py> :beg nil :end nil :type :note :text "W292 no newline at end of file" :backend nil)))
  flymake--handle-report(python-flymake backend-token989 (#s(flymake--diag :buffer #<buffer ddl.py> :beg 2915 :end 2916 :type :error :text "F821 undefined name 'pdb'" :backend python-flymake) #s(flymake--diag :buffer #<buffer ddl.py> :beg nil :end nil :type :note :text "W292 no newline at end of file" :backend nil)))
  apply(flymake--handle-report python-flymake backend-token989 (#s(flymake--diag :buffer #<buffer ddl.py> :beg 2915 :end 2916 :type :error :text "F821 undefined name 'pdb'" :backend python-flymake) #s(flymake--diag :buffer #<buffer ddl.py> :beg nil :end nil :type :note :text "W292 no newline at end of file" :backend nil)))
  #f(compiled-function (&rest args) #<bytecode 0x18f3015>)((#s(flymake--diag :buffer #<buffer ddl.py> :beg 2915 :end 2916 :type :error :text "F821 undefined name 'pdb'" :backend python-flymake) #s(flymake--diag :buffer #<buffer ddl.py> :beg nil :end nil :type :note :text "W292 no newline at end of file" :backend nil)))
  python--flymake-parse-output(#<buffer ddl.py> #<process python-flymake> #f(compiled-function (&rest args) #<bytecode 0x18f3015>))
  #f(compiled-function (proc event) #<bytecode 0x1134fb5>)(#<process python-flymake> "exited abnormally with code 1\n")

Thanks&bye,
so-sorry-to-bother-you-again-ly, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#29246: Possible solution?
  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 ` Lele Gaifax
  2019-11-11  2:17   ` Stefan Kangas
  0 siblings, 1 reply; 5+ messages in thread
From: Lele Gaifax @ 2017-12-01 11:06 UTC (permalink / raw)
  To: 29246

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?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#29246: Possible solution?
  2017-12-01 11:06 ` bug#29246: Possible solution? Lele Gaifax
@ 2019-11-11  2:17   ` Stefan Kangas
  2019-11-23  8:19     ` Lele Gaifax
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Kangas @ 2019-11-11  2:17 UTC (permalink / raw)
  To: Lele Gaifax; +Cc: 29246

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#29246: Possible solution?
  2019-11-11  2:17   ` Stefan Kangas
@ 2019-11-23  8:19     ` Lele Gaifax
  2019-11-23 16:34       ` Stefan Kangas
  0 siblings, 1 reply; 5+ messages in thread
From: Lele Gaifax @ 2019-11-23  8:19 UTC (permalink / raw)
  To: 29246

Stefan Kangas <stefan@marxist.se> writes:

> Could you please provide a recipe for how to reproduce the original
> issue?

I think this can be closed: I kept the mentioned override in my .emacs.d for a
while, but at some point (sorry, lost track) I tried to remove it and never
experienced the problem again: I'm using stock version since many moons ago.

By any chance, something has been fixed in flymake-diag-region.

Thank you,
bye, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#29246: Possible solution?
  2019-11-23  8:19     ` Lele Gaifax
@ 2019-11-23 16:34       ` Stefan Kangas
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Kangas @ 2019-11-23 16:34 UTC (permalink / raw)
  To: Lele Gaifax; +Cc: 29246-done

Lele Gaifax <lele@metapensiero.it> writes:

> Stefan Kangas <stefan@marxist.se> writes:
>
>> Could you please provide a recipe for how to reproduce the original
>> issue?
>
> I think this can be closed: I kept the mentioned override in my .emacs.d for a
> while, but at some point (sorry, lost track) I tried to remove it and never
> experienced the problem again: I'm using stock version since many moons ago.
>
> By any chance, something has been fixed in flymake-diag-region.

Thanks for reporting back.  Closing now.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-11-23 16:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-11-23  8:19     ` Lele Gaifax
2019-11-23 16:34       ` Stefan Kangas

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).