emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Lundin <mdl@imapmail.org>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: [PATCH] Ensure proper nesting of captured items
Date: Sat, 09 Sep 2017 11:18:32 -0500	[thread overview]
Message-ID: <87d16z7smf.fsf@fastmail.fm> (raw)

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

I configure my org-capture templates set to insert items at the end of a
capture file: i.e., with a simple file target - (file "~/org/inbox.org")
- and no target headline. In the past, org capture would always insert
these as top level headings, regardless of existing headings in the
target file. Recently, org-capture has begun to nest these entries
according to context. This is undesirable, as it has caused many
important capture items to be buried under unrelated headings.

I did a git bisect and found the problematic commit from June 2, 2017:

57d0a7453d0386f3f1425fc5319b2f42fca16e42

As far as I can tell, that commit took out the line in
org-capture-place-entry that sets level to 1 when there is no target
entry. The attached patch makes a minor change to fix the issue.

Best,
Matt 


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Ensure-that-top-level-capture-targets-are-pasted-at-.patch --]
[-- Type: text/x-diff, Size: 972 bytes --]

From 20ead737aebc9c46aa291b5a70248c57f3fd64a1 Mon Sep 17 00:00:00 2001
From: Matt Lundin <mdl@imapmail.org>
Date: Sat, 9 Sep 2017 11:08:06 -0500
Subject: [PATCH] Ensure that top-level capture targets are pasted at level 1

* lisp/org-capture.el: (org-capture-place-entry) Ensure that level is
  set to 1 (i.e., the top level) if there is no headline target
  defined. Otherwise, captured items are improperly nested by context.
---
 lisp/org-capture.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index cd1944d96..2ddb9c505 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1097,7 +1097,7 @@ may have been stored before."
 (defun org-capture-place-entry ()
   "Place the template as a new Org entry."
   (let ((reversed? (org-capture-get :prepend))
-	level)
+	(level 1))
     (when (org-capture-get :exact-position)
       (goto-char (org-capture-get :exact-position)))
     (cond
-- 
2.14.1


             reply	other threads:[~2017-09-09 16:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-09 16:18 Matt Lundin [this message]
2017-09-09 16:40 ` [PATCH] Ensure proper nesting of captured entries Matt Lundin
2017-09-10  7:40 ` [PATCH] Ensure proper nesting of captured items Nicolas Goaziou

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.orgmode.org/

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

  git send-email \
    --in-reply-to=87d16z7smf.fsf@fastmail.fm \
    --to=mdl@imapmail.org \
    --cc=emacs-orgmode@gnu.org \
    /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/org-mode.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).