GNU bug report logs - #34418
27.0.50; Flymake adds markup to buffers not specified in `flymake-make-diagnostic'

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Philipp <p.stephani2@HIDDEN>; dated Sun, 10 Feb 2019 19:45:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug Marked as fixed in versions 27.1. Request was from João Távora <joaotavora@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 34418 <at> debbugs.gnu.org:


Received: (at 34418) by debbugs.gnu.org; 2 Nov 2019 16:04:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 02 12:04:30 2019
Received: from localhost ([127.0.0.1]:32906 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iQvt7-0003ij-Ut
	for submit <at> debbugs.gnu.org; Sat, 02 Nov 2019 12:04:30 -0400
Received: from mail-wm1-f67.google.com ([209.85.128.67]:56262)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1iQvt6-0003iT-DE
 for 34418 <at> debbugs.gnu.org; Sat, 02 Nov 2019 12:04:29 -0400
Received: by mail-wm1-f67.google.com with SMTP id m17so3101963wmi.5
 for <34418 <at> debbugs.gnu.org>; Sat, 02 Nov 2019 09:04:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=Jxv+VPpC+OAoXuThRpGuYDjXCC93eZkpNt0u/CxOgEo=;
 b=kuLlBq+FVCJj7WPYJN41FVf5Fuj7wRA9nB/rHwc+stWtGfqnvophLNo8BRMNfALI1k
 4K7bDL0F8WamulGuwXHJMNMhpofPW85osGE/QqXrbwIsrdWHW9uWJuNdDg7HGqVuKk+M
 sApFzTw69IJ9nVzfb2jy66IaiKKQwuedKBS22sfuQJgSJXF4rJRyLdLg8CASV9a6gX0h
 GDhZqO4h8vB2yY5+t7xSNlah61e+UcU+eFHqo8DZFZmcMvtLpcIgDMr794hNz0w0jgOU
 IYA/EeTgJRArCibBw9+so0YMOPOLC4ZmksgQDIzBrCeB/Ee1056uhPGeFfxrkVuxnutQ
 BcCQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=Jxv+VPpC+OAoXuThRpGuYDjXCC93eZkpNt0u/CxOgEo=;
 b=J3MiuaGNYaBhmX0XVrsURW6F7WPNrPHgZosJpKh1rKUNf2JEidBnGFqMC9YEDOuG0o
 meFGLj2e+MZg5ElWC7UDIXejxqSbxYWwZNkIX0+BTpiDAavoZSUxPw0fQf9fV3ugsbCc
 j1WLUg5d9SCPbqfDVwMjKitey2RI/g9j79DqTaNrLA4WC889GsqLCdvztmpIKtgJk4L5
 70iEEAxjvlN+foJ17ns0pJNeoLaLbRENcQQcaqK+qFzaM1ei8xcIanXUMCKJxKMhEOzH
 3nkHZZ4rUO0od5VpPmhsgKn+S3bv2ct8U7UL3FppZhXwEgL0bmK840HJAUfo+vqeNRGQ
 oXnQ==
X-Gm-Message-State: APjAAAWBzp4/EXydBl0AV9jY9OU/5bNeKQky3YSTdcQDLvk214Fb0JZO
 /T/PJWbNp0WIbIDrBkshamilcQbY
X-Google-Smtp-Source: APXvYqx4FLZyAftKbbP8tgMUG0M3lcJ/yllpboji/CmTL4nTXhvaQhJzrVXjj3oPxS1wFMHTSgOlDQ==
X-Received: by 2002:a1c:4089:: with SMTP id n131mr16161875wma.86.1572710660931; 
 Sat, 02 Nov 2019 09:04:20 -0700 (PDT)
Received: from lolita.yourcompany.com
 ([2001:818:d820:9500:1ebb:afd8:ab26:f0f6])
 by smtp.gmail.com with ESMTPSA id x8sm10878097wrr.43.2019.11.02.09.04.18
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 02 Nov 2019 09:04:20 -0700 (PDT)
From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
To: Philipp <p.stephani2@HIDDEN>
Subject: Re: 27.0.50; Flymake adds markup to buffers not specified in
 `flymake-make-diagnostic'
