In emacs, i have a small text selected as shown in the picture.
When i do eval-buffer, i like the kill-region to remove only the highlighted text. But this code empties the buffer.
;;this is a simple comment.... (message "%s" (region-active-p)) (kill-region (region-beginning) (region-end)) Doesn't region-end retun the selection region's end?

eval-bufferis probably either selecting the entire buffer, but too fast to see with the naked eye; or, perhaps the point (region-end) is pushed to the end of the buffer so that the region envelopes everything.