all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Barry Margolin <barmar@alum.mit.edu>
To: help-gnu-emacs@gnu.org
Subject: Re: Proper use of `deactivate-mark'?
Date: Thu, 13 Feb 2014 13:07:59 -0500	[thread overview]
Message-ID: <barmar-854A71.13075913022014@news.eternal-september.org> (raw)
In-Reply-To: mailman.14992.1392314356.10748.help-gnu-emacs@gnu.org

In article <mailman.14992.1392314356.10748.help-gnu-emacs@gnu.org>,
 Thorsten Jolitz <tjolitz@gmail.com> wrote:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
> 
> >> Isn't that the appropriate use of `deactivate-mark'?
> >
> > Sounds right, yes.
> >
> >> How can I make sure that no mark is active anymore when I'm done in
> >> buffer B and switch back to buffer A?
> >
> > Not sure why the mark is re-activated.  Could be because you call
> > deactivate-mark from with a save-excursion.
> 
> Not really, but I found the culprit:
> 
> Inside the (and ...) deactivate-mark does not do its work properly (does
> copy-to-register return nil?)
> 
>   ,-------------------------------------------------------
>   | (and
>   |  (use-region-p)
>   |  (copy-to-register ?s (region-beginning) (region-end))
>   |  (deactivate-mark) )
>   `-------------------------------------------------------
> 
> but refactored like this the mark is actually deactivated:
> 
>   ,---------------------------------------------------------
>   | (and
>   |  (use-region-p)
>   |  (copy-to-register ?s (region-beginning) (region-end)) )
>   | (deactivate-mark)
>   `---------------------------------------------------------

Maybe it should be:

(and 
  (use-region-p)
  (progn
    (copy-to-register ?s (region-beginning) (region0end))
    (deactivate-mark)))

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


  parent reply	other threads:[~2014-02-13 18:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13 17:19 Proper use of `deactivate-mark'? Thorsten Jolitz
2014-02-13 17:28 ` Stefan Monnier
2014-02-13 17:59   ` Thorsten Jolitz
2014-02-13 18:39     ` Michael Heerdegen
     [not found]   ` <mailman.14992.1392314356.10748.help-gnu-emacs@gnu.org>
2014-02-13 18:07     ` Barry Margolin [this message]
2014-02-13 18:52       ` Thorsten Jolitz
2014-02-14  6:51       ` Kevin Rodgers

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=barmar-854A71.13075913022014@news.eternal-september.org \
    --to=barmar@alum.mit.edu \
    --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.