References: <m28syna12w.fsf@HIDDEN>
Date: Sat, 02 Nov 2019 16:04:15 +0000
In-Reply-To: <m28syna12w.fsf@HIDDEN> (Philipp's message of "Sun, 10 Feb
 2019 20:35:35 +0100")
Message-ID: <87o8xumfi8.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 34418
Cc: 34418 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Philipp <p.stephani2@HIDDEN> writes:

> 1. Create two scratch buffers *a* and *b* (e.g. C-x b *a* RET).
>
> 2. Insert some text into the buffers (e.g. "text a" and "text b",
>    respectively)
>
> 3. Add a trivial Flymake backend to buffer *b*.  E.g., select *b* and
>    run M-: with the following code:
>=20=20=20=20
>    (add-hook 'flymake-diagnostic-functions
>              (lambda (report-fn &rest _args)
>                     (funcall report-fn (list (with-current-buffer "*a*"
>                     (flymake-make-diagnostic (current-buffer)
>                                              (point-min) (point-max)
>                      :error "message"))))))
>=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
>    Note that this backend adds a diagnostic for buffer *a*, not *b*.
>=20=20=20=20
> 4. Enable Flymake mode in buffer *b*.
>
> Buffer *b* will now show a diagnostic, even though it was reported for
> buffer *a*.  This should either add a diagnostic for buffer *a* or
> signal an error.

Hi Phillip,

Sorry for the very slow turnaround.

The behaviour for handling the mismatch between the (1) the buffer
passed to flymake-make-diagnostic (2) the buffer where the report
function executes is unspecified and it is so by design.

I've yet to come to a good conclusion on what that behaviour should be,
and maybe you can help me.  Let's see some plausible real-world scenarios.

1. Some uses of Flymake, notably Eglot's via LSP (Language Server
   Protocol) can possibly take advantage of a good definition of this
   behaviour, for aggregating the errors reports across a project for
   example.  So `flymake-make-diagnostic` could be specified to take a
   BUFFER-OR-FILE, and we could heuristically decide to add the
   diagnostic to, say, a per-project database.

2. In another simpler scenario, checking .c file might issue errors for
   included .h files, and if that file is open in a buffer, we could go
   there and highlight the error.  Could we really?  Maybe not, because
   the error was probably generated for the on-disk copy of the .h file,
   whose contents might differ wildly from the buffer's.  Then again, a
   smart backend could consider that.

So maybe your "error" proposal makes sense, maybe it doesn't.  I'd
rather not commit to an API right now that could block evolution.

For now I've added a note to the manual's description of
flymake-make-diagnostic and a protection to flymake--handle-report that
will ignore such diagnostics.  What do you think?

Jo=C3=A3o






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34418; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Feb 2019 19:44:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 10 14:44:15 2019
Received: from localhost ([127.0.0.1]:42792 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gsv1S-0001Za-N5
	for submit <at> debbugs.gnu.org; Sun, 10 Feb 2019 14:44:15 -0500
Received: from eggs.gnu.org ([209.51.188.92]:51206)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <p.stephani2@HIDDEN>) id 1gsv1R-0001ZN-P1
 for submit <at> debbugs.gnu.org; Sun, 10 Feb 2019 14:44:14 -0500
Received: from lists.gnu.org ([209.51.188.17]:42369)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <p.stephani2@HIDDEN>)
 id 1gsv1M-00024Q-JG
 for submit <at> debbugs.gnu.org; Sun, 10 Feb 2019 14:44:08 -0500
Received: from eggs.gnu.org ([209.51.188.92]:37167)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <p.stephani2@HIDDEN>) id 1gsv1L-0006aA-7h
 for bug-gnu-emacs@HIDDEN; Sun, 10 Feb 2019 14:44:08 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: *
X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_50,
 FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,URIBL_BLOCKED autolearn=disabled
 version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <p.stephani2@HIDDEN>) id 1gsutN-0007Ff-3k
 for bug-gnu-emacs@HIDDEN; Sun, 10 Feb 2019 14:35:55 -0500
Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:54020)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <p.stephani2@HIDDEN>)
 id 1gsutD-00078u-Sg
 for bug-gnu-emacs@HIDDEN; Sun, 10 Feb 2019 14:35:45 -0500
Received: by mail-wm1-x32f.google.com with SMTP id d15so13379651wmb.3
 for <bug-gnu-emacs@HIDDEN>; Sun, 10 Feb 2019 11:35:41 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version;
 bh=/NmegW9VIGPnVOnOr5SYJpLYs7QWFrPNAExrqw4rusw=;
 b=lhz1eXsCK8mSmk0+HNqGGV9A5OrN2nGqPj1QyH3YJz77hwK23pKD3n9f/9RCRNfDMz
 yY7olC6/60+sIiPiaAa6g0q0B983vXdHpdKLdxmEN05V/qsy2wLO2Juq64cHWxPoouMJ
 g2wEZgZF2MrOl93btO4gZIpLfAwy5sr3j7qCTg5NVdXNTFMKs91s0gbgcg0+ju1uiY29
 2mv8ogdoYZa+u4PPNYoHFyCh5vzMy00qq7o8R3EvXpw1L59Pzd8hrGWPBjPP8EjwUTaR
 /iKWECuKHb1gUmbjOv33DYJvqGcVLbXkpOsQxsXA5uw01ijZ7ad+4sg6lBJypOC74Oag
 4Ciw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version;
 bh=/NmegW9VIGPnVOnOr5SYJpLYs7QWFrPNAExrqw4rusw=;
 b=Na2yOogTjFyJd6vN/FIG559/FsNsqumM28BjT49XQ8lOhmjcwc4x+QDNj8JarT5Hj9
 GaGiMDeWkYKhFn/lIQwUJyMNm6qNoj+l4QJzKXKE+NSko2Du5A/smRZhAREVGGrND9SG
 C6wJRQLfK9hI4Yta9kn6GKOXNsDR455R0N9nZDJDXucx6BM9SIR7bFjFNmMTS3N1v2Pz
 k5eopvExUJmHqhGOuKNyWQDtFma75P4/a0xYypN2IDXa7oa7EYMxQsGI9Ac2w8NKRVOD
 0gf3dnc84X89+0AQOxgRdb/R5fg0lKjjdfOPBWCgMZADTfqkqOrpu5CJP7W5jV9Am9pf
 re2g==
X-Gm-Message-State: AHQUAuaizLVHA/VX2wWF1pqIl7xVWPH0X5cpNkaqO887lRSJcr7ZGguA
 3z+dKc/gI0FpRHRmFZ1Yt7hXZLjO
X-Google-Smtp-Source: AHgI3IaeMjg9/A2+Xx6yehGGLelp35SSYTWzssBkPc4KdU91cNHWSizNs860qDiDy2B1SvCeJFMjDQ==
X-Received: by 2002:a1c:c282:: with SMTP id s124mr6443514wmf.105.1549827339778; 
 Sun, 10 Feb 2019 11:35:39 -0800 (PST)
Received: from p ([2001:4c50:25a:f300:e0af:b2b6:5385:a84c])
 by smtp.gmail.com with ESMTPSA id m6sm4750536wrv.24.2019.02.10.11.35.38
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sun, 10 Feb 2019 11:35:39 -0800 (PST)
From: Philipp <p.stephani2@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 27.0.50; Flymake adds markup to buffers not specified in
 `flymake-make-diagnostic'
Date: Sun, 10 Feb 2019 20:35:35 +0100
Message-ID: <m28syna12w.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::32f
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  1. Create two scratch buffers *a* and *b* (e.g. C-x b *a*
 RET). 2. Insert some text into the buffers (e.g. "text a" and "text b",
 respectively)
 3. Add a trivial Flymake backend to buffer *b*. E.g., select *b* and run
 M-: with the following code: 
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: gnu.org]
 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends
 in digit (p.stephani2[at]gmail.com)
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (p.stephani2[at]gmail.com)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)


1. Create two scratch buffers *a* and *b* (e.g. C-x b *a* RET).

2. Insert some text into the buffers (e.g. "text a" and "text b",
   respectively)

3. Add a trivial Flymake backend to buffer *b*.  E.g., select *b* and
   run M-: with the following code:
   
   (add-hook 'flymake-diagnostic-functions
             (lambda (report-fn &rest _args)
                    (funcall report-fn (list (with-current-buffer "*a*"
                    (flymake-make-diagnostic (current-buffer)
                                             (point-min) (point-max)
                     :error "message"))))))
                     
   Note that this backend adds a diagnostic for buffer *a*, not *b*.
   
4. Enable Flymake mode in buffer *b*.

Buffer *b* will now show a diagnostic, even though it was reported for
buffer *a*.  This should either add a diagnostic for buffer *a* or
signal an error.

See
https://lists.gnu.org/archive/html/help-gnu-emacs/2018-12/msg00170.html
for more context.


In GNU Emacs 27.0.50 (build 37, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109))
 of 2019-02-10 built on p
Repository revision: 24695e8977c3d048e60d1fe3714b789567c2213c
Repository branch: master
Windowing system distributor 'Apple', version 10.3.1671
System Description:  Mac OS X 10.14.3

Recent messages:
C-+ is undefined
Region has 0 lines, 0 words, and 0 characters.
M-+ is undefined
Use +,-,0 for further adjustment [5 times]
Loading flymake...done
next-line: End of buffer
user-error: End of history; no default available
((lambda (report-fn &rest _args) (funcall report-fn (list ...))) flymake-proc-legacy-flymake)
Flymake mode enabled in current buffer [2 times]
mwheel-scroll: Beginning of buffer [4 times]
mwheel-scroll: Beginning of buffer
Configured using:
 'configure --without-xml2 --with-modules --without-pop --with-mailutils
 --enable-gcc-warnings=warn-only --enable-checking=yes
 --enable-check-lisp-object-type 'CFLAGS=-ggdb3 -O0''

Configured features:
IMAGEMAGICK NOTIFY KQUEUE ACL GNUTLS ZLIB TOOLKIT_SCROLL_BARS NS MODULES
THREADS JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: de_DE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Messages

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt bytecomp
byte-compile cconv dired dired-loaddefs format-spec rfc822 mml mml-sec
password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs
time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils cl-macs gv cl-seq flymake-proc flymake easymenu
compile comint ansi-color ring warnings thingatpt cl-loaddefs cl-lib
face-remap elec-pair tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads kqueue cocoa ns lcms2 multi-tty make-network-process
emacs)

Memory information:
((conses 16 56619 10244)
 (symbols 48 6929 1)
 (strings 32 17753 1870)
 (string-bytes 1 600979)
 (vectors 16 11313)
 (vector-slots 8 139126 16778)
 (floats 8 29 130)
 (intervals 56 213 28)
 (buffers 992 14))




Acknowledgement sent to Philipp <p.stephani2@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#34418; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.