emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Norman Walsh <ndw@nwalsh.com>
To: emacs-orgmode@gnu.org
Subject: Error in org-element-parse-buffer?
Date: Tue, 19 Feb 2019 08:10:27 -0600	[thread overview]
Message-ID: <m2r2c398do.fsf@nwalsh.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1418 bytes --]

Hi,

I’ve just noticed that org-element-parse-buffer loses whitespace
sometimes.

Consider this org-mode file:

    This is a *bold* word.

What org-element-parse-buffer returns is:

    (org-data nil (section (:begin 1 :end 24 :contents-begin 1 :contents-end 24
    :post-blank 0 :post-affiliated 1 :parent #0) (paragraph (:begin 1 :end 24
    :contents-begin 1 :contents-end 24 :post-blank 0 :post-affiliated 1 :parent #1)
    #("This is a " 0 10 (:parent #2))
    (bold (:begin 11 :end 18 :contents-begin 12 :contents-end 16
       :post-blank 1 :parent #2) #("bold" 0 4 (:parent #3)))
    #("word." 0 6 (:parent #2)))))

Note that the whitespace between “bold” and “word.” has been lost.
Well, possibly it’s recoverable from the various begin/end positions,
I can’t quite decide although (1) it doesn’t seem obviously to be the
case and (2) it’d be *way* more convenient if the space was in the
data structure as text. I guess it’d have to be either a single space
between them, or at the beginning of “ word.”.

Or do I misunderstand something about the data structure?

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | The cure for boredom is curiousity.
http://nwalsh.com/            | There is no cure for curiosity.--Ellen
                              | Parr

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

             reply	other threads:[~2019-02-19 14:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19 14:10 Norman Walsh [this message]
2019-02-19 15:43 ` Error in org-element-parse-buffer? 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=m2r2c398do.fsf@nwalsh.com \
    --to=ndw@nwalsh.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).