unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to make flymake happy without interfering with logic?
@ 2019-11-05 17:24 Pankaj Jangid
  2019-11-05 21:24 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Pankaj Jangid @ 2019-11-05 17:24 UTC (permalink / raw)
  To: Emacs mailing list

Hi,

I have a file 'init-env.el' in '<user-emacs-directory>/lisp'
directory. In my 'init.el' when I do (require 'init-env), flymake says
no such file or directory.

Emacs loads the file perfectly without any error with the following code
in my init.el,

(add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory))

But flymake works only when I call the above code inside
(eval-when-compile ...) form.

My question is - how to make flymake happy without interfering with
logic?

Regards,
-- 
Pankaj Jangid



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

* Re: How to make flymake happy without interfering with logic?
  2019-11-05 17:24 How to make flymake happy without interfering with logic? Pankaj Jangid
@ 2019-11-05 21:24 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2019-11-05 21:24 UTC (permalink / raw)
  To: help-gnu-emacs

> I have a file 'init-env.el' in '<user-emacs-directory>/lisp'
> directory. In my 'init.el' when I do (require 'init-env), flymake says
> no such file or directory.

flymake is designed for files which can be correctly byte-compiled from
a "vanilla" Emacs.

Wrapping your `load-path` modification inside an `eval-and-compile` is
one way to make it work.  Another way could be to do

    (if t (require 'init-env))

so the `require` is only executed when loading the file but not when
compiling it.  Another could be to use

    (require 'init-env (expand-file-name "lisp/init-env" user-emacs-directory)

Yet another might be to disable flymake in that file because the file
just doesn't lend itself to this kind of checking.


        Stefan




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

end of thread, other threads:[~2019-11-05 21:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-05 17:24 How to make flymake happy without interfering with logic? Pankaj Jangid
2019-11-05 21:24 ` Stefan Monnier

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