From caa63cc96cfd2d21872eba17a474b4535178ad58 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 3 Nov 2017 08:33:13 -0400 Subject: * lisp/progmodes/flymake.el (flymake-start): Fix dead buffer case Don't try to flymake-start within a buffer that doesn't exist any more. --- lisp/progmodes/flymake.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lisp/progmodes/flymake.el') diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 1048bc50655..c2349d8c7cc 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -601,8 +601,8 @@ not expected." (null expected-token)) ;; should never happen (flymake-error "Unexpected report from stopped backend %s" backend)) - ((and (not (eq expected-token token)) - (not force)) + ((not (or (eq expected-token token) + force)) (flymake-error "Obsolete report from backend %s with explanation %s" backend explanation)) ((eq :panic report-action) @@ -742,8 +742,11 @@ Interactively, with a prefix arg, FORCE is t." () (remove-hook 'post-command-hook #'start-post-command nil) - (with-current-buffer buffer - (flymake-start (remove 'post-command deferred) force))) + ;; The buffer may have disappeared already, e.g. because of + ;; code like `(with-temp-buffer (python-mode) ...)'. + (when (buffer-live-p buffer) + (with-current-buffer buffer + (flymake-start (remove 'post-command deferred) force)))) (start-on-display () (remove-hook 'window-configuration-change-hook #'start-on-display -- cgit v1.2.1 From c25113d4ac20ceb2b7697e1df8dd649e01228779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Fri, 3 Nov 2017 16:53:45 +0000 Subject: Don't resignal errors in flymake-diag-region * lisp/progmodes/flymake.el (flymake-diag-region): Use flymake-log instead of flymake-error. --- lisp/progmodes/flymake.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/progmodes/flymake.el') diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index c2349d8c7cc..e13d79770e5 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -342,7 +342,7 @@ region is invalid." (let* ((beg (fallback-bol)) (end (fallback-eol beg))) (cons beg end))))))) - (error (flymake-error "Invalid region line=%s col=%s" line col)))) + (error (flymake-log :warning "Invalid region line=%s col=%s" line col)))) (defvar flymake-diagnostic-functions nil "Special hook of Flymake backends that check a buffer. -- cgit v1.2.1 From a2cc6d74c5b94633e7fc044765e0ef40a8d63f50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sun, 5 Nov 2017 14:58:07 +0000 Subject: Fix Flymake help-echo functions across windows (bug#29142) * lisp/progmodes/flymake.el (flymake--highlight-line): Use with-selected-window. (flymake-goto-next-error): Call help-echo with a window and an overlay. --- lisp/progmodes/flymake.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lisp/progmodes/flymake.el') diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index e13d79770e5..e833cd949ee 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -520,11 +520,12 @@ associated `flymake-category' return DEFAULT." (flymake--fringe-overlay-spec (overlay-get ov 'bitmap))) (default-maybe 'help-echo - (lambda (_window _ov pos) - (mapconcat - #'flymake--diag-text - (flymake-diagnostics pos) - "\n"))) + (lambda (window _ov pos) + (with-selected-window window + (mapconcat + #'flymake--diag-text + (flymake-diagnostics pos) + "\n")))) (default-maybe 'severity (warning-numeric-level :error)) (default-maybe 'priority (+ 100 (overlay-get ov 'severity)))) ;; Some properties can't be overridden. @@ -949,7 +950,7 @@ applied." (message "%s" (funcall (overlay-get target 'help-echo) - nil nil (point))))) + (selected-window) target (point))))) (interactive (user-error "No more Flymake errors%s" (if filter -- cgit v1.2.1