From e5fd3699dd05bbd3cc652082215705c26c5509f3 Mon Sep 17 00:00:00 2001 From: Sebastian Christ Date: Sun, 20 Nov 2016 14:51:05 +0100 Subject: [PATCH] Move insert newline condition up again. Especially the goto-char needs special protection. This shouldn't be made when no newline is requested. --- interleave.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/interleave.el b/interleave.el index dc901d2..1e50198 100644 --- a/interleave.el +++ b/interleave.el @@ -347,15 +347,15 @@ If POSITION is non-nil move point to it." (switch-to-buffer interleave-org-buffer)) (when (integerp position) (goto-char position)) - (save-restriction - (interleave--narrow-to-subtree t) - (goto-char (point-max)) - (unless interleave-disable-narrowing - (redisplay)) - ;; Insert a new line if not already on a new line - (when (and insert-newline-maybe - (not (looking-back "^ *" (line-beginning-position)))) - (org-return)))) + (when insert-newline-maybe + (save-restriction + (interleave--narrow-to-subtree t) + (goto-char (point-max)) + (unless interleave-disable-narrowing + (redisplay)) + ;; Insert a new line if not already on a new line + (when (not (looking-back "^ *" (line-beginning-position))) + (org-return))))) (defun interleave--switch-to-pdf-buffer () "Switch to the pdf buffer."