diff options
author | Rasmus <rasmus@gmx.us> | 2018-03-27 23:34:41 +0200 |
---|---|---|
committer | Rasmus <rasmus@gmx.us> | 2018-03-27 23:34:41 +0200 |
commit | 613c9a5c1f3237fbdc3a3db2341c7c59353d2aa2 (patch) | |
tree | 7651699ebeb2a2a2d8d1081707d091fbc424e8fb /lisp/org/ob-core.el | |
parent | 1b075a9e38ca6812417f95ed2272e61d875d9e86 (diff) | |
download | emacs-613c9a5c1f3237fbdc3a3db2341c7c59353d2aa2.tar.gz emacs-613c9a5c1f3237fbdc3a3db2341c7c59353d2aa2.tar.bz2 emacs-613c9a5c1f3237fbdc3a3db2341c7c59353d2aa2.zip |
Update Org to v9.1.9
Please note this is a bugfix release. See etc/ORG-NEWS for details.
Diffstat (limited to 'lisp/org/ob-core.el')
-rw-r--r-- | lisp/org/ob-core.el | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el index 0e2e78a6710..5d5faaa6fd0 100644 --- a/lisp/org/ob-core.el +++ b/lisp/org/ob-core.el @@ -5,7 +5,7 @@ ;; Authors: Eric Schulte ;; Dan Davison ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. @@ -980,13 +980,24 @@ with a prefix argument then this is passed on to (defmacro org-babel-do-in-edit-buffer (&rest body) "Evaluate BODY in edit buffer if there is a code block at point. Return t if a code block was found at point, nil otherwise." - `(let ((org-src-window-setup 'switch-invisibly)) - (when (and (org-babel-where-is-src-block-head) + (declare (debug (body))) + `(let* ((element (org-element-at-point)) + ;; This function is not supposed to move point. However, + ;; `org-edit-src-code' always moves point back into the + ;; source block. It is problematic if the point was before + ;; the code, e.g., on block's opening line. In this case, + ;; we want to restore this location after executing BODY. + (outside-position + (and (<= (line-beginning-position) + (org-element-property :post-affiliated element)) + (point-marker))) + (org-src-window-setup 'switch-invisibly)) + (when (and (org-babel-where-is-src-block-head element) (org-edit-src-code)) (unwind-protect (progn ,@body) - (org-edit-src-exit)) + (org-edit-src-exit) + (when outside-position (goto-char outside-position))) t))) -(def-edebug-spec org-babel-do-in-edit-buffer (body)) (defun org-babel-do-key-sequence-in-edit-buffer (key) "Read key sequence and execute the command in edit buffer. |