From e6f36cfe3add93dd4a567523bc0b4d82583b65dd Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 18 Jun 2015 15:21:02 +0200 Subject: [PATCH] ox: Tiny refactoring * lisp/ox.el (org-export-replace-region-by): Refactor. --- lisp/ox.el | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lisp/ox.el b/lisp/ox.el index 9a24a5d36..34ccfe047 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -2978,14 +2978,10 @@ Return code as a string." BACKEND is either an export back-end, as returned by, e.g., `org-export-create-backend', or a symbol referring to a registered back-end." - (if (not (org-region-active-p)) - (user-error "No active region to replace") - (let* ((beg (region-beginning)) - (end (region-end)) - (str (buffer-substring beg end)) rpl) - (setq rpl (org-export-string-as str backend t)) - (delete-region beg end) - (insert rpl)))) + (unless (org-region-active-p) (user-error "No active region to replace")) + (insert + (org-export-string-as + (delete-and-extract-region (region-beginning) (region-end)) backend t))) ;;;###autoload (defun org-export-insert-default-template (&optional backend subtreep) -- 2.11.4.GIT