How to determine if in the current buffer some text is selected?

  • 4
    region-active-p – abo-abo Apr 17 '15 at 11:41

You can use region-active-p.

Just to add something to the short answer, region-active-p won't work in -batch, so you need to enable this (which is actually default in plain Emacs):

(transient-mark-mode 1)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.