Search code examples
emacslispregion

How do I access the contents of the current region in Emacs Lisp?


I want to access the contents of the current region as a string within a function. For example:

(concat "stringa" (get-region-as-string) "stringb")

Thanks

Ed


Solution

  • buffer-substring together with region-beginning and region-end can do that.