unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#55811: 29.0.50; No flymake diagnostics for no-byte-compile files
@ 2022-06-05 20:22 Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-05 20:33 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-05 20:22 UTC (permalink / raw)
  To: 55811; +Cc: João Távora

Package: Emacs
Version: 29.0.50


As the title says, if you enable `flymake-mode` in an ELisp file with
a `no-byte-compile: t` in its file-local variables you don't get any
diagnostics from the compiler (you do still get diagnostics from
checkdoc, admittedly).

I think `no-byte-compile` only means that we should load the `.el` file
and not generate a `.elc` file and it shouldn't mean that we should
refrain from asking the byte-compiler what is its opinion about the
quality of this code.


        Stefan



In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars)
 of 2022-05-27 built on pastel
Repository revision: 0217902f8b8f1611fec87f4874edbbf485120f9b
Repository branch: work
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure -C --enable-checking --enable-check-lisp-object-type --with-modules --with-cairo --with-tiff=ifavailable
 'CFLAGS=-Wall -g3 -Og -Wno-pointer-sign'
 PKG_CONFIG_PATH=/home/monnier/lib/pkgconfig'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND
THREADS TOOLKIT_SCROLL_BARS X11 XAW3D XDBE XIM XINPUT2 XPM LUCID ZLIB

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

Major mode: InactiveMinibuffer

Minor modes in effect:
  csv-field-index-mode: t
  shell-dirtrack-mode: t
  server-mode: t
  electric-pair-mode: t
  global-reveal-mode: t
  reveal-mode: t
  auto-insert-mode: t
  savehist-mode: t
  minibuffer-electric-default-mode: t
  global-compact-docstrings-mode: t
  url-handler-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  global-prettify-symbols-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/monnier/src/emacs/nongnu/packages/geiser-kawa/geiser-kawa-autoloads hides /home/monnier/src/emacs/nongnu/packages/geiser-kawa/elisp/geiser-kawa-autoloads
/home/monnier/src/emacs/nongnu/packages/geiser/geiser-autoloads hides /home/monnier/src/emacs/nongnu/packages/geiser/elisp/geiser-autoloads
/home/monnier/src/emacs/nongnu/packages/arduino-mode/ob-arduino hides /home/monnier/src/emacs/nongnu/packages/org-contrib/lisp/ob-arduino
/home/monnier/src/emacs/nongnu/packages/org-contrib/org-contrib-autoloads hides /home/monnier/src/emacs/nongnu/packages/org-contrib/lisp/org-contrib-autoloads
/home/monnier/src/emacs/nongnu/packages/magit/magit-section-pkg hides /home/monnier/src/emacs/nongnu/packages/magit/lisp/magit-section-pkg
/home/monnier/src/emacs/nongnu/packages/magit/git-commit-autoloads hides /home/monnier/src/emacs/nongnu/packages/magit/lisp/git-commit-autoloads
/home/monnier/src/emacs/nongnu/packages/magit/magit-pkg hides /home/monnier/src/emacs/nongnu/packages/magit/lisp/magit-pkg
/home/monnier/src/emacs/nongnu/packages/magit/git-commit-pkg hides /home/monnier/src/emacs/nongnu/packages/magit/lisp/git-commit-pkg
/home/monnier/src/emacs/nongnu/packages/magit/magit-section-autoloads hides /home/monnier/src/emacs/nongnu/packages/magit/lisp/magit-section-autoloads
/home/monnier/src/emacs/nongnu/packages/magit/magit-autoloads hides /home/monnier/src/emacs/nongnu/packages/magit/lisp/magit-autoloads
/home/monnier/src/emacs/nongnu/packages/pdf-tools/pdf-tools-autoloads hides /home/monnier/src/emacs/nongnu/packages/pdf-tools/lisp/pdf-tools-autoloads
/home/monnier/src/emacs/nongnu/packages/php-mode/php-mode-autoloads hides /home/monnier/src/emacs/nongnu/packages/php-mode/lisp/php-mode-autoloads
/home/monnier/src/emacs/nongnu/packages/jade-mode/sws-mode hides /home/monnier/src/emacs/nongnu/packages/stylus-mode/sws-mode
/home/monnier/src/emacs/nongnu/packages/jade-mode/jade-mode hides /home/monnier/src/emacs/nongnu/packages/stylus-mode/jade-mode
/home/monnier/src/emacs/nongnu/packages/jade-mode/stylus-mode hides /home/monnier/src/emacs/nongnu/packages/stylus-mode/stylus-mode
/home/monnier/src/emacs/nongnu/packages/subed/subed-autoloads hides /home/monnier/src/emacs/nongnu/packages/subed/subed/subed-autoloads
/home/monnier/src/emacs/nongnu/packages/with-editor/with-editor-autoloads hides /home/monnier/src/emacs/nongnu/packages/with-editor/lisp/with-editor-autoloads
/home/monnier/src/emacs/elpa/packages/bbdb/bbdb-autoloads hides /home/monnier/src/emacs/elpa/packages/bbdb/lisp/bbdb-autoloads
/home/monnier/src/emacs/nongnu/packages/paredit/test hides /home/monnier/src/emacs/elpa/packages/easy-kill/test
/home/monnier/src/emacs/elpa/packages/emacspeak/emacspeak-autoloads hides /home/monnier/src/emacs/elpa/packages/emacspeak/lisp/emacspeak-autoloads
/home/monnier/src/emacs/elpa/packages/embark-consult/embark-consult hides /home/monnier/src/emacs/elpa/packages/embark/embark-consult
/home/monnier/src/emacs/elpa/packages/embark-consult/embark hides /home/monnier/src/emacs/elpa/packages/embark/embark
/home/monnier/src/emacs/elpa/packages/embark-consult/embark-org hides /home/monnier/src/emacs/elpa/packages/embark/embark-org
/home/monnier/src/emacs/elpa/packages/embark-consult/avy-embark-collect hides /home/monnier/src/emacs/elpa/packages/embark/avy-embark-collect
/home/monnier/src/emacs/nongnu/packages/paredit/test hides /home/monnier/src/emacs/elpa/packages/pq/test
/home/monnier/src/emacs/elpa/packages/realgud-lldb/cask-install hides /home/monnier/src/emacs/elpa/packages/realgud-trepan-ni/cask-install
/home/monnier/src/emacs/elpa/packages/realgud-lldb/cask-install hides /home/monnier/src/emacs/elpa/packages/realgud/cask-install
/home/monnier/src/emacs/elpa/packages/srht/srht-autoloads hides /home/monnier/src/emacs/elpa/packages/srht/lisp/srht-autoloads
/home/monnier/src/emacs/elpa/packages/taxy/taxy-magit-section hides /home/monnier/src/emacs/elpa/packages/taxy-magit-section/taxy-magit-section
/home/monnier/src/emacs/elpa/packages/transient/transient-autoloads hides /home/monnier/src/emacs/elpa/packages/transient/lisp/transient-autoloads
/home/monnier/src/emacs/elpa/packages/transient/lisp/transient hides /home/monnier/src/emacs/work/lisp/transient
/home/monnier/src/emacs/nongnu/packages/lua-mode/lua-mode hides /home/monnier/src/emacs/work/lisp/progmodes/lua-mode
/home/monnier/src/emacs/elpa/packages/emacspeak/lisp/tetris hides /home/monnier/src/emacs/work/lisp/play/tetris
/home/monnier/src/emacs/nongnu/packages/org-contrib/lisp/ox-koma-letter hides /home/monnier/src/emacs/work/lisp/org/ox-koma-letter
/home/monnier/src/emacs/nongnu/packages/org-contrib/lisp/ol-man hides /home/monnier/src/emacs/work/lisp/org/ol-man
/home/monnier/src/emacs/nongnu/packages/org-contrib/lisp/ob-julia hides /home/monnier/src/emacs/work/lisp/org/ob-julia
/home/monnier/src/emacs/work/lisp/keymap hides /home/monnier/src/emacs/work/lisp/emacs-lisp/keymap
/home/monnier/.emacs.d/elpa/hyperbole-8.0.0/set hides /home/monnier/src/emacs/work/lisp/emacs-lisp/set
/home/monnier/src/emacs/elpa/packages/crisp/crisp hides /home/monnier/src/emacs/work/lisp/obsolete/crisp
/home/monnier/src/emacs/elpa/packages/landmark/landmark hides /home/monnier/src/emacs/work/lisp/obsolete/landmark

Features:
(sml-mode emms-source-file locate emms emms-compat eev-wrap
eev-template0 eev-env eepitch eev-multiwindow ielm buttercup ert
buttercup-compat descr-text csv-mode beancount cus-edit cus-start
cus-load autoconf autoconf-mode sh-script epa-file bindat markdown-mode
bbdb-com bbdb bbdb-site timezone make-mode rfc2104 mailalias smtpmail
textsec uni-scripts idna-mapping ucs-normalize uni-confusable
textsec-check pp shadow sort mail-extr emacsbug rect sm-c-mode
drupal/emacs-drush drupal/etags etags fileloop xref reposition
mm-archive url-dav url-http-ntlm ntlm hmac-md5 hex-util md4
network-stream url-cache url-http url-gw nsm reftex-ref reftex-cite
reftex-parse dabbrev tuareg speedbar imenu ezimage dframe skeleton
tuareg-compat tuareg-opam smie caml-types caml-help find-file dired-aux
drupal/ispell drupal/eldoc drupal/autoinsert drupal-mode cc-styles
cc-align cc-engine cc-langs cc-vars cc-defs sql dired-x view cal-china
lunar solar cal-dst cal-bahai cal-islam cal-hebrew holidays hol-loaddefs
cal-french org-journal org-crypt cal-iso diary-lib diary-loaddefs
cal-move html5-schema rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid
rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn
nxml-ns nxml-mode nxml-outln nxml-rap sgml-mode facemenu nxml-util
nxml-enc xmltok reftex-dcr reftex reftex-loaddefs reftex-vars tex-mode
latexenc org-eldoc org-element avl-tree generator ol-eww eww xdg
url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr
pixel-fill kinsoku url-file url-dired svg dom gnus-group gnus-undo
gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7
netrc nnoo parse-time gnus-spec gnus-int gnus-range gnus-win gnus
nnheader range wid-edit ol-docview doc-view jka-compr image-mode exif
ol-bibtex ol-bbdb ol-w3m ol-doi org-link-doi org ob ob-tangle ob-ref
ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint
org-pcomplete org-list org-faces org-entities org-version ob-emacs-lisp
ob-core ob-eval org-table oc-basic bibtex iso8601 ol org-keys oc
org-compat advice org-macs org-loaddefs format-spec cal-menu calendar
cal-loaddefs gitignore-mode conf-mode ffap cl-print debug backtrace
find-func vc-mtn vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs vc-got
vc-annotate vc-dir ewoc shortdoc gnutls mule-util magit-utils crm dash
log-edit message sendmail yank-media rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader add-log
whitespace pulse color display-line-numbers bug-reference edmacro kmacro
smerge-mode cl-extra wgrep executable copyright shell drupal/pcomplete
pcomplete files-x grep autoload misearch multi-isearch vc-fossil
vc-backup log-view pcvs-util vc diff vc-git diff-mode vc-dispatcher
filecache autorevert filenotify raku-detect server time-date
flymake-proc flymake project compile text-property-search comint
ansi-color warnings noutline outline easy-mmode flyspell ispell checkdoc
lisp-mnt thingatpt load-dir elec-pair reveal autoinsert savehist
minibuf-eldef disp-table compact-docstrings ede/auto eieio-base
geiser-impl help-fns radix-tree help-mode geiser-custom geiser-base ring
proof-site proof-autoloads slime-autoloads sly-autoloads rx cl-seq
engrave-faces gnu-elpa-features realgud-recursive-autoloads finder-inf
compat url-auth info package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap url-handlers url-parse auth-source eieio eieio-core cl-macs gv
pcase eieio-loaddefs password-cache json subr-x map url-vars seq
byte-opt bytecomp byte-compile cl-loaddefs cl-lib iso-transl tooltip
cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice simple cl-generic
indonesian philippine 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 emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray button loaddefs oclosure cl-preloaded
faces cus-face macroexp files window text-properties overlay sha1 md5
base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo x-toolkit
xinput2 x multi-tty make-network-process emacs)

Memory information:
((conses 16 1240648 196783) (symbols 48 46340 117) (strings 32 226460 23555)
 (string-bytes 1 8179239) (vectors 16 202898)
 (vector-slots 8 4464083 548777) (floats 8 1703 1486)
 (intervals 56 128360 2956) (buffers 992 267))






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

* bug#55811: 29.0.50; No flymake diagnostics for no-byte-compile files
  2022-06-05 20:22 bug#55811: 29.0.50; No flymake diagnostics for no-byte-compile files Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-06-05 20:33 ` Lars Ingebrigtsen
  2022-06-05 23:09   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-05 20:33 UTC (permalink / raw)
  To: 55811; +Cc: Stefan Monnier, João Távora

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> I think `no-byte-compile` only means that we should load the `.el` file
> and not generate a `.elc` file and it shouldn't mean that we should
> refrain from asking the byte-compiler what is its opinion about the
> quality of this code.

I stumbled onto a related thing earlier tonight -- I said `M-x
byte-compile-file RET RET' and then it did nothing -- because of the
no-byte-compile.

I'm not sure whether I agree with that -- if I've explicitly asked Emacs
to do it, I think that should override the cookie.  Or at least issue a
message of some sort.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#55811: 29.0.50; No flymake diagnostics for no-byte-compile files
  2022-06-05 20:33 ` Lars Ingebrigtsen
@ 2022-06-05 23:09   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-06 12:40     ` Lars Ingebrigtsen
  2022-06-07  6:41     ` João Távora
  0 siblings, 2 replies; 13+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-05 23:09 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: João Távora, 55811

> I stumbled onto a related thing earlier tonight -- I said `M-x
> byte-compile-file RET RET' and then it did nothing -- because of the
> no-byte-compile.
>
> I'm not sure whether I agree with that -- if I've explicitly asked Emacs
> to do it, I think that should override the cookie.  Or at least issue a
> message of some sort.

That's a slightly different case from mine: the `no-byte-compile` is
often used either because the user really only ever wants to load the
`.el` or because the compilation is known to fail (e.g. because it
requires macros defined in a package that's not marked as a strict
dependency, very common in tests).

Generating a `.elc` file explicitly with `M-x byte-compile-file` could
be a problem if subsequent "normal" use will fail to update that `.elc`
because of the `no-byte-compile`.

So, I think `byte-compile-file` should not silently override the
`no-byte-compile`.  It could prompt to choose between "really compile"
and "compile but don't generate the .elc file".


        Stefan






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

* bug#55811: 29.0.50; No flymake diagnostics for no-byte-compile files
  2022-06-05 23:09   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-06-06 12:40     ` Lars Ingebrigtsen
  2022-06-07  6:41     ` João Távora
  1 sibling, 0 replies; 13+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-06 12:40 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: João Távora, 55811

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> So, I think `byte-compile-file` should not silently override the
> `no-byte-compile`.  It could prompt to choose between "really compile"
> and "compile but don't generate the .elc file".

Yup.  Or perhaps just issue a message that it's not doing anything --
this is a pretty obscure situation, after all.

By the way, do we have a convenient command for "compile but don't
generate the .elc file" somewhere?  (I feel like I've asked this before,
but I've suppressed the memory of the answer.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#55811: 29.0.50; No flymake diagnostics for no-byte-compile files
  2022-06-05 23:09   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-06 12:40     ` Lars Ingebrigtsen
@ 2022-06-07  6:41     ` João Távora
  2022-06-07 11:47       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 13+ messages in thread
From: João Távora @ 2022-06-07  6:41 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Lars Ingebrigtsen, 55811

Hi Stefan,

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> That's a slightly different case from mine: the `no-byte-compile` is
> often used either because the user really only ever wants to load the
> `.el` or because the compilation is known to fail (e.g. because it
> requires macros defined in a package that's not marked as a strict
> dependency, very common in tests).

By this you mean that the provider of such macros is not `require`d?
Then I don't understand what Flymake's byte-compilation backend could do
about this either...  As far as I understand it would just red-underline
all the unknown macro-using forms, their bodies wouldn't be checked.  Is
this what you want?  To check the rest of the file regardless?

Of course you know this -- but just to clarify -- the byte-compilation
backend works by launching a Emacs -Q which is asked to byte-compile
only a file containing the current buffer's contents.  During that
byte-compilation nothing more is loaded apart from what is preloaded or
explicitly loaded by the file at compile-time (via require or
eval-when/and-compile stuff).

A related issue is that when there _is_ an explicit require, then the
load-path support is pretty poor: only the current directory is added to
it.  If the `require`'d file lives somewhere else, there's no way to
hint that to the byte-comp backend, with a particular load-path.

Anyway, maybe you could give small example of such a file containing
such a cookie where you think Flymake's "I refuse to lint this" behavior
could be improved.

João







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

* bug#55811: 29.0.50; No flymake diagnostics for no-byte-compile files
  2022-06-07  6:41     ` João Távora
@ 2022-06-07 11:47       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-07 11:54         ` Lars Ingebrigtsen
  2022-06-07 12:02         ` João Távora
  0 siblings, 2 replies; 13+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-07 11:47 UTC (permalink / raw)
  To: João Távora; +Cc: Lars Ingebrigtsen, 55811

