unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: 30209@debbugs.gnu.org
Cc: Dmitry Safronov <saf.dmitry@gmail.com>
Subject: bug#30209: Fix wrong behavior of 'outline-headers-as-kill' command
Date: Tue, 20 Feb 2018 19:31:13 -0500	[thread overview]
Message-ID: <87zi43420e.fsf@gmail.com> (raw)
In-Reply-To: <87606r5hkg.fsf@gmail.com> (Noam Postavsky's message of "Tue, 20 Feb 2018 19:09:51 -0500")

[-- Attachment #1: Type: text/plain, Size: 369 bytes --]

tags 30209 + patch
quit

Noam Postavsky <npostavs@gmail.com> writes:

> [forwarding to list

Dang it, I messed up the forwarding by trying to trim out the
repetition.  Oh well, here's the patch formatted by git.  First I'll
show the whitespace-ignoring version of that patch, which gets the point
across with a bit less noise (the full version is attached afterward).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1596 bytes --]

From de625d053871edcdec683e4e4d560b7a47d27e65 Mon Sep 17 00:00:00 2001
From: Dmitry Safronov <saf.dmitry@gmail.com>
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


[-- Attachment #3: patch --]
[-- Type: text/plain, Size: 2519 bytes --]

From de625d053871edcdec683e4e4d560b7a47d27e65 Mon Sep 17 00:00:00 2001
From: Dmitry Safronov <saf.dmitry@gmail.com>
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 | 42 ++++++++++++++++++++----------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/lisp/outline.el b/lisp/outline.el
index 7cf56abd23..669935bbc1 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -1100,28 +1100,26 @@ outline-headers-as-kill
     (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)
-- 
2.11.0


[-- Attachment #4: Type: text/plain, Size: 616 bytes --]


> From: Dmitry Safronov <saf.dmitry@gmail.com>
> Subject: Re: bug#30209: Fix wrong behavior of 'outline-headers-as-kill' command
> To: Noam Postavsky <npostavs@gmail.com>
> Date: Mon, 19 Feb 2018 13:06:46 +0100 (1 day, 12 hours, 16 minutes ago)
>
>> Have you assigned copyright for Emacs?  (I
>> guess the patch will be small enough to apply anyway, but it needs to be
>> marked in that case.)
>
> Where can I assign copyright for Emacs?

Fill in the form at [1], send it to fsf-records@gnu.org and await
further instructions.

https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.program

  reply	other threads:[~2018-02-21  0:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-22 11:19 bug#30209: Fix wrong behavior of 'outline-headers-as-kill' command Dmitry Safronov
2018-02-18 15:11 ` Noam Postavsky
2018-02-21  0:09 ` Noam Postavsky
2018-02-21  0:31   ` Noam Postavsky [this message]
2018-03-11  2:06 ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zi43420e.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=30209@debbugs.gnu.org \
    --cc=saf.dmitry@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).