all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to deal with 'function' not known to be defined
@ 2020-10-01 17:21 Pankaj Jangid
  2020-10-01 17:51 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-01 18:28 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Pankaj Jangid @ 2020-10-01 17:21 UTC (permalink / raw)
  To: Emacs Help

I have a lisp file `init-which-key.el` which is included in
`~/.emacs.d/init.el`.

#+BEGIN_SRC elisp
(require 'package)
(defun my/which-key-setup ()
  "Startup configuration for which-key."
  (unless (package-installed-p 'which-key)
    (package-install 'which-key))

  (which-key-mode 1))

(my/which-key-setup)
#+END_SRC

Flymake reports one warning - "The function 'which-key-mode" is not
known to be define.

I know that 'which-key-mode' is not available till the package is
installed. And flymake tries to compile and find errors and warnings.

What are the best practices to write such modular files that are free
from flymake warnings? Any pointers where I can read specifically on
this topic?



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

* Re: How to deal with 'function' not known to be defined
  2020-10-01 17:21 How to deal with 'function' not known to be defined Pankaj Jangid
@ 2020-10-01 17:51 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-01 18:28 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-01 17:51 UTC (permalink / raw)
  To: help-gnu-emacs

Pankaj Jangid wrote:

> I have a lisp file `init-which-key.el` which is
> included in `~/.emacs.d/init.el`.
>
> #+BEGIN_SRC elisp
> (require 'package)
> (defun my/which-key-setup ()
>   "Startup configuration for which-key."
>   (unless (package-installed-p 'which-key)
>     (package-install 'which-key))
>
>   (which-key-mode 1))
>
> (my/which-key-setup)
> #+END_SRC
>
> Flymake reports one warning - "The function
> 'which-key-mode" is not known to be define.
>
> I know that 'which-key-mode' is not available till
> the package is installed. And flymake tries to
> compile and find errors and warnings.
>
> What are the best practices to write such modular
> files that are free from flymake warnings?
> Any pointers where I can read specifically on
> this topic?

(require 'which-key)

?

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: How to deal with 'function' not known to be defined
  2020-10-01 17:21 How to deal with 'function' not known to be defined Pankaj Jangid
  2020-10-01 17:51 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-01 18:28 ` Stefan Monnier
  2020-10-02  5:08   ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2020-10-01 18:28 UTC (permalink / raw)
  To: help-gnu-emacs

> I have a lisp file `init-which-key.el` which is included in
> `~/.emacs.d/init.el`.
[...]
> Flymake reports one warning - "The function 'which-key-mode" is not
> known to be define.

The linters activated in `emacs-lisp-mode` for `flymake` are inadequate
for the kind of code you find in `~/.emacs.d/init.el`.
They're designed for the kind of code you'd find in a package, like
those you can find in ELPA.

If you really want, you can try and write your `init.el` code in a way
that will silence those warnings, but it'll be inconvenient and the
benefits will be very slim and it could even be harmful (typically to
the startup time).

Making a linter that only emits those warnings when they're really
relevant in such a file will/would take a fair bit more effort.  In the
mean time I'd suggest you disable that linter in that file or ignore
those warnings.


        Stefan




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

* Re: How to deal with 'function' not known to be defined
  2020-10-01 18:28 ` Stefan Monnier
@ 2020-10-02  5:08   ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 4+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-02  5:08 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier wrote:

>> I have a lisp file `init-which-key.el` which is
>> included in `~/.emacs.d/init.el`.
>>
>> Flymake reports one warning - "The function
>> 'which-key-mode" is not known to be define.
>
> The linters activated in `emacs-lisp-mode` for
> `flymake` are inadequate for the kind of code you
> find in `~/.emacs.d/init.el`. They're designed for
> the kind of code you'd find in a package, like
> those you can find in ELPA.

I know only of the byte compiler, and `checkdoc', as
in

  (checkdoc-current-buffer t) ; TAKE-NOTES

This is a third way to analyze and improve
one's Lisp?

How does it work?

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

end of thread, other threads:[~2020-10-02  5:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-01 17:21 How to deal with 'function' not known to be defined Pankaj Jangid
2020-10-01 17:51 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-01 18:28 ` Stefan Monnier
2020-10-02  5:08   ` Emanuel Berg via Users list for the GNU Emacs text editor

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.