all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Harald Hanche-Olsen <hanche@math.ntnu.no>
To: help-gnu-emacs@gnu.org
Subject: Re: How to deactivate mark?
Date: Tue, 06 Apr 2010 15:46:51 -0400	[thread overview]
Message-ID: <pco6344qs7o.fsf@math.ntnu.no> (raw)
In-Reply-To: hpf6qk$15g$1@north.jnrs.ja.net

+ 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	other threads:[~2010-04-06 19:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-06 11:44 How to deactivate mark? Uday S Reddy
2010-04-06 19:46 ` Harald Hanche-Olsen [this message]
2010-04-07 10:18   ` Uday S Reddy
2010-04-07 10:51     ` Andreas Politz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pco6344qs7o.fsf@math.ntnu.no \
    --to=hanche@math.ntnu.no \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.