title: Emacs: Keybinding to TAB breaks autocompletion in minibuffer
body: <p>Simply put, I just set a keybinding on the TAB key, but now when I push TAB in the minibuffer to auto-complete  a command, it fails with the following message: <code>The mark is not set now, so there is no region</code>. </p>
  
  <p>In other words, I only need my TAB keybinding when my cursor is in the buffer (not the minibuffer).</p>
  
  <p>In my example below, how can I set my tab to indent when I am in text/fundamental mode in the buffer without losing autocompletion while in the mini-buffer? I have the following functions and key-bindings:</p>
  
  <pre><code>;; Shift the selected region right if distance is postive, left if
  ;; negative
  
   (defun shift-region (distance)
     (let ((mark (mark)))
       (save-excursion
         (indent-rigidly (region-beginning) (region-end) distance)
         (push-mark mark t t)
         ;; Tell the command loop not to deactivate the mark
         ;; for transient mark mode
         (setq deactivate-mark nil))))
  
  (defun shift-right ()
    (interactive)
    (shift-region 2))
  
  (defun shift-left ()
    (interactive)
    (shift-region -2))
  
  ;; Bind (shift-right) and (shift-left) function to your favorite keys. I use
  ;; the following so that Ctrl-Shift-Right Arrow moves selected text one 
  ;; column to the right, Ctrl-Shift-Left Arrow moves selected text one
  ;; column to the left:
  
  ;; (global-set-key [C-S-right] 'shift-right)
  ;; (global-set-key [C-S-left] 'shift-left)
  (global-set-key [tab] 'shift-right)
  (global-set-key [backtab] 'shift-left)
  </code></pre>