Inserting text in another buffer than the current can deactivate the
mark in the current buffer. To see this start emacs with
emacs -Q
then paste this code into the *scratch* buffer and evaluate it:
(global-set-key [f9] 'temp-save)
(defun temp-save(start end)
(interactive "r")
(unless cua-mode
(error "Enable cua-mode to see the region"))
(unless mark-active
(error "The Region is not active"))
(let ((b (get-buffer-create "temporary temp-save buffer")))
(switch-to-buffer-other-window b)
(other-window 1)
(with-current-buffer b
(goto-char (1- (point-max)))
(when (y-or-n-p "Insert A? ")
(insert "A")(message "inserted A")(sit-for 2))
)
(message "After with-current-buffer, mark-active=%s"
mark-active)(sit-for 2)
)
(message "At end, mark-active=%s" mark-active)(sit-for 2)
)
Press F9 to test. First answer "n" to the question whether to insert "A"
in the other buffer. In this case the mark is not deactivated.
Then press F9 again to test. Now answer "y". The mark is now deactivated
at the return from the function temp-save.
In GNU Emacs 22.0.94.1 (i386-mingw-nt5.1.2600)
of 2007-02-24
_______________________________________________
emacs-pretest-bug mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug