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

`insert' deactivates active region



Hi,

Please read and try the following Lisp code.  In the *testing*
buffer, you may see you cannot activate the region by using
C-SPC and C-f, etc.  Furthermore, M-w cannot be used to copy
text, either.

(let ((buffer (get-buffer-create "*testing*")))
  (pop-to-buffer buffer)
  (erase-buffer)
  (insert "Hello World\n")
  (goto-char (point-min))
  (set (make-local-variable 'transient-mark-mode) t)
  (add-hook 'post-command-hook
	    (lambda nil
	      (with-temp-buffer
		(insert "foo")
		))
	    nil t))

One of the ways to solve the problem I found is to remove the
`(insert "foo")' line.  This problem occurs not only with Emacs
22, but also 21 and 20.  A similar code is used in emacs-w3m and
we are discussing the solution which is effective on all Emacs
versions (there's already a promising solution).

Regards,