[ESS] Help - transient mark mode and eval-region

tyler tyler.smith at mail.mcgill.ca
Mon Apr 28 20:23:13 CEST 2008


"Munawar Cheema" <mcheema at btinternet.com> writes:

>  
> I was looking for help on the following problem:
>
> If I am edititing a .r file in ESS mode and I highlight a region in
> transient mark mode, if I subsequently hit C-c C-r (eval-region) the mark
> stays active and the region remains highlighted. I then have to use C-g to
> remove the mark/highligting.  Irritatingly if I hit an editing key before
> doing this I delete the region as I seem to be conditioned to assume the
> region is no longer highligted.
>
> I was wondering a) how to modify that

Here's one way: add the following lines to your .emacs. As long as the
defadvice comes after you've loaded ess I think it should work.

;; ESS - the load line should already be in your .emacs:
(load "/home/tyler/dl_src/emacs22/ess-svn/lisp/ess-site.el")

(defadvice ess-eval-region (after unmark-after-eval)
  "Deactivate mark after sending region to the ESS process"
  (deactivate-mark))

(ad-activate 'ess-eval-region)  

This appears to work on my setup, and should be robust to moderate
changes to the ess code.

> and b) whether this should be the default behaviour. 

Don't know. I haven't had this problem, but my preferences may be a
little peculiar. I'll leave it in my .emacs for a while and see if it
makes me a happier or more productive person ;)

HTH,

Tyler

-- 
"Primroses and landscapes have one great defect: they are gratuitous. A love 
of nature keeps no factories busy... We condition the masses to hate the 
country but simlutaneously we condition them to love all country sports. At 
the same time, we see to it that all country sports shall entail the use of 
elaborate apparatus. So that they consume manufactured articles as well as 
transport. Hence those electric shocks."
                                       --Brave New World, Aldous Huxley 1932




More information about the ESS-help mailing list