mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-04 15:41:37 -05:00
jupyter-org--set-current-src-block: Simplify calculation of block end
This also fixes an edge case when there is only one blank line after the source block. The previous version would consider the beginning of the last line of the code block as the end instead of the beginning of the `#+end_src` line in that case.
This commit is contained in:
parent
460eba73ec
commit
80c623ab40
1 changed files with 4 additions and 7 deletions
|
@ -355,15 +355,12 @@ most recent completion request.")
|
|||
(let* ((info (org-babel-get-src-block-info el))
|
||||
(params (nth 2 info))
|
||||
(beg (save-excursion
|
||||
(goto-char
|
||||
(org-element-property :post-affiliated el))
|
||||
(goto-char (org-element-property :post-affiliated el))
|
||||
(line-beginning-position 2)))
|
||||
(end (save-excursion
|
||||
(goto-char
|
||||
(org-element-property :end el))
|
||||
(let ((pblank (org-element-property :post-blank el)))
|
||||
(line-beginning-position
|
||||
(unless (zerop pblank) (- pblank)))))))
|
||||
(goto-char (org-element-property :end el))
|
||||
(skip-chars-backward "\r\n")
|
||||
(line-beginning-position))))
|
||||
(unless jupyter-org--src-block-cache
|
||||
(setq jupyter-org--src-block-cache
|
||||
(list nil (point-marker) (point-marker)))
|
||||
|
|
Loading…
Add table
Reference in a new issue