I've turned off electric indent. I am still having serious indentation problems with rst-mode -- making things nearly unusable.

First: I'd like to make all indentation two-spaces. No tabs, not ever.

Next: A weird and frustrating thing is happening with directives.

.. directive-with option:: option
                           The next line starts here

.. directive::
   :option: something
            The next line starts here.

.. directive::
   :why: would
         :anyone: want
                  :this: to happen?
                         :i-am: going insane.


I want to press and have the next line indented by the same amount as the line I was just one. Then, if I want to indent, I can do so, and then stay at that level of indentation until I change it myself. (I basically want this behavior in every mode, no matter what.)


1 Answer 1


Solved my own problem

I realized I Was focusing on all the symptoms and not on the issue I (finally) focused on when I wrote the "All I Really want" problem above.

So -- I bound RET to newline + relative-indent-maybe -- in programming mode and (just in case) rst mode as well -- I would do it globally, but apparently that has issues for the minibuffer. But now I can just add whatever modes in the future.

(defun amw-nl-indent ()
    "new line, then indent based on the previous line"

(define-key prog-mode-map (kbd "RET") 'amw-nl-indent)
(define-key prog-mode-map (kbd "C-j") 'amw-nl-indent)
(define-key rst-mode-map  (kbd "RET") 'amw-nl-indent)
(define-key rst-mode-map  (kbd "C-j") 'amw-nl-indent)/
  • Please accept your own answer.
    – Dan
    Commented Sep 10, 2017 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.