emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: (push-mark N t t) doesn't activate region in virgin


From: Stuart D. Herring
Subject: Re: address@hidden: (push-mark N t t) doesn't activate region in virgin buffer]
Date: Tue, 27 Feb 2007 11:32:33 -0800 (PST)
User-agent: SquirrelMail/1.4.8-2.el3.7lanl

> Would someone please DTRT then ack?
>
> [from Drew:]
> emacs -Q
> M-x transient-mark-mode ; turn it on
> M-: (goto-char (point-min))
> M-: (mark t) ; returns nil
> M-: (push-mark 20 t t)
> M-: (mark t) ; returns 20
> M-: mark-active ; returns nil
>
> The region is not activated by the call to push-mark, but it should
> be, IMO. (point) = 1, mark = 20, and transient-mark-mode is on. The
> doc of push-mark says that it activates the mark if the third arg is
> non-nil.

What's happening here is that the buffer modification of printing the
result of your M-: expressions is setting `deactivate-mark' and undoing
the effect of the `push-mark' (in the wrong buffer).  (The same thing
occurs with C-x C-e.)

Try evaluating these:

;; You should see the region highlighted for one second:
(progn (push-mark 10 t t) (sit-for 1))

;; Demonstrates that `prin1' sets `deactivate-mark':
(cons (cons mark-active deactivate-mark)
      (progn (prin1 "!") (cons mark-active deactivate-mark)))

Replacing `prin1' with `message' shows that the latter does not have this
effect.

I'm not sure what the right fix is: it might be best to let-bind
`deactivate-mark' around `prin1' or so, or else to improve the command
loop in general to notice that buffer modifications in one place (e.g.,
the echo area) should not affect the mark in other places.  Thoughts?

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




reply via email to

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