all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#30209: Fix wrong behavior of 'outline-headers-as-kill' command
@ 2018-01-22 11:19 Dmitry Safronov
  2018-02-18 15:11 ` Noam Postavsky
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dmitry Safronov @ 2018-01-22 11:19 UTC (permalink / raw)
  To: 30209

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

Problem:

Issuing 'outline-headers-as-kill' command in Outline mode on following
region


* Heading 1

** Heading 2

*** Heading 3


leads to duplication of the first heading in the current buffer when region
starts on this heading:


* Heading 1* Heading 1



** Heading 2

*** Heading 3


Following patch will fix this behavior:


--- outline.el 2018-01-22 11:29:20.563650997 +0100
+++ outline_new.el 2018-01-22 11:35:00.959648171 +0100
@@ -1100,28 +1100,26 @@ (defun outline-headers-as-kill (beg end)
     (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)


ChangeLog entry:

2018-01-22  Dmitry Safronov  <saf-dmitry@gmail.com>

           * outline.el (outline-headers-as-kill): Fix heading duplication.

[-- Attachment #2: Type: text/html, Size: 5351 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30209: Fix wrong behavior of 'outline-headers-as-kill' command
  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-03-11  2:06 ` Noam Postavsky
  2 siblings, 0 replies; 5+ messages in thread
From: Noam Postavsky @ 2018-02-18 15:11 UTC (permalink / raw)
  To: Dmitry Safronov; +Cc: 30209

Dmitry Safronov <saf.dmitry@gmail.com> writes:

> Problem:
>
> Issuing 'outline-headers-as-kill' command in Outline mode on
> following region
>
>
> * Heading 1
>
> ** Heading 2
>
> *** Heading 3
>
>
> leads to duplication of the first heading in the current buffer when
> region starts on this heading:
>
>
> * Heading 1* Heading 1
>
>
>
> ** Heading 2
>
> *** Heading 3
>
>
> Following patch will fix this behavior:

Thanks, could you resend this as an attachment please, there seems to
have been some whitespace translation which makes it difficult to apply
the patch automatically.  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.)





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30209: Fix wrong behavior of 'outline-headers-as-kill' command
  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
  2018-03-11  2:06 ` Noam Postavsky
  2 siblings, 1 reply; 5+ messages in thread
From: Noam Postavsky @ 2018-02-21  0:09 UTC (permalink / raw)
  To: 30209; +Cc: Dmitry Safronov

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

[forwarding to list, please use "Reply All" to keep the bug thread on cc]


[-- Attachment #2: Type: message/rfc822, Size: 4087 bytes --]

From: Dmitry Safronov <saf.dmitry@gmail.com>
To: Noam Postavsky <npostavs@gmail.com>
Subject: Re: bug#30209: Fix wrong behavior of 'outline-headers-as-kill' command
Date: Mon, 19 Feb 2018 13:06:46 +0100
Message-ID: <CAGMQXKna3GpxP5T1d00okdUkG5MM7tdfs3dAwXpDGRX4N=wkDA@mail.gmail.com>

--001a113d40f237b5fb05658f87cd
Content-Type: multipart/alternative; boundary="001a113d40f237b5f505658f87cb"

--001a113d40f237b5f505658f87cb
Content-Type: text/plain; charset="UTF-8"

> Thanks, could you resend this as an attachment please, there seems to
> have been some whitespace translation which makes it difficult to apply
> the patch automatically.

Please see the attached file.

> 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?

--001a113d40f237b5f505658f87cb--
--001a113d40f237b5fb05658f87cd
Content-Type: application/octet-stream; name=outline-patch
Content-Disposition: attachment; filename=outline-patch
Content-Transfer-Encoding: base64
X-Attachment-Id: f_jdu6ahj60

LS0tIG91dGxpbmUuZWwJMjAxOC0wMS0yMiAxMToyOToyMC41NjM2NTA5OTcgKzAxMDAKKysrIG91
dGxpbmVfbmV3LmVsCTIwMTgtMDEtMjIgMTE6MzU6MDAuOTU5NjQ4MTcxICswMTAwCkBAIC0xMTAw
LDI4ICsxMTAwLDI2IEBAIChkZWZ1biBvdXRsaW5lLWhlYWRlcnMtYXMta2lsbCAoYmVnIGVuZCkK
ICAgICAoc2F2ZS1yZXN0cmljdGlvbgogICAgICAgKG5hcnJvdy10by1yZWdpb24gYmVnIGVuZCkK
ICAgICAgIChnb3RvLWNoYXIgKHBvaW50LW1pbikpCi0gICAgIC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Ag
ICAgICAod2l0aC10ZW1wLWJ1ZmZlcgorICAgICAgICAgIChsZXQgKCh0ZW1wLWJ1ZmZlciAoY3Vy
cmVudC1idWZmZXIpKSkKKyAgICAgICAgICAgICh3aXRoLWN1cnJlbnQtYnVmZmVyIGJ1ZmZlcgor
ICAgICAgICAgICAgICA7OyBCb3VuZGFyeSBjb25kaXRpb246IHN0YXJ0aW5nIG9uIGhlYWRpbmc6
CisgICAgICAgICAgICAgICh3aGVuIChvdXRsaW5lLW9uLWhlYWRpbmctcCkKKyAgICAgICAgICAg
ICAgICAob3V0bGluZS1iYWNrLXRvLWhlYWRpbmcpCisgICAgICAgICAgICAgICAgKHNldHEgc3Rh
cnQgKHBvaW50KQorICAgICAgICAgICAgICAgICAgICAgIGVuZCAocHJvZ24gKG91dGxpbmUtZW5k
LW9mLWhlYWRpbmcpIChwb2ludCkpKQorICAgICAgICAgICAgICAgICh3aXRoLWN1cnJlbnQtYnVm
ZmVyIHRlbXAtYnVmZmVyCisgICAgICAgICAgICAgICAgICAoaW5zZXJ0LWJ1ZmZlci1zdWJzdHJp
bmcgYnVmZmVyIHN0YXJ0IGVuZCkKKyAgICAgICAgICAgICAgICAgIChpbnNlcnQgIlxuXG4iKSkp
CisgICAgICAgICAgICAgICh3aGlsZSAob3V0bGluZS1uZXh0LWhlYWRpbmcpCisgICAgICAgICAg
ICAgICAgKHVubGVzcyAob3V0bGluZS1pbnZpc2libGUtcCkKKyAgICAgICAgICAgICAgICAgIChz
ZXRxIHN0YXJ0IChwb2ludCkKKyAgICAgICAgICAgICAgICAgICAgICAgIGVuZCAocHJvZ24gKG91
dGxpbmUtZW5kLW9mLWhlYWRpbmcpIChwb2ludCkpKQorICAgICAgICAgICAgICAgICAgKHdpdGgt
Y3VycmVudC1idWZmZXIgdGVtcC1idWZmZXIKKyAgICAgICAgICAgICAgICAgICAgKGluc2VydC1i
dWZmZXItc3Vic3RyaW5nIGJ1ZmZlciBzdGFydCBlbmQpCisgICAgICAgICAgICAgICAgICAgIChp
bnNlcnQgIlxuXG4iKSkpKSkpCisgICAgICAgICAgKGtpbGwtbmV3IChidWZmZXItc3RyaW5nKSkp
KSkpKQoKIChwcm92aWRlICdvdXRsaW5lKQogKHByb3ZpZGUgJ25vdXRsaW5lKQo=
--001a113d40f237b5fb05658f87cd--

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30209: Fix wrong behavior of 'outline-headers-as-kill' command
  2018-02-21  0:09 ` Noam Postavsky
@ 2018-02-21  0:31   ` Noam Postavsky
  0 siblings, 0 replies; 5+ messages in thread
From: Noam Postavsky @ 2018-02-21  0:31 UTC (permalink / raw)
  To: 30209; +Cc: Dmitry Safronov

[-- 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#30209: Fix wrong behavior of 'outline-headers-as-kill' command
  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-03-11  2:06 ` Noam Postavsky
  2 siblings, 0 replies; 5+ messages in thread
From: Noam Postavsky @ 2018-03-11  2:06 UTC (permalink / raw)
  To: 30209; +Cc: Dmitry Safronov

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

tags 30209 fixed
close 30209 27.1
quit

[forwarding to list]


[-- Attachment #2: Type: message/rfc822, Size: 692 bytes --]

From: Dmitry Safronov <saf.dmitry@gmail.com>
To: Noam Postavsky <npostavs@gmail.com>
Subject: Re: bug#30209: Fix wrong behavior of 'outline-headers-as-kill' command
Date: Fri, 9 Mar 2018 11:17:38 +0100
Message-ID: <CAGMQXKk8SzcB4mLJd82z4ayhzE_DRaM+wbX+S82m_HxOrKus7g@mail.gmail.com>

--94eb2c0d54940e3fe70566f81aa5
Content-Type: text/plain; charset="UTF-8"

I have signed copyright for Emacs. Do you need some more information/help
from me?

--94eb2c0d54940e3fe70566f81aa5--

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



Thanks, pushed to master.

[1: fda58fbc24]: 2018-03-10 19:51:25 -0500
  Fix wrong behavior of 'outline-headers-as-kill' command (Bug#30209)
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=fda58fbc245a3f6f6722261ffb2e2262231bd4ea

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-03-11  2:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2018-03-11  2:06 ` Noam Postavsky

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.