title: Shift a region or line in emacs
body: <p>I'm looking for a way in emacs to shift text to the right or to the left by <code>n</code> spaces. A similar functionality that it in vim <code>&lt;&lt;</code> or <code>&gt;&gt;</code>. It should work on a region or if no region is selected on a current line and not move the cursor from its current location.</p>
  
  <p>The solution from <a href="http://www.emacswiki.org/emacs/IndentingText" rel="noreferrer">EmacsWiki</a> does not work very well as the <code>M-x indent-rigidly</code> since it somewhat remembers the last region used and shifts that one instead. The closest seems to be the one <a href="https://stackoverflow.com/questions/594156/using-emacs-to-indent-shift-4-code">here</a> but I did not managed to make it work. I'm not a lisp developer so it's difficult to modify the code. I will appreciate any help.</p>
  
  <p>Thanks!</p>