emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: How to insert/replace during `org-elemment-map' call?
Date: Thu, 07 Aug 2014 18:11:17 +0200	[thread overview]
Message-ID: <878un09t5m.fsf@gmail.com> (raw)
In-Reply-To: 87k36kmofv.fsf@nicolasgoaziou.fr

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

Hello,

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> When I set that argument to non-nil (t or 'append or 'prepend), things
>> stop working because replacing/appending changes the parsed buffer,
>> but the :begin and :end properties of the already parsed elements are
>> not adjusted and I use them e.g. to delete a region.
>>
>> Without using the export-framework (which seems overkill in this
>> case), is there a way to make this work anyway?
>
> You can make replacements backwards, i.e., starting from the bottom of
> the buffer.

Its not really obvious for me how to do that. You mean simply by doing
it in 2 steps

 1. map parse-tree and get the result list

 2. goto point-max of buffer and use the result list to replace mapped
 elements backwards

or rather a 'trick' to make org-element-map process the parse-tree
backwards and thus start with replacing the last element?
Not sure what this trick would be - partly reverse the parse-tree?

-- 
cheers,
Thorsten

  reply	other threads:[~2014-08-07 16:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-07 11:27 How to insert/replace during `org-elemment-map' call? Thorsten Jolitz
2014-08-07 13:14 ` Nicolas Goaziou
2014-08-07 16:11   ` Thorsten Jolitz [this message]
2014-08-07 19:32     ` 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=878un09t5m.fsf@gmail.com \
    --to=tjolitz@gmail.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).