]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix wrong behavior of 'outline-headers-as-kill' command (Bug#30209)
authorDmitry Safronov <saf.dmitry@gmail.com>
Mon, 22 Jan 2018 11:19:00 +0000 (12:19 +0100)
committerAndrew G Cohen <cohen@andy.bu.edu>
Tue, 11 Dec 2018 06:15:03 +0000 (14:15 +0800)
* outline.el (outline-headers-as-kill): Fix heading duplication.

lisp/outline.el

index 7cf56abd23a057ec9eeea2e45dbdb1c27ca7a0d8..669935bbc12c2fa1ded466c72ebafb655ebe3b17 100644 (file)
@@ -1100,28 +1100,26 @@ convenient way to make a table of contents of the buffer."
     (save-restriction
       (narrow-to-region beg end)
       (goto-char (point-min))
-      (let ((buffer (current-buffer))
-           start end)
-       (with-temp-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)))
-             (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)
-                       end (progn (outline-end-of-heading) (point)))
-                 (with-current-buffer temp-buffer
-                   (insert-buffer-substring buffer start end)
-                   (insert "\n\n"))))))
-         (kill-new (buffer-string)))))))
+      (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)))
+                (with-current-buffer temp-buffer
+                  (insert-buffer-substring buffer start end)
+                  (insert "\n\n")))
+              (while (outline-next-heading)
+                (unless (outline-invisible-p)
+                  (setq start (point)
+                        end (progn (outline-end-of-heading) (point)))
+                  (with-current-buffer temp-buffer
+                    (insert-buffer-substring buffer start end)
+                    (insert "\n\n"))))))
+          (kill-new (buffer-string)))))))
 
 (provide 'outline)
 (provide 'noutline)