emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Exzessive newlines in org-element item interpreter?
@ 2014-10-18 20:57 Thorsten Jolitz
  2014-10-19  6:45 ` Nicolas Goaziou
  0 siblings, 1 reply; 13+ messages in thread
From: Thorsten Jolitz @ 2014-10-18 20:57 UTC (permalink / raw)
  To: emacs-orgmode


Hi List, 

evaluating this
 
#+BEGIN_SRC emacs-lisp
(org-element-interpret-data
 '(item (:bullet "1" :tag "hello" :checkbox "trans" :counter 2)
 (section nil "world")))
#+END_SRC

#+results:
: 1. [@2] hello :: 
:    world

the content is always placed on a newline, which looks strange in my
eyes. Is that intended?

PS
and checkbox is ignored, no matter if I give 'on, 'off and 'trans as
symbols or strings.

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Exzessive newlines in org-element item interpreter?
  2014-10-18 20:57 Exzessive newlines in org-element item interpreter? Thorsten Jolitz
@ 2014-10-19  6:45 ` Nicolas Goaziou
  2014-10-19  7:21   ` Thorsten Jolitz
  0 siblings, 1 reply; 13+ messages in thread
From: Nicolas Goaziou @ 2014-10-19  6:45 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

Hello,

Thorsten Jolitz <tjolitz@gmail.com> writes:

> Hi List,
>
> evaluating this
>  
> #+BEGIN_SRC emacs-lisp
> (org-element-interpret-data
>  '(item (:bullet "1" :tag "hello" :checkbox "trans" :counter 2)
>  (section nil "world")))
> #+END_SRC
>
> #+results:
> : 1. [@2] hello :: 
> :    world
>
> the content is always placed on a newline, which looks strange in my
> eyes. Is that intended?

It is. You include a `section' in an `item', which is syntactically
wrong. Only headlines can contain sections.

> PS
> and checkbox is ignored, no matter if I give 'on, 'off and 'trans as
> symbols or strings.

You should not provide 'on, 'off or 'trans, and even less strings, but
on, off or trans since your expression is already quoted.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Exzessive newlines in org-element item interpreter?
  2014-10-19  6:45 ` Nicolas Goaziou
@ 2014-10-19  7:21   ` Thorsten Jolitz
  2014-10-19  8:04     ` Thorsten Jolitz
  2014-10-19 10:06     ` Nicolas Goaziou
  0 siblings, 2 replies; 13+ messages in thread
From: Thorsten Jolitz @ 2014-10-19  7:21 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> Hi List,
>>
>> evaluating this
>>  
>> #+BEGIN_SRC emacs-lisp
>> (org-element-interpret-data
>>  '(item (:bullet "1" :tag "hello" :checkbox "trans" :counter 2)
>>  (section nil "world")))
>> #+END_SRC
>>
>> #+results:
>> : 1. [@2] hello :: 
>> :    world
>>
>> the content is always placed on a newline, which looks strange in my
>> eyes. Is that intended?
>
> It is. You include a `section' in an `item', which is syntactically
> wrong. Only headlines can contain sections.

I see.  

So when creating an element with interpreted content (that is given as
plain string), I use

  - headlines :: (section nil "foo")  

  - others :: (paragraph nil "foo")


or should it rather be

  - headlines :: (section nil (paragraph nil "foo"))

?  

>> PS
>> and checkbox is ignored, no matter if I give 'on, 'off and 'trans as
>> symbols or strings.
>
> You should not provide 'on, 'off or 'trans, and even less strings, but
> on, off or trans since your expression is already quoted.

ups ... of course.

One more question:

the :tag property of items is parsed as list (of sec. string(s)) - is it
sufficient for interpreting to give it a plain string: tag: "foo"
instead of tag: ("foo")? It seems to work ...

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Exzessive newlines in org-element item interpreter?
  2014-10-19  7:21   ` Thorsten Jolitz
@ 2014-10-19  8:04     ` Thorsten Jolitz
  2014-10-19 10:01       ` Nicolas Goaziou
  2014-10-19 10:06     ` Nicolas Goaziou
  1 sibling, 1 reply; 13+ messages in thread
From: Thorsten Jolitz @ 2014-10-19  8:04 UTC (permalink / raw)
  To: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> writes:

> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
[...]
>> You should not provide 'on, 'off or 'trans, and even less strings, but
>> on, off or trans since your expression is already quoted.

One more question: bullet strings are parsed 'as-is', but the
interpreter seems to have its own logic that is a bit difficult to grok
(or are there syntax errors too?):

