emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thomas Fuchs <tfuchs13@googlemail.com>
To: emacs-orgmode@gnu.org
Subject: org-capture: file to top level with prepend
Date: Sun, 3 Oct 2010 06:01:38 +0200	[thread overview]
Message-ID: <AANLkTikV__Zb3XXNw9x4V0QWfwU1Qzyx+G5QK2vdv59-@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 757 bytes --]

Hi!

I'm trying to capture and file an entry as an top-level entry as first entry

in an org file without config at the beginning (no "#+").
This leads to filing the entry as _second_ headline in the org file.

The template is:
("z" "test" entry (file "~/Data/z.org") "* %^{Note} %t  :NOTE:\n %?"
:prepend t)

I think this is due to jumping over lines starting with "#+" at the
beginning of the org file
(line 715 in org-capture.el (org-capture-place-entry)).
My file has no config header and starts with the first headline. Calling
outline-next-heading
in this situation leads to jumping to the second headline in the file.

The appended patch fixes this problem by checking if we are on a headline
and then skips jumping to next headline.

Regards
Thomas

[-- Attachment #1.2: Type: text/html, Size: 926 bytes --]

[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 408 bytes --]

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 6ce9cdd..4143f7b 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -712,7 +712,8 @@ already gone."
       (setq level 1)
       (if reversed
 	  (progn (goto-char (point-min))
-		 (outline-next-heading))
+		 (if (not (org-at-heading-p))
+		     (outline-next-heading)))
 	(goto-char (point-max))
 	(or (bolp) (insert "\n"))))
      (t

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

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

             reply	other threads:[~2010-10-03  4:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-03  4:01 Thomas Fuchs [this message]
2010-10-15 19:51 ` org-capture: file to top level with prepend David Maus
2010-10-16  5:17 ` Carsten Dominik

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=AANLkTikV__Zb3XXNw9x4V0QWfwU1Qzyx+G5QK2vdv59-@mail.gmail.com \
    --to=tfuchs13@googlemail.com \
    --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).