From de625d053871edcdec683e4e4d560b7a47d27e65 Mon Sep 17 00:00:00 2001 From: Dmitry Safronov Date: Mon, 22 Jan 2018 12:19:00 +0100 Subject: [PATCH] Fix wrong behavior of 'outline-headers-as-kill' command (Bug#30209) * outline.el (outline-headers-as-kill): Fix heading duplication. Copyright-paperwork-exempt: yes --- lisp/outline.el | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lisp/outline.el b/lisp/outline.el index 7cf56abd23..669935bbc1 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -1100,20 +1100,18 @@ outline-headers-as-kill (save-restriction (narrow-to-region beg end) (goto-char (point-min)) - (let ((buffer (current-buffer)) - start end) + (let ((buffer (current-buffer)) start end) (with-temp-buffer + (let ((temp-buffer (current-buffer))) (with-current-buffer buffer ;; Boundary condition: starting on heading: (when (outline-on-heading-p) (outline-back-to-heading) (setq start (point) - end (progn (outline-end-of-heading) - (point))) + end (progn (outline-end-of-heading) (point))) + (with-current-buffer temp-buffer (insert-buffer-substring buffer start end) (insert "\n\n"))) - (let ((temp-buffer (current-buffer))) - (with-current-buffer buffer (while (outline-next-heading) (unless (outline-invisible-p) (setq start (point) -- 2.11.0