emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Magnus Henoch <magnus.henoch@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Use save-excursion in org-map-dblocks
Date: Wed, 24 Mar 2010 13:47:58 +0000	[thread overview]
Message-ID: <84d3ytsuep.fsf@linux-b2a3.site> (raw)
In-Reply-To: 9AD8954E-F77B-45E0-84FB-3000DF3C4B4C@gmail.com

Carsten Dominik <carsten.dominik@gmail.com> writes:

> this looks like an OK patch and I don't have any problems applying it.
> However, I do not quite understand the need for it.  Can you please
> try to explain a bit better?  Do you have two processes running over
> the same file at the same time, or why is there a conflict?

My dblock-write function calls url-retrieve, to asynchronously retrieve an
HTML page.  The callback function I pass to url-retrieve will then fill
in the information I need into the dynamic block.

So in the following case:

* Find start of dblock 1, store as pos
* Make HTTP request for dblock 1
* Go back to pos
* Find end of dblock 1
* Find start of dblock 2, store as pos
* Make HTTP request for dblock 2
* Asynchronous event: HTTP response for dblock 1 arrives, insert lots of
  data in dblock 1
* Go back to pos
* Find end of dblock 2

the last step will actually find the end of dblock 1, if the amount of
data inserted in dblock 1 is great enough that pos suddenly points
inside it.  (Then it will of course find dblock 2 again, request its HTML
page again, and thus insert the data twice.)

An equivalent fix would be to make pos a marker instead.

-- 
Magnus Henoch

  reply	other threads:[~2010-03-24 13:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-23 17:37 [PATCH] Use save-excursion in org-map-dblocks Magnus Henoch
2010-03-24 11:16 ` Carsten Dominik
2010-03-24 13:47   ` Magnus Henoch [this message]
2010-03-24 21:27     ` Carsten Dominik
2010-03-24 22:03       ` Magnus Henoch

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=84d3ytsuep.fsf@linux-b2a3.site \
    --to=magnus.henoch@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).