Malabarba / aggressive-indent-mode

Emacs minor mode that keeps your code always indented. More reliable than electric-indent-mode.
853 stars 35 forks source link

Aggressive-indent-mode don't work in org-babel #69

Closed kendriu closed 8 years ago

kendriu commented 8 years ago

So I have:

(global-aggressive-indent-mode 1)

But aggressive-indent-mode don't work in source block in org-babel: For example int this block:

   In bellow source block aggressive-indent-mode doesn't work:
#+BEGIN_SRC emacs-lisp
(require 'eshell)
(defun set-exec-path-from-shell-PATH ()
    (let ((path-from-shell (replace-regexp-in-string
                                                    "[ \t\n]*$"
                                                    ""
                                                (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'"))))
        (setenv "PATH" path-from-shell)
        (setq eshell-path-env path-from-shell) ; for eshell users
        (setq exec-path (split-string path-from-shell path-separator))))

(when window-system (set-exec-path-from-shell-PATH))
#+END_SRC
Malabarba commented 8 years ago

Indeed. Org-mode is a text-mode, so aggressive-indent disables itself. If you edit that source block with org-edit-src-code you should have regular aggressive-indent functionality.

kendriu commented 8 years ago

It worls in org-edit-src-code, althgough it would be nice, if i hadn't to leave org-mode (saves keystrokes ^_^)

Malabarba commented 8 years ago

It would, but there's no reasonable way. Sorry. :-(

Indentation in org-mode src blocks is pretty slow (org has to jump through some hooks to make it all work) and that's a big NO-NO for aggressive-indent-mode. Not to mention all of the technical difficulties involved in implementing this.

bbatsov commented 8 years ago

So, I'm guessing this can be closed.

Malabarba commented 8 years ago

Indeed