From 5119a791f4d34a668c4b595abc16f5d0fc137d23 Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Mon, 15 Feb 2021 06:16:08 +0530 Subject: [PATCH] [cp-org] indent cursor at the end of cp-org-insert-src --- contrapunctus/cp-org.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/contrapunctus/cp-org.el b/contrapunctus/cp-org.el index c7d2e93..d869ef5 100644 --- a/contrapunctus/cp-org.el +++ b/contrapunctus/cp-org.el @@ -119,12 +119,14 @@ (org-link-set-parameters "gemini" :export #'org-link-gemini-export-link)) (defun cp-org-insert-src (&optional lang) - (let ((col (- (point) (point-at-bol)))) + (let* ((col (- (point) (point-at-bol))) + (indent (make-string col ?\ ))) (insert (format "#+BEGIN_SRC %s\n" (if (stringp lang) lang ""))) (let ((pos (point))) - (insert (format "\n%s#+END_SRC" (make-string col ?\ ))) - (goto-char pos)))) + (insert (format "\n%s#+END_SRC" indent)) + (goto-char pos) + (insert indent)))) (defhydra cp-org-src (:color blue) "Org source block"