emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: No Wayman <iarchivedmywholelife@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-capture at point
Date: Sat, 03 Oct 2020 02:36:06 -0400	[thread overview]
Message-ID: <877ds7ke95.fsf@kyleam.com> (raw)
In-Reply-To: <87ft6wwjnr.fsf@gmail.com>

No Wayman writes:

>> Looks like it was introduced with:
>>
>> f5573e6a0 org-capture.el: Fix heading's level when inserting a
>> template "here"
>
> I believe the issue is due to `org-back-to-heading' moving point 
> when calculating the heading level.
> The attached patch corrects the issue on my end.

Thank you!

> Subject: [PATCH] org-capture.el: Fix heading's position when inserting a
>  template "here"
>
> * lisp/org-capture.el (org-capture-place-entry): Fix heading's
> position when inserting a template "here" with C-0 M-x org-capture.
> ---
>  lisp/org-capture.el | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/lisp/org-capture.el b/lisp/org-capture.el
> index 67c58ffdd..020feb4d6 100644
> --- a/lisp/org-capture.el
> +++ b/lisp/org-capture.el
> @@ -1150,10 +1150,11 @@ may have been stored before."
>       (insert-here?
>        ;; FIXME: level should probably set directly within (let ...).
>        (setq level (org-get-valid-level
> -		   (if (or (org-at-heading-p)
> -			   (ignore-errors (org-back-to-heading t)))
> -		       (org-outline-level)
> -		     1))))
> +                   (if (or (org-at-heading-p)
> +                           (ignore-errors
> +			     (save-excursion (org-back-to-heading t))))
> +                       (org-outline-level)
> +                     1))))

This looks correct to me, and AFAICT this doesn't break the scenario
that prompted the code you're adjusting from f5573e6a0:
https://orgmode.org/list/87lfiuxqze.fsf@alphaville.usersys.redhat.com/

Applied (8d3610df0), extending the commit message with a Reported-by
trailer and link for https://orgmode.org/list/877dscaila.fsf@dwrz.net/


  reply	other threads:[~2020-10-03  6:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.57.1601395229.29559.emacs-orgmode@gnu.org>
2020-09-30  5:24 ` org-capture at point No Wayman
2020-10-02 18:46   ` No Wayman
2020-10-03  6:36     ` Kyle Meyer [this message]
2020-09-29 12:11 david wen riccardi-zhu
2020-10-03  6:45 ` Kyle Meyer

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=877ds7ke95.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=iarchivedmywholelife@gmail.com \
    /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).