> Of course you know this -- but just to clarify -- the byte-compilation
> backend works by launching a Emacs -Q which is asked to byte-compile
> only a file containing the current buffer's contents.  During that
> byte-compilation nothing more is loaded apart from what is preloaded or
> explicitly loaded by the file at compile-time (via require or
> eval-when/and-compile stuff).

This bug-report is about the fact that there is no benefit to
obeying `no-byte-compile` in flymake.  Not about improving the way the
sub-process reproduces a "good" initial state to compile the file
(e.g. set up of `load-path` and whatnot).

> Anyway, maybe you could give small example of such a file containing
> such a cookie where you think Flymake's "I refuse to lint this" behavior
> could be improved.

A good example are all the files in the
[EEV](http://elpa.gnu.org/packages/eev.html) package.


        Stefan






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

* bug#55811: 29.0.50; No flymake diagnostics for no-byte-compile files
  2022-06-07 11:47       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-06-07 11:54         ` Lars Ingebrigtsen
  2022-06-07 12:13           ` João Távora
  2022-06-07 12:34           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-07 12:02         ` João Távora
  1 sibling, 2 replies; 13+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-07 11:54 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: João Távora, 55811

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> This bug-report is about the fact that there is no benefit to
> obeying `no-byte-compile` in flymake.

Well, there are some.  If you open, say, lisp/net/tramp-loaddefs.el,
you'll get a whole bunch of compilation errors, and you don't want to
see those, I think?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#55811: 29.0.50; No flymake diagnostics for no-byte-compile files
  2022-06-07 11:47       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-07 11:54         ` Lars Ingebrigtsen
@ 2022-06-07 12:02         ` João Távora
  1 sibling, 0 replies; 13+ messages in thread
From: João Távora @ 2022-06-07 12:02 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Lars Ingebrigtsen, 55811

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Of course you know this -- but just to clarify -- the byte-compilation
>> backend works by launching a Emacs -Q which is asked to byte-compile
>> only a file containing the current buffer's contents.  During that
>> byte-compilation nothing more is loaded apart from what is preloaded or
>> explicitly loaded by the file at compile-time (via require or
>> eval-when/and-compile stuff).
>
> This bug-report is about the fact that there is no benefit to
> obeying `no-byte-compile` in flymake.  Not about improving the way the
> sub-process reproduces a "good" initial state to compile the file
> (e.g. set up of `load-path` and whatnot).

Sure, I understood.  I was just commenting on the fact that the quality
of Flymake diagnostics might not be so good/helpful since those
diagnostics are likely affected by the same root causes that prevent
normal byte compilation anyway.

( Also, on the tangent note about load-path and Flymake, I completely
forgot that I added elisp-flymake-byte-compile-load-path some 4 years
ago.)

>> Anyway, maybe you could give small example of such a file containing
>> such a cookie where you think Flymake's "I refuse to lint this" behavior
>> could be improved.
>
> A good example are all the files in the
> [EEV](http://elpa.gnu.org/packages/eev.html) package.

OK.  Try this "100% untested patch" (TM) then:

diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 70826b4c3a..b99007c938 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -2152,7 +2152,9 @@ elisp-flymake--batch-compile-for-flymake
                   collected)
             t)))
     (unwind-protect
-        (byte-compile-file file)
+        (progn
+          (setq-local no-byte-compile nil)
+          (byte-compile-file file))
       (ignore-errors
         (kill-buffer byte-compile-log-buffer)))
     (prin1 :elisp-flymake-output-start)






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

* bug#55811: 29.0.50; No flymake diagnostics for no-byte-compile files
  2022-06-07 11:54         ` Lars Ingebrigtsen
@ 2022-06-07 12:13           ` João Távora
  2022-06-07 13:46             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-07 12:34           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 13+ messages in thread
From: João Távora @ 2022-06-07 12:13 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Stefan Monnier, 55811

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>> This bug-report is about the fact that there is no benefit to
>> obeying `no-byte-compile` in flymake.
>
> Well, there are some.  If you open, say, lisp/net/tramp-loaddefs.el,
> you'll get a whole bunch of compilation errors, and you don't want to
> see those, I think?

They could be useful I guess.  There are two cases to distinguish here
(which is what I failed to clarify before).  Perhaps Stefan is thinking
of the second.

1. The file has this form:

      (require 'foo)
       
      (fooey-macro (some-shady-stuff-the-byte-comp-could-look-into))

      (some-more-shady-stuff)

      ;; Local Variables:
      ;; no-byte-compile: t
      ;; End:

   and the reason for adding the no-byte-compile cookie is that foo.el
   can't be found at compile-time.  Then I think there is little reason
   to activate Flymake there.  That's because Flymake will halt at the
   (require 'foo) and not look into the rest of the file.

2. The file is identical but doesn't have the (require 'foo), then, I
   think Flymake will underline the first form, but carry on looking
   into other stuff.  This is possibly helpful, according to one's
   own tolerance of signal-to-noise ratio.

If some files in case 2 are still unbearably noisy for some, then I
think there are existing ways to force Flymake off using buffer-local
variables.
   
João






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

* bug#55811: 29.0.50; No flymake diagnostics for no-byte-compile files
  2022-06-07 11:54         ` Lars Ingebrigtsen
  2022-06-07 12:13           ` João Távora
@ 2022-06-07 12:34           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-07 12:42             ` Lars Ingebrigtsen
  1 sibling, 1 reply; 13+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-07 12:34 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: João Távora, 55811

Lars Ingebrigtsen [2022-06-07 13:54:52] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> This bug-report is about the fact that there is no benefit to
>> obeying `no-byte-compile` in flymake.
> Well, there are some.  If you open, say, lisp/net/tramp-loaddefs.el,
> you'll get a whole bunch of compilation errors, and you don't want to
> see those, I think?

Why not?


        Stefan






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

* bug#55811: 29.0.50; No flymake diagnostics for no-byte-compile files
  2022-06-07 12:34           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-06-07 12:42             ` Lars Ingebrigtsen
  2022-06-07 13:49               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-07 12:42 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: João Távora, 55811

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Well, there are some.  If you open, say, lisp/net/tramp-loaddefs.el,
>> you'll get a whole bunch of compilation errors, and you don't want to
>> see those, I think?
>
> Why not?

Because they can't be byte-compiled -- that's why they're marked as
such.  :-/

(There's a separate bug report about that somewhere.)

So we're really using no-byte-compile for two reasons: 1) To say that we
don't think it's useful to byte-compile something or 2) because we know
that it's impossible.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#55811: 29.0.50; No flymake diagnostics for no-byte-compile files
  2022-06-07 12:13           ` João Távora
@ 2022-06-07 13:46             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 13+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-07 13:46 UTC (permalink / raw)
  To: João Távora; +Cc: Lars Ingebrigtsen, 55811

> 1. The file has this form:
>
>       (require 'foo)
>        
>       (fooey-macro (some-shady-stuff-the-byte-comp-could-look-into))
>
>       (some-more-shady-stuff)
>
>       ;; Local Variables:
>       ;; no-byte-compile: t
>       ;; End:
>
>    and the reason for adding the no-byte-compile cookie is that foo.el
>    can't be found at compile-time.  Then I think there is little reason
>    to activate Flymake there.  That's because Flymake will halt at the
>    (require 'foo) and not look into the rest of the file.

BTW, while there is little benefit to having flymake run the
byte-compiler here, there is similarly little harm.
And the user may then decide to install `foo` to get the rest of the
file properly checked.


        Stefan






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

* bug#55811: 29.0.50; No flymake diagnostics for no-byte-compile files
  2022-06-07 12:42             ` Lars Ingebrigtsen
@ 2022-06-07 13:49               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 13+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-07 13:49 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: João Távora, 55811

Lars Ingebrigtsen [2022-06-07 14:42:29] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> Well, there are some.  If you open, say, lisp/net/tramp-loaddefs.el,
>>> you'll get a whole bunch of compilation errors, and you don't want to
>>> see those, I think?
>>
>> Why not?
>
> Because they can't be byte-compiled -- that's why they're marked as
> such.  :-/

I don't see the relevance.  I'm not trying to byte-compile the file.
Instead I'm trying to get the byte-compiler to give me feedback about
the file.

Sometimes files marked with `no-byte-compile` will indeed give fairly
poor feedback, but not always, and in any case I find poor feedback
better than no feedback at all.


        Stefan






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

end of thread, other threads:[~2022-06-07 13:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-05 20:22 bug#55811: 29.0.50; No flymake diagnostics for no-byte-compile files Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-05 20:33 ` Lars Ingebrigtsen
2022-06-05 23:09   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-06 12:40     ` Lars Ingebrigtsen
2022-06-07  6:41     ` João Távora
2022-06-07 11:47       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-07 11:54         ` Lars Ingebrigtsen
2022-06-07 12:13           ` João Távora
2022-06-07 13:46             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-07 12:34           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-07 12:42             ` Lars Ingebrigtsen
2022-06-07 13:49               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-07 12:02         ` João Távora

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