From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?B?TWFydGluIFlyasO2bMOk?= Subject: [PATCH] org-capture: fix capture breaking next headline Date: Sun, 21 Oct 2018 16:14:19 +0300 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0000000000003613860578bcecbf" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEDZQ-0005Ix-Ba for emacs-orgmode@gnu.org; Sun, 21 Oct 2018 09:15:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gEDZN-0006Bh-TY for emacs-orgmode@gnu.org; Sun, 21 Oct 2018 09:15:03 -0400 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]:35795) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gEDZL-00068x-D6 for emacs-orgmode@gnu.org; Sun, 21 Oct 2018 09:15:01 -0400 Received: by mail-ed1-x52a.google.com with SMTP id y19-v6so35393783edd.2 for ; Sun, 21 Oct 2018 06:14:56 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Org Mode --0000000000003613860578bcecbf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, I have noticed my capture workflow breaking org document hierarchies. Here is an example: Start with the org document: * A * B An org capture template inserts a headline under A. * A ** [point here] * B When I navigate to the end of the narrowed capture buffer (e.g. `(end-of-buffer)') and insert text, it will break the B headline like this: * A ** inserted text[point here]* B I expected the following behavior * A ** inserted text[point here] * B In the enclosed patch, I added a test for this behavior. I would prefer that inserting text in narrowed capture buffers would not break the document hierarchy. The fix is to subtract one from the `end' originally supplied to `org-capture-narrow'. -- Martin Yrj=C3=B6l=C3=A4 --0000000000003613860578bcecbf Content-Type: application/octet-stream; name="0001-org-capture-fix-capture-breaking-next-headline.patch" Content-Disposition: attachment; filename="0001-org-capture-fix-capture-breaking-next-headline.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jnivxju90 RnJvbSBlMmRhNTllYWY5Yjk4MDk3ZTBiMGZjYTVmZWU5ODIyNDFmNjA1ZmI1IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiA9P1VURi04P3E/TWFydGluPTIwWXJqPUMzPUI2bD1DMz1BND89 IDxtYXJ0aW4ueXJqb2xhQGdtYWlsLmNvbT4KRGF0ZTogU3VuLCAyMSBPY3QgMjAxOCAxNDo1ODoy MCArMDMwMApTdWJqZWN0OiBbUEFUQ0hdIG9yZy1jYXB0dXJlOiBmaXggY2FwdHVyZSBicmVha2lu ZyBuZXh0IGhlYWRsaW5lCgoqIGxpc3Avb3JnLWNhcHR1cmUuZWwgKG9yZy1jYXB0dXJlLXBsYWNl LWVudHJ5KTogbmFycm93IHRvIGVuZCAtIDEKKiB0ZXN0aW5nL2xpc3AvdGVzdC1vcmctY2FwdHVy ZS5lbCAodGVzdC1vcmctY2FwdHVyZS9pbnNlcnQtYXQtZW5kLXNhZmUpOgp0ZXN0IHRoYXQgaW5z ZXJ0aW5nIGF0IGVuZCBkb2VzIG5vdCBicmVhayB0aGUgbmV4dCBoZWFkbGluZS4KCkhlcmUgZm9s bG93cyB0aGUgYmVoYXZpb3Igb2YgdGhlIGB0ZXN0LW9yZy1jYXB0dXJlL2luc2VydC1hdC1lbmQt c2FmZScKdGVzdCBiZWZvcmUgYW5kIGFmdGVyIHRoZSBjaGFuZ2UgdG8gYG9yZy1jYXB0dXJlLXBs YWNlLWVudHJ5Jy4KQmVmb3JlOiAiKiBBXG4qKiBIMSBcbkNhcHR1cmUgdGV4dCogQlxuIiAtPiBi cmVha3MgQiBoZWFkbGluZQpBZnRlcjogIiogQVxuKiogSDEgQ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