* How to deactivate mark?
@ 2010-04-06 11:44 Uday S Reddy
2010-04-06 19:46 ` Harald Hanche-Olsen
0 siblings, 1 reply; 4+ messages in thread
From: Uday S Reddy @ 2010-04-06 11:44 UTC (permalink / raw)
To: help-gnu-emacs
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?
Cheers,
Uday Reddy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to deactivate mark?
2010-04-06 11:44 How to deactivate mark? Uday S Reddy
@ 2010-04-06 19:46 ` Harald Hanche-Olsen
2010-04-07 10:18 ` Uday S Reddy
0 siblings, 1 reply; 4+ messages in thread
From: Harald Hanche-Olsen @ 2010-04-06 19:46 UTC (permalink / raw)
To: help-gnu-emacs
+ 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to deactivate mark?
2010-04-06 19:46 ` Harald Hanche-Olsen
@ 2010-04-07 10:18 ` Uday S Reddy
2010-04-07 10:51 ` Andreas Politz
0 siblings, 1 reply; 4+ messages in thread
From: Uday S Reddy @ 2010-04-07 10:18 UTC (permalink / raw)
To: help-gnu-emacs
Harald Hanche-Olsen wrote:
> 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.)
Yes, I must have forgotten to eval the defun. Thank you.
I also discovered that setting the variable `deactivate-mark' to t (instead of binding it locally) works as well.
Cheers,
Uday
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to deactivate mark?
2010-04-07 10:18 ` Uday S Reddy
@ 2010-04-07 10:51 ` Andreas Politz
0 siblings, 0 replies; 4+ messages in thread
From: Andreas Politz @ 2010-04-07 10:51 UTC (permalink / raw)
To: help-gnu-emacs
Uday S Reddy <uDOTsDOTreddy@cs.bham.ac.uk> writes:
> Harald Hanche-Olsen wrote:
>
>> 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.)
>
> Yes, I must have forgotten to eval the defun. Thank you.
>
> I also discovered that setting the variable `deactivate-mark' to t
> (instead of binding it locally) works as well.
>
> Cheers,
> Uday
In case you don't know : There is a already a function
`narrow-to-defun'.
-ap
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-04-07 10:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-06 11:44 How to deactivate mark? Uday S Reddy
2010-04-06 19:46 ` Harald Hanche-Olsen
2010-04-07 10:18 ` Uday S Reddy
2010-04-07 10:51 ` Andreas Politz
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.