Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Solved - emacs-prelude initialization error

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
gostal
Posts: 10
Joined: 2021-04-22 14:44

Solved - emacs-prelude initialization error

#1 Post by gostal »

I want to use anaconda-mode in Emacs and apparently this is included in emacs-prelude. Installations according to https://github.com/bbatsov/prelude "Fast forward" seems to work but when starting Emacs I get an error which I can't figure out. This is what Emacs gives me:

Code: Select all

Error message when starting emacs:
Warning (initialization): An error occurred while loading ‘/home/eva/.emacs.d/init.el’:

error: Package ‘ace-window-’ is unavailable

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace.
Restarting with the suggested argument gives:

Code: Select all

Debugger entered--Lisp error: (file-error "https://melpa.org/packages/archive-contents" "Bad Request")
  signal(file-error ("https://melpa.org/packages/archive-contents" "Bad Request"))
  package--download-one-archive(("melpa" . "https://melpa.org/packages/") "archive-contents" nil)
  package--download-and-read-archives(nil)
  package-refresh-contents()
  prelude-install-packages()
  require(prelude-packages)
  eval-buffer(#<buffer  *load*> nil "/home/eva/.emacs.d/init.el" nil t)  ; Reading at buffer position 4598
  load-with-code-conversion("/home/eva/.emacs.d/init.el" "/home/eva/.emacs.d/init.el" t t)
  load("/home/eva/.emacs.d/init" t t)
  #f(compiled-function () #<bytecode 0x1dda91>)()
  command-line()
  normal-top-level()
I guess the URL https://melpa.org/packages/archive-contents is wrong but I can't figure out where in the Prelude installation this is.
Ideas anyone?

Cheers,
gostal
Last edited by gostal on 2022-07-28 10:53, edited 1 time in total.
System: Debian 10 on Dell Latitude E6420 8GB RAM intel core i7, Intel 2nd Generation Core Integrated Graphics

gostal
Posts: 10
Joined: 2021-04-22 14:44

Re: emacs-prelude initialization error

#2 Post by gostal »

It appears the problem is a version issue related to TLS, see

Code: Select all

https://melpa.org/#/getting-started
. I found, however, another guide:
https://idevji.com/blog/2019/01/09/conf ... -on-emacs/
Installed anaconda-mode according to that page and got this:

Code: Select all

Checking /home/eva/.emacs.d/elpa/anaconda-mode-20211122.817...
Done (Total of 1 file compiled, 2 skipped)
You can run the command ‘package-install’ with M-x p-ins RET
Done (Total of 1 file compiled, 2 skipped)
Tried to enable anaconda-mode by adding:

Code: Select all

(add-hook ‘python-mode-hook ‘anaconda-mode)
and got this:

Code: Select all

Warning (initialization): An error occurred while loading ‘/home/eva/.emacs.d/init.el’:

Symbol's value as variable is void: ‘python-mode-hook
...
causing init debugger output:

Code: Select all

Debugger entered--Lisp error: (void-variable ‘python-mode-hook)
  (add-hook ‘python-mode-hook ‘anaconda-mode)
  eval-buffer(#<buffer  *load*> nil "/home/eva/.emacs.d/init.el" nil t)  ; Reading at buffer position 1322
  load-with-code-conversion("/home/eva/.emacs.d/init.el" "/home/eva/.emacs.d/init.el" t t)
  load("/home/eva/.emacs.d/init" t t)
  #f(compiled-function () #<bytecode 0x1dda91>)()
  command-line()
  normal-top-level()
Can't figure this one out. Commenting out python-mode-hook in init.el removes the error but then there is no anaconda-mode.
Please help!

Cheers,
gostal
Last edited by gostal on 2022-08-02 22:11, edited 1 time in total.
System: Debian 10 on Dell Latitude E6420 8GB RAM intel core i7, Intel 2nd Generation Core Integrated Graphics

gostal
Posts: 10
Joined: 2021-04-22 14:44

Re: emacs-prelude initialization error

#3 Post by gostal »

Well, I still have no idea why

Code: Select all

(add-hook ‘python-mode-hook ‘anaconda-mode)
causes an error but I found a way to enable anaconda-mode. Removing the line from init.el removes the initialization error but Emacs starts with anaconda-mode disabled for pyhton scripts. All I get is major mode Python and minor mode ElDoc. The solution i discovered was to do

Code: Select all

M-x anaconda-mode
when in a python buffer. It must be possible to have it enabled via init.el so if anybody could tell me how I'd be grateful.

Cheers,
gostal
System: Debian 10 on Dell Latitude E6420 8GB RAM intel core i7, Intel 2nd Generation Core Integrated Graphics

gostal
Posts: 10
Joined: 2021-04-22 14:44

Solved - Re: emacs-prelude initialization error

#4 Post by gostal »

Solution found, although I don't know what was missing regarding

Code: Select all

(add-hook ‘python-mode-hook ‘anaconda-mode)
earlier.
I added use-package to Emacs and corresponding lines to init.el, see https://github.com/jwiegley/use-package. To enable anaconda-mode I added the following lines to init.el:

Code: Select all

(use-package anaconda-mode
  :init 
  (add-hook 'python-mode-hook 'anaconda-mode)
  (add-hook 'python-mode-hook 'anaconda-eldoc-mode)
  (add-hook 'python-mode-hook 'display-line-numbers-mode))
The second add-hook line is perhaps not necessary as eldoc was enabled also before in python buffers.

Cheers,
gostal
System: Debian 10 on Dell Latitude E6420 8GB RAM intel core i7, Intel 2nd Generation Core Integrated Graphics

gostal
Posts: 10
Joined: 2021-04-22 14:44

Re: Solved - emacs-prelude initialization error

#5 Post by gostal »

It appears that the problem with

Code: Select all

(add-hook ‘python-mode-hook ‘anaconda-mode)
is typographical. It's not the right kind of quotation mark. This is what it should look like:

Code: Select all

(add-hook 'python-mode-hook 'anaconda-mode)
It's hard to tell the difference in the forum editor. I'm pretty sure that I used copy/paste when editing init.el so I believe the fault lies in the cited web-page.

Cheers,
gostal
System: Debian 10 on Dell Latitude E6420 8GB RAM intel core i7, Intel 2nd Generation Core Integrated Graphics

Post Reply