summaryrefslogtreecommitdiff
path: root/lisp/outline.el
diff options
context:
space:
mode:
authorDmitry Safronov <saf.dmitry@gmail.com>2018-01-22 12:19:00 +0100
committerNoam Postavsky <npostavs@gmail.com>2018-03-10 19:51:25 -0500
commitfda58fbc245a3f6f6722261ffb2e2262231bd4ea (patch)
tree7722524e59d64356fa6004188c33f0bfee281800 /lisp/outline.el
parenta8be860e17e2a737bda7a4c5075b71f0fb627a92 (diff)
downloademacs-fda58fbc245a3f6f6722261ffb2e2262231bd4ea.tar.gz
Fix wrong behavior of 'outline-headers-as-kill' command (Bug#30209)
* outline.el (outline-headers-as-kill): Fix heading duplication.
Diffstat (limited to 'lisp/outline.el')
-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."
(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)