]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
fix bba-copy-org-src-block.
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Wed, 24 Jan 2018 17:03:35 +0000 (18:03 +0100)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Wed, 24 Jan 2018 17:03:35 +0000 (18:03 +0100)
Copy current block as well if cursor is on begin-src.

Signed-off-by: Andreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
bba.org

diff --git a/bba.org b/bba.org
index ce80cf885f14715b3ba77e47b5dae11514da95f5..c9f6450ffb3cf1eebf5a4118ad6051848a3928f5 100644 (file)
--- a/bba.org
+++ b/bba.org
@@ -1145,13 +1145,14 @@ This is helpful in training sessions.
     "copy last org src block. Can be around point, too."
     (interactive)
     (push-mark)
-    (re-search-backward "\#\\+BEGIN_SRC")
-    (previous-line)
+    (goto-char (point-at-bol))
+    (if  (not (looking-at "\#\\+BEGIN_SRC"))(re-search-backward "\#\\+BEGIN_SRC"))
+    (forward-line -1)
     (if  (not (looking-at "\#"))(forward-line))
     (set-mark-command nil)
     (re-search-forward "\#\\+END_SRC")
     (forward-line)
-    (beginning-of-line)
+    (goto-char (point-at-bol))
     (kill-ring-save 1 1 1)
     (set-mark-command '1)
     (set-mark-command '1)