help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to deactivate mark?


From: Harald Hanche-Olsen
Subject: Re: How to deactivate mark?
Date: Tue, 04 May 2010 15:44:10 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (darwin)

+ Uday S Reddy <uDOTsDOTreddy@cs.bham.ac.uk>:

> I tried to define a command called narrow-to-defun as follows:
>
> (defun narrow-to-defun ()
>  "Narrow to the current defun around point"
>  (interactive)
>  (mark-defun)
>  (narrow-to-region (point) (mark))
>  )
>
> Unfortunately, running the command makes the mark "active," thereby
> highlighting the defun at the end of the execution.  I have tried
> various tricks to get the mark to turn off - like calling
> deactivate-mark, binding deactivate-mark to t locally, binding
> transient-mark-mode to nil etc.  But none of them is able to turn off
> the active mark at the end.  
>
> What am I missing?

Adding (deactivate-mark) to the end of your definition works for me. Did
you forget to evaluate the defun after adding this bit? (I forget it all
the time.)

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell


reply via email to

[Prev in Thread] Current Thread [Next in Thread]