#+BEGIN_SRC emacs-lisp
(org-element-interpret-data
  '(item (:bullet "-" :tag "hello " :checkbox trans :counter 2)
   (paragraph  nil "world")))
#+END_SRC

#+results:
: - [@2] [-] hello  :: world

#+BEGIN_SRC emacs-lisp
(org-element-interpret-data
  '(item (:bullet "+" :tag "hello " :checkbox trans :counter 2)
   (paragraph  nil "world")))
#+END_SRC

#+results:
: - [@2] [-] hello  :: world

#+BEGIN_SRC emacs-lisp
  (setq org-list-allow-alphabetical t)
  (when (featurep 'org-element) (load "org-element" t t))
  (org-element-interpret-data
   '(item (:bullet "a" :tag "hello " :checkbox trans :counter 2)
          (paragraph  nil "world")))
#+END_SRC

#+results:
: 1. [@2] [-] hello  :: world

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Exzessive newlines in org-element item interpreter?
  2014-10-19  8:04     ` Thorsten Jolitz
@ 2014-10-19 10:01       ` Nicolas Goaziou
  2014-10-19 12:40         ` Thorsten Jolitz
  0 siblings, 1 reply; 13+ messages in thread
From: Nicolas Goaziou @ 2014-10-19 10:01 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

Hello,

Thorsten Jolitz <tjolitz@gmail.com> writes:

> One more question: bullet strings are parsed 'as-is', but the
> interpreter seems to have its own logic that is a bit difficult to grok
> (or are there syntax errors too?):

This is simple: ordered lists bullets are always "X.", where X is
a number and unordered lists are always "-".


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Exzessive newlines in org-element item interpreter?
  2014-10-19  7:21   ` Thorsten Jolitz
  2014-10-19  8:04     ` Thorsten Jolitz
@ 2014-10-19 10:06     ` Nicolas Goaziou
  1 sibling, 0 replies; 13+ messages in thread
From: Nicolas Goaziou @ 2014-10-19 10:06 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> writes:

> So when creating an element with interpreted content (that is given as
> plain string), I use
>
>   - headlines :: (section nil "foo")  
>
>   - others :: (paragraph nil "foo")

If contents are already interpreted, 

  - anything :: "foo"

is sufficient, I think. However, when "anything" is either item or
footnote-definition, and contents start with a paragraph,

  - anything :: (paragraph nil "foo") 

is better due to special handling of the first line.

> One more question:
>
> the :tag property of items is parsed as list (of sec. string(s)) - is it
> sufficient for interpreting to give it a plain string: tag: "foo"
> instead of tag: ("foo")? It seems to work ...

("foo") is equivalent to "foo". ("foo") allows to insert objects, e.g.

  ("foo " (bold nil "bar"))


Regards,

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Exzessive newlines in org-element item interpreter?
  2014-10-19 10:01       ` Nicolas Goaziou
@ 2014-10-19 12:40         ` Thorsten Jolitz
  2014-10-19 17:10           ` Nicolas Goaziou
  0 siblings, 1 reply; 13+ messages in thread
From: Thorsten Jolitz @ 2014-10-19 12:40 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

Hello,

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> One more question: bullet strings are parsed 'as-is', but the
>> interpreter seems to have its own logic that is a bit difficult to grok
>> (or are there syntax errors too?):
>
> This is simple: ordered lists bullets are always "X.", where X is
> a number and unordered lists are always "-".

Thx for you answers (to my other post too). 

Just to get it straight:

The conclusion of your answer above is that the item-interpreter cannot
produce the complete org-mode syntax for plain-lists that is recognized
by the parser and described in the manual?

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Exzessive newlines in org-element item interpreter?
  2014-10-19 12:40         ` Thorsten Jolitz
@ 2014-10-19 17:10           ` Nicolas Goaziou
  2014-10-19 17:39             ` Thorsten Jolitz
  0 siblings, 1 reply; 13+ messages in thread
From: Nicolas Goaziou @ 2014-10-19 17:10 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> writes:

> The conclusion of your answer above is that the item-interpreter cannot
> produce the complete org-mode syntax for plain-lists that is recognized
> by the parser and described in the manual?

This question is too tricky (and closed) for me to answer.


Regards,

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Exzessive newlines in org-element item interpreter?
  2014-10-19 17:10           ` Nicolas Goaziou
@ 2014-10-19 17:39             ` Thorsten Jolitz
  2014-10-20  7:55               ` Nicolas Goaziou
  0 siblings, 1 reply; 13+ messages in thread
From: Thorsten Jolitz @ 2014-10-19 17:39 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> The conclusion of your answer above is that the item-interpreter cannot
>> produce the complete org-mode syntax for plain-lists that is recognized
>> by the parser and described in the manual?

> This question is too tricky (and closed) for me to answer.

,----[ C-h f yes-or-no-p RET ]
| yes-or-no-p is an alias for `y-or-n-p'.
| 
| (yes-or-no-p PROMPT)
| 
| Ask user a "y or n" question.
`----

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Exzessive newlines in org-element item interpreter?
  2014-10-19 17:39             ` Thorsten Jolitz
@ 2014-10-20  7:55               ` Nicolas Goaziou
  2014-10-20  8:30                 ` Thorsten Jolitz
  0 siblings, 1 reply; 13+ messages in thread
From: Nicolas Goaziou @ 2014-10-20  7:55 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

Hello,

Thorsten Jolitz <tjolitz@gmail.com> writes:

> ,----[ C-h f yes-or-no-p RET ]
> | yes-or-no-p is an alias for `y-or-n-p'.
> | 
> | (yes-or-no-p PROMPT)
> | 
> | Ask user a "y or n" question.
> `----

=> nil

The interpreter produces _normalized_ syntax. It ignores indentation,
capitalization on keywords and, obviously, specific bullets (which might
not be allowed in the target environment). This is a feature.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Exzessive newlines in org-element item interpreter?
  2014-10-20  7:55               ` Nicolas Goaziou
@ 2014-10-20  8:30                 ` Thorsten Jolitz
  2014-10-20 12:31                   ` Nick Dokos
  0 siblings, 1 reply; 13+ messages in thread
From: Thorsten Jolitz @ 2014-10-20  8:30 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> ,----[ C-h f yes-or-no-p RET ]
>> | yes-or-no-p is an alias for `y-or-n-p'.
>> | 
>> | (yes-or-no-p PROMPT)
>> | 
>> | Ask user a "y or n" question.
>> `----
>
> => nil
>
> The interpreter produces _normalized_ syntax. It ignores indentation,
> capitalization on keywords and, obviously, specific bullets (which might
> not be allowed in the target environment). This is a feature.

Thanks for the answer.

I did not mean to point fingers, I just wanted to know if it _can_ be
done and I have to investigate further to find out how, or if I can save
me the time and effort.

PS

Your interpretation of 'obvious' seems (obviously?) be a bit overly
optimistic sometimes.

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Exzessive newlines in org-element item interpreter?
  2014-10-20  8:30                 ` Thorsten Jolitz
@ 2014-10-20 12:31                   ` Nick Dokos
  2014-10-20 13:23                     ` Thorsten Jolitz
  0 siblings, 1 reply; 13+ messages in thread
From: Nick Dokos @ 2014-10-20 12:31 UTC (permalink / raw)
  To: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> writes:


> Your interpretation of 'obvious' seems (obviously?) be a bit overly
> optimistic sometimes.

Probably apocryphal but ...

http://mystatpage.wordpress.com/tag/g-h-hardy/

-- 
Nick

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Exzessive newlines in org-element item interpreter?
  2014-10-20 12:31                   ` Nick Dokos
@ 2014-10-20 13:23                     ` Thorsten Jolitz
  0 siblings, 0 replies; 13+ messages in thread
From: Thorsten Jolitz @ 2014-10-20 13:23 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> Your interpretation of 'obvious' seems (obviously?) be a bit overly
>> optimistic sometimes.
>
> Probably apocryphal but ...
>
> http://mystatpage.wordpress.com/tag/g-h-hardy/

Nice.

Whats really obvious is that spelling errors in Mail Subjects become kind of
embarrassing when repeated so often ... 

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-10-20 13:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-18 20:57 Exzessive newlines in org-element item interpreter? Thorsten Jolitz
2014-10-19  6:45 ` Nicolas Goaziou
2014-10-19  7:21   ` Thorsten Jolitz
2014-10-19  8:04     ` Thorsten Jolitz
2014-10-19 10:01       ` Nicolas Goaziou
2014-10-19 12:40         ` Thorsten Jolitz
2014-10-19 17:10           ` Nicolas Goaziou
2014-10-19 17:39             ` Thorsten Jolitz
2014-10-20  7:55               ` Nicolas Goaziou
2014-10-20  8:30                 ` Thorsten Jolitz
2014-10-20 12:31                   ` Nick Dokos
2014-10-20 13:23                     ` Thorsten Jolitz
2014-10-19 10:06     ` Nicolas Goaziou

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).