jorgenschaefer / elpy

Emacs Python Development Environment
GNU General Public License v3.0
1.9k stars 262 forks source link

Symbol’s function definition is void: elpy-module-sane-defaults #1963

Closed algor512 closed 2 years ago

algor512 commented 2 years ago

Summary

I get the following errors while starting emacs:

Error (use-package): elpy/:init: Symbol’s function definition is void: elpy-module-sane-defaults
Error (use-package): elpy/:catch: Symbol’s function definition is void: elpy-module-sane-defaults

My elpy config is

(use-package elpy
  :ensure t
  :init
  (elpy-enable)
  :config
  (defalias 'workon 'pyvenv-workon)
  (setenv "WORKON_HOME" "/home/algor/miniconda3/envs")
  :custom
  (elpy-modules (elpy-module-sane-defaults
                 elpy-module-company
                 elpy-module-eldoc
                 elpy-module-pyvenv))
  (eldoc-idle-delay 5))

Steps to reproduce

  1. Create temp-init.el:
    
    (setq user-emacs-directory "/tmp/emacs/")

(require 'package)

(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))

(setq package-enable-at-startup nil) (package-initialize)

(unless (package-installed-p 'use-package) (package-refresh-contents) (package-install 'use-package))

(require 'use-package)

(use-package elpy :ensure t :init (elpy-enable) :config (defalias 'workon 'pyvenv-workon) (setenv "WORKON_HOME" "/home/algor/miniconda3/envs") :custom (elpy-modules (elpy-module-sane-defaults elpy-module-company elpy-module-eldoc elpy-module-pyvenv)) (eldoc-idle-delay 5))

2. Run `/bin/emacs -q -l temp-init.el`
3. Get the errors

Error (use-package): elpy/:init: Symbol’s function definition is void: elpy-module-sane-defaults Error (use-package): elpy/:catch: Symbol’s function definition is void: elpy-module-sane-defaults


# My configuration
## OS
I use Void Linux, GNU Emacs 27.2.

## Result of `(elpy-config)`

Debugger entered--Lisp error: (void-function elpy-module-sane-defaults) (elpy-module-sane-defaults elpy-module-company elpy-module-eldoc elpy-module-pyvenv) eval((elpy-module-sane-defaults elpy-module-company elpy-module-eldoc elpy-module-pyvenv)) custom-initialize-reset(elpy-modules (funcall #'#f(compiled-function () #<bytecode 0xcf7d59>))) custom-declare-variable(elpy-modules (funcall #'#f(compiled-function () #<bytecode 0xcf7d59>)) "Which Elpy modules to use.\n\nElpy can use a number ..." :type (set (const :tag "Inline code completion (company-mode)" elpy-module-company) (const :tag "Show function signatures (ElDoc)" elpy-module-eldoc) (const :tag "Highlight syntax errors (Flymake)" elpy-module-flymake) (const :tag "Code folding" elpy-module-folding) (const :tag "Show the virtualenv in the mode line (pyvenv)" elpy-module-pyvenv) (const :tag "Display indentation markers (highlight-indentation..." elpy-module-highlight-indentation) (const :tag "Expand code snippets (YASnippet)" elpy-module-yasnippet) (const :tag "Django configurations (Elpy-Django)" elpy-module-django) (const :tag "Automatically update documentation (Autodoc)." elpy-module-autodoc) (const :tag "Configure some sane defaults for Emacs" elpy-module-sane-defaults)) :group elpy) byte-code("\300\301\302\303\304\305\306\307&\7\210\310\311\312\313\314DD\315\316\317\320\321\306\301&\11\210\310\322\312\313\323DD\324\316\325\306\301&\7\210\310\326\312\313\327DD..." [custom-declare-group elpy nil "The Emacs Lisp Python Environment." :prefix "elpy-" :group languages custom-declare-variable elpy-mode-hook funcall function #f(compiled-function () #<bytecode 0xcf7d4d>) "Hook run when `elpy-mode' is enabled.\n\nThis can be..." :type hook :options (subword-mode hl-line-mode) elpy-modules #f(compiled-function () #<bytecode 0xcf7d59>) "Which Elpy modules to use.\n\nElpy can use a number ..." (set (const :tag "Inline code completion (company-mode)" elpy-module-company) (const :tag "Show function signatures (ElDoc)" elpy-module-eldoc) (const :tag "Highlight syntax errors (Flymake)" elpy-module-flymake) (const :tag "Code folding" elpy-module-folding) (const :tag "Show the virtualenv in the mode line (pyvenv)" elpy-module-pyvenv) (const :tag "Display indentation markers (highlight-indentation..." elpy-module-highlight-indentation) (const :tag "Expand code snippets (YASnippet)" elpy-module-yasnippet) (const :tag "Django configurations (Elpy-Django)" elpy-module-django) (const :tag "Automatically update documentation (Autodoc)." elpy-module-autodoc) (const :tag "Configure some sane defaults for Emacs" elpy-module-sane-defaults)) elpy-project-ignored-directories #f(compiled-function () #<bytecode 0xcf7d65>) "Directories ignored by functions working on the wh..." (repeat string) :safe #f(compiled-function (val) #<bytecode 0xcf7d79>)] 10) (elpy-config) eval((elpy-config) nil) elisp--eval-last-sexp(nil) eval-last-sexp(nil) funcall-interactively(eval-last-sexp nil) call-interactively(eval-last-sexp nil nil) command-execute(eval-last-sexp)


## Elpy configuration in my init.el

(use-package elpy :ensure t :init (elpy-enable) :config (defalias 'workon 'pyvenv-workon) (setenv "WORKON_HOME" "/home/algor/miniconda3/envs") :custom (elpy-modules (elpy-module-sane-defaults elpy-module-company elpy-module-eldoc elpy-module-pyvenv)) (eldoc-idle-delay 5))

algor512 commented 2 years ago

It was my mistake, sorry for that. The solution is to quote the list (elpy-module-sane-defaults elpy-module-company elpy-module-eldoc elpy-module-pyvenv), that is to write

  (elpy-modules '(elpy-module-sane-defaults
                 elpy-module-company
                 elpy-module-eldoc
                 elpy-module-pyvenv))

instead of

  (elpy-modules (elpy-module-sane-defaults
                 elpy-module-company
                 elpy-module-eldoc
                 elpy-module-pyvenv))

Sorry again.