Emacs Prelude - Electric indentation

752 views Asked by At

I am trying to get electric indentation working in prelude.

In the .emacs.d/personal/personal.el file I have added the below

;;; package --- Summary
;;; adding indent for python and binding for python-django
;;; Code:
(electric-indent-mode +1)
;;; Commentary:

;;; package --- Summary
;;; adding indent for python and binding for python-django
;;; Code:
(global-set-key (kbd "C-x j") 'python-django-open-project)
;;; Commentary:

(provide 'personal)\n
;;; personal.el ends here

electric should work as I got it from bbatsov's site.electric-indent

I notic however that even ctrl-j isn't working to indent. how do I fix this?

EDIT error from personal.el

Debugger entered--Lisp error: (void-variable n)
  eval-buffer(#<buffer  *load*-827116> nil "/home/sayth/.emacs.d/personal/personal.el" nil t)  ; Reading at buffer position 327
  load-with-code-conversion("/home/sayth/.emacs.d/personal/personal.el" "/home/sayth/.emacs.d/personal/personal.el" nil nil)
  load("/home/sayth/.emacs.d/personal/personal.el")
  mapc(load ("/home/sayth/.emacs.d/personal/personal.el"))
  (progn (message "Loading personal configuration files in %s..." prelude-personal-dir) (mapc (quote load) (directory-files prelude-personal-dir (quote t) "^[^#].*el$")))
  (if (file-exists-p prelude-personal-dir) (progn (message "Loading personal configuration files in %s..." prelude-personal-dir) (mapc (quote load) (directory-files prelude-personal-dir (quote t) "^[^#].*el$"))))
  eval-buffer(#<buffer  *load*> nil "/home/sayth/.emacs.d/init.el" nil t)  ; Reading at buffer position 4738
  load-with-code-conversion("/home/sayth/.emacs.d/init.el" "/home/sayth/.emacs.d/init.el" t t)
  load("/home/sayth/.emacs.d/init" t t)   #[0 "\205\262
1

There are 1 answers

2
Bozhidar Batsov On

electric-indent-mode seems to work just fine when I test in Emacs 24.3.50. You should keep in mind that it remaps C-j to electric-indent-just-newline. It simply inserts a newline, without any auto-indentation.

This makes a lot of sense, as the RET auto-indents when the mode is enabled. I seem to recall it was buggy in older versions of Emacs, so I'd suggest taking a look at emacs-snapshot if you want to use it.