title: marked region does not highlight in emacs after changing the buffer
body: <p>I'm creating a custom .emacs file (using GNU Emacs 24.3.1) and in it I have a custom function, bound to a custom shortcut, that copies the selected region "(kill-ring-save (region-beginning) (region-end))" then pastes it in a different location.  Then I try to select a new region. But when I do, the region is no longer highlighted.  The mark IS set, because I can copy/paste.</p>
  
  <p>If I skip the paste step in my function, the new region is highlighted.  It's just that editing the buffer in any way causes region highlighting to stop working.</p>
  
  <p>From <a href="https://www.fnal.gov/docs/products/emacs/emacs/emacs_12.html" rel="nofollow">https://www.fnal.gov/docs/products/emacs/emacs/emacs_12.html</a> :
  "Any change to the buffer, such as inserting or deleting a character, deactivates the mark. This means any subsequent command that operates on a region will get an error and refuse to operate. You can make the region active again by typing C-x C-x. "</p>
  
  <p>C-x C-x simply calls (exchange-point-and-mark), but if I call (exchange-point-and-mark) in my function, highlighting still does not turn on again.  Why not?</p>
  
  <p>Disclaimer: I am not that familiar with emacs, I'm just trial and erroring to some working code, but I just can't find a way to highlight the selected region after I edit the buffer.  My workaround is to call a different function in my .emacs, bound to a different shortcut, that simply calls (exchange-point-and-mark) and the previously selected region is highlighted.</p>
  
  <p>EDIT: adding representative code</p>
  
  <pre><code>(defun func1 ()
    (interactive)
    (set-mark (point))
    (forward-char)
    (forward-char) ; at this point two characters are highlighted
    (set-mark (point))
    (forward-char)
    (forward-char) ; at this point two different characters are highlighted
  )
  
  (defun func2 ()
    (interactive)
    (set-mark (point))
    (forward-char)
    (forward-char) ; at this point two characters are highlighted
    (insert "a")
    (set-mark (point))
    (forward-char)
    (forward-char) ; at this point nothing is highlighted because of the insert, but the mark IS set
  )
  
  (defun func3 ()
    ; if I call this right after calling func2 the region is highlighted
    (interactive)
    (exchange-point-and-mark)
  )
  
  (global-set-key (kbd "&lt;f5&gt; x") 'func1)
  (global-set-key (kbd "&lt;f5&gt; c") 'func2)
  (global-set-key (kbd "&lt;f5&gt; v") 'func3)
  </code></pre>