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

Re: `insert' deactivates active region



>>>>> In <20050708.115914.82945082.jet@gyve.org> Masatake YAMATO wrote:

> Yamaoka-san, could you try this code?
[...]
> 		(insert "foo")
> 		(setq deactivate-mark nil)
[...]
> or
[...]
> 		(let (deactivate-mark)
> 		  (insert "foo"))

Oh, I didn't know such a special variable.  That solution seems
very good!  I confirmed it is effective in Emacs 20 through 23.
Thank you.

> If you think this work-around is not enough, talk to emacs-devel.
> I'll write a report my investigation about this bug.

Is it really a bug?  The docstring for the deactivate-mark
variable says:

  If an editing command sets this to t, deactivate the mark afterward.
  The command loop sets this to nil before each command,
  and tests the value when the command returns.
  Buffer modification stores t in this variable.

Now I came to think it is no wonder that `insert' sets
`deactivate-mark', because `insert' really edits the buffer.
The real trouble is that we didn't know it, isn't it? ;-)