aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/outline.el42
1 files changed, 20 insertions, 22 deletions
diff --git a/lisp/outline.el b/lisp/outline.el
index 7cf56abd23a..669935bbc12 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -1100,28 +1100,26 @@ convenient way to make a table of contents of the buffer."
1100 (save-restriction 1100 (save-restriction
1101 (narrow-to-region beg end) 1101 (narrow-to-region beg end)
1102 (goto-char (point-min)) 1102 (goto-char (point-min))
1103 (let ((buffer (current-buffer)) 1103 (let ((buffer (current-buffer)) start end)
1104 start end) 1104 (with-temp-buffer
1105 (with-temp-buffer 1105 (let ((temp-buffer (current-buffer)))
1106 (with-current-buffer buffer 1106 (with-current-buffer buffer
1107 ;; Boundary condition: starting on heading: 1107 ;; Boundary condition: starting on heading:
1108 (when (outline-on-heading-p) 1108 (when (outline-on-heading-p)
1109 (outline-back-to-heading) 1109 (outline-back-to-heading)
1110 (setq start (point) 1110 (setq start (point)
1111 end (progn (outline-end-of-heading) 1111 end (progn (outline-end-of-heading) (point)))
1112 (point))) 1112 (with-current-buffer temp-buffer
1113 (insert-buffer-substring buffer start end) 1113 (insert-buffer-substring buffer start end)
1114 (insert "\n\n"))) 1114 (insert "\n\n")))
1115 (let ((temp-buffer (current-buffer))) 1115 (while (outline-next-heading)
1116 (with-current-buffer buffer 1116 (unless (outline-invisible-p)
1117 (while (outline-next-heading) 1117 (setq start (point)
1118 (unless (outline-invisible-p) 1118 end (progn (outline-end-of-heading) (point)))
1119 (setq start (point) 1119 (with-current-buffer temp-buffer
1120 end (progn (outline-end-of-heading) (point))) 1120 (insert-buffer-substring buffer start end)
1121 (with-current-buffer temp-buffer 1121 (insert "\n\n"))))))
1122 (insert-buffer-substring buffer start end) 1122 (kill-new (buffer-string)))))))
1123 (insert "\n\n"))))))
1124 (kill-new (buffer-string)))))))
1125 1123
1126(provide 'outline) 1124(provide 'outline)
1127(provide 'noutline) 1125(provide 'noutline)