all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Flymake ignores buffer specified in `flymake-make-diagnostic'?
@ 2018-12-12 19:48 Philipp Stephani
  2019-01-03 15:40 ` João Távora
  0 siblings, 1 reply; 3+ messages in thread
From: Philipp Stephani @ 2018-12-12 19:48 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I've noticed that Flymake ignores the buffer passed to
`flymake-make-diagnostic' and always uses the source buffer. For
example, in *scratch*:

(require 'flymake)
(with-temp-buffer
  (flymake-mode)
  (insert "text a")
  (let ((buf-a (current-buffer)))
    (with-temp-buffer
      (flymake-mode)
      (insert "text b")
      (let ((buf-b (current-buffer)))
        (add-hook 'flymake-diagnostic-functions
                  (lambda (report-fn &rest _args)
                    (funcall report-fn (list (with-current-buffer buf-a

(flymake-make-diagnostic buf-a (point-min) (point-max)

 :error "message"))) ))
                  nil :local)
        (flymake-start)
        (sit-for 1)
        (list (cons 'buf-a (with-current-buffer buf-a (flymake-diagnostics)))
              (cons 'buf-b (with-current-buffer buf-b
(flymake-diagnostics))))))))

⇒ ((buf-a) (buf-b #s(flymake--diag #<killed buffer> 1 7 :error
"message" (lambda ... ...) nil #<overlay in no buffer>)))

This seems a bit surprising, and I couldn't find documentation on it.
Is this working as intended? If so, would it be possible to clarify
the documentation a bit? Thanks!



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

* Re: Flymake ignores buffer specified in `flymake-make-diagnostic'?
  2018-12-12 19:48 Flymake ignores buffer specified in `flymake-make-diagnostic'? Philipp Stephani
@ 2019-01-03 15:40 ` João Távora
  2019-02-10 19:47   ` Philipp Stephani
  0 siblings, 1 reply; 3+ messages in thread
From: João Távora @ 2019-01-03 15:40 UTC (permalink / raw)
  To: Philipp Stephani; +Cc: help-gnu-emacs

I stumbled upon this by chance (I don't systematically read
help-gnu-emacs).

Can you make a bug report out of this, and explain what the
problem is in terms of user UI and Emacs -Q? Your code example is
a bit too convoluted for me to grok an understand right now.  Are
you running into trouble writing a new backend?

Also, flymake-make-diagnostic doesn't ignore the buffer passed to
it, flymake-show-diagnostic uses it.  But it is currently unspecified
behaviour if you make a diagnostic for any buffer other than
the one you're explicitly checking.  It might be specified to do
something useful in the future (think checking a .c file
including a .h file).

João

On Wed, Dec 12, 2018 at 8:11 PM Philipp Stephani <p.stephani2@gmail.com> wrote:
>
> Hi,
>
> I've noticed that Flymake ignores the buffer passed to
> `flymake-make-diagnostic' and always uses the source buffer. For
> example, in *scratch*:
>
> (require 'flymake)
> (with-temp-buffer
>   (flymake-mode)
>   (insert "text a")
>   (let ((buf-a (current-buffer)))
>     (with-temp-buffer
>       (flymake-mode)
>       (insert "text b")
>       (let ((buf-b (current-buffer)))
>         (add-hook 'flymake-diagnostic-functions
>                   (lambda (report-fn &rest _args)
>                     (funcall report-fn (list (with-current-buffer buf-a
>
> (flymake-make-diagnostic buf-a (point-min) (point-max)
>
>  :error "message"))) ))
>                   nil :local)
>         (flymake-start)
>         (sit-for 1)
>         (list (cons 'buf-a (with-current-buffer buf-a (flymake-diagnostics)))
>               (cons 'buf-b (with-current-buffer buf-b
> (flymake-diagnostics))))))))
>
> ⇒ ((buf-a) (buf-b #s(flymake--diag #<killed buffer> 1 7 :error
> "message" (lambda ... ...) nil #<overlay in no buffer>)))
>
> This seems a bit surprising, and I couldn't find documentation on it.
> Is this working as intended? If so, would it be possible to clarify
> the documentation a bit? Thanks!
>



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

* Re: Flymake ignores buffer specified in `flymake-make-diagnostic'?
  2019-01-03 15:40 ` João Távora
@ 2019-02-10 19:47   ` Philipp Stephani
  0 siblings, 0 replies; 3+ messages in thread
From: Philipp Stephani @ 2019-02-10 19:47 UTC (permalink / raw)
  To: João Távora; +Cc: help-gnu-emacs

Am Do., 3. Jan. 2019 um 16:40 Uhr schrieb João Távora <joaotavora@gmail.com>:
>
> I stumbled upon this by chance (I don't systematically read
> help-gnu-emacs).
>
> Can you make a bug report out of this, and explain what the
> problem is in terms of user UI and Emacs -Q?

Done (see bug#34418).

> Your code example is
> a bit too convoluted for me to grok an understand right now.  Are
> you running into trouble writing a new backend?
>
> Also, flymake-make-diagnostic doesn't ignore the buffer passed to
> it, flymake-show-diagnostic uses it.  But it is currently unspecified
> behaviour if you make a diagnostic for any buffer other than
> the one you're explicitly checking.  It might be specified to do
> something useful in the future (think checking a .c file
> including a .h file).

I think it should either signal an error or use the diagnostic for the
other buffer. At the very least, please document this fact in
https://www.gnu.org/software/emacs/manual/html_node/flymake/Backend-functions.html.



>
> João
>
> On Wed, Dec 12, 2018 at 8:11 PM Philipp Stephani <p.stephani2@gmail.com> wrote:
> >
> > Hi,
> >
> > I've noticed that Flymake ignores the buffer passed to
> > `flymake-make-diagnostic' and always uses the source buffer. For
> > example, in *scratch*:
> >
> > (require 'flymake)
> > (with-temp-buffer
> >   (flymake-mode)
> >   (insert "text a")
> >   (let ((buf-a (current-buffer)))
> >     (with-temp-buffer
> >       (flymake-mode)
> >       (insert "text b")
> >       (let ((buf-b (current-buffer)))
> >         (add-hook 'flymake-diagnostic-functions
> >                   (lambda (report-fn &rest _args)
> >                     (funcall report-fn (list (with-current-buffer buf-a
> >
> > (flymake-make-diagnostic buf-a (point-min) (point-max)
> >
> >  :error "message"))) ))
> >                   nil :local)
> >         (flymake-start)
> >         (sit-for 1)
> >         (list (cons 'buf-a (with-current-buffer buf-a (flymake-diagnostics)))
> >               (cons 'buf-b (with-current-buffer buf-b
> > (flymake-diagnostics))))))))
> >
> > ⇒ ((buf-a) (buf-b #s(flymake--diag #<killed buffer> 1 7 :error
> > "message" (lambda ... ...) nil #<overlay in no buffer>)))
> >
> > This seems a bit surprising, and I couldn't find documentation on it.
> > Is this working as intended? If so, would it be possible to clarify
> > the documentation a bit? Thanks!
> >



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

end of thread, other threads:[~2019-02-10 19:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-12 19:48 Flymake ignores buffer specified in `flymake-make-diagnostic'? Philipp Stephani
2019-01-03 15:40 ` João Távora
2019-02-10 19:47   ` Philipp Stephani

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.