emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Ensure proper nesting of captured items
@ 2017-09-09 16:18 Matt Lundin
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Matt Lundin @ 2017-09-09 16:18 UTC (permalink / raw)
  To: Org Mode

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


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

* Re: [PATCH] Ensure proper nesting of captured entries
  2017-09-09 16:18 [PATCH] Ensure proper nesting of captured items Matt Lundin
@ 2017-09-09 16:40 ` Matt Lundin
  2017-09-10  7:40 ` [PATCH] Ensure proper nesting of captured items Nicolas Goaziou
  1 sibling, 0 replies; 3+ messages in thread
From: Matt Lundin @ 2017-09-09 16:40 UTC (permalink / raw)
  To: Org Mode

Matt Lundin <mdl@imapmail.org> writes:

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

A note of clarification. My post and patch relate to headline entries,
not list items. Apologies for the confusion about terminology.

Best,
Matt

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

* Re: [PATCH] Ensure proper nesting of captured items
  2017-09-09 16:18 [PATCH] Ensure proper nesting of captured items Matt Lundin
  2017-09-09 16:40 ` [PATCH] Ensure proper nesting of captured entries Matt Lundin
@ 2017-09-10  7:40 ` Nicolas Goaziou
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Goaziou @ 2017-09-10  7:40 UTC (permalink / raw)
  To: Org Mode

Hello,

Matt Lundin <mdl@imapmail.org> writes:

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

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2017-09-10  7:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-09 16:18 [PATCH] Ensure proper nesting of captured items Matt Lundin
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

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).