emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] some nasty bugs with PROPERTIES drawers
@ 2010-08-31  3:13 Paul Sexton
  2010-08-31  7:28 ` Carsten Dominik
  2010-08-31 16:09 ` David Maus
  0 siblings, 2 replies; 6+ messages in thread
From: Paul Sexton @ 2010-08-31  3:13 UTC (permalink / raw)
  To: emacs-orgmode

There seems to be a fairly nasty bug caused by :PROPERTIES: drawers still 
being recognised by org when they appear inside BEGIN_EXAMPLE or 
BEGIN_SRC blocks. I encountered this behaviour while writing docs for 
"org-drill". The doc file, README.org, contains quoted examples of org
"items", and also of an emacs lisp capture template containing the string
":PROPERTIES:".

The first thing I noticed was that PROPERTIES drawers inside EXAMPLE/SRC 
blocks appear *folded* when the file is opened in org mode, and 
'org-cycle' toggles their folded status, as if they belonged to a 
real org heading.

That is cosmetic, but I also encountered a more serious problem. 
README.org contains the following block of example elisp code, which 
is meant to illustrate an example setup of org-capture:

#+BEGIN_SRC emacs-lisp
(setq org-capture-templates
       `(("u"
         "Task: Read this URL"
         entry
         (file+headline "tasks.org" "Articles To Read")
         ,(concat "* TODO Read article: '%:description'\nURL: %c\n\n")
         :empty-lines 1
         :immediate-finish t)

        ("w"
         "Capture web snippet"
         entry
         (file+headline "my-facts.org" "Inbox")
         ,(concat "* Fact: '%:description'        :"
                  (format "%s" org-drill-question-tag)
                  ":\n:PROPERTIES:\n:DATE_ADDED: %u\n:SOURCE_URL:
%c\n:END:\n\n%i\n%?\n")
         :empty-lines 1
         :immediate-finish t)
        ;; ...other capture templates...
    ))
#+END_EXAMPLE

Basically, every time I tried to export this file to HTML, Emacs would 
become unresponsive (C-g did nothing) and would have to be killed with 
the task manager (or xkill in Linux -- I tried on 2 systems).

After about 20 crashes and restarts of Emacs, I finally identified the 
problem (I think). when I changed the above block from BEGIN_SRC to
BEGIN_EXAMPLE, the file exported correctly.

I think org was seeing the ":PROPERTIES" string within the elisp code 
and trying to interpret it as the beginning of a drawer, with disastrous
results.

Once I managed to fix the problem for myself I did not investigate it 
further. However I hope someone can fix it as it certainly caused a 
stressful afternoon.

Paul 

PS: I also realised that I was confused regarding how to get a syntax-
highlighted block of "example source code" into an org document, as 
BEGIN_SRC appears to execute the code by default, which was not what 
I wanted. Should BEGIN_EXAMPLE take an argument which specifies syntax 
highlighting (eg "BEGIN_EXAMPLE emacs-lisp")?

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

* Re: [BUG] some nasty bugs with PROPERTIES drawers
  2010-08-31  3:13 [BUG] some nasty bugs with PROPERTIES drawers Paul Sexton
@ 2010-08-31  7:28 ` Carsten Dominik
  2010-08-31 16:09 ` David Maus
  1 sibling, 0 replies; 6+ messages in thread
From: Carsten Dominik @ 2010-08-31  7:28 UTC (permalink / raw)
  To: Paul Sexton; +Cc: emacs-orgmode


On Aug 31, 2010, at 5:13 AM, Paul Sexton wrote:

> There seems to be a fairly nasty bug caused by :PROPERTIES: drawers  
> still
> being recognised by org when they appear inside BEGIN_EXAMPLE or
> BEGIN_SRC blocks. I encountered this behaviour while writing docs for
> "org-drill". The doc file, README.org, contains quoted examples of org
> "items", and also of an emacs lisp capture template containing the  
> string
> ":PROPERTIES:".
>
> The first thing I noticed was that PROPERTIES drawers inside EXAMPLE/ 
> SRC
> blocks appear *folded* when the file is opened in org mode, and
> 'org-cycle' toggles their folded status, as if they belonged to a
> real org heading.
>
> That is cosmetic, but I also encountered a more serious problem.
> README.org contains the following block of example elisp code, which
> is meant to illustrate an example setup of org-capture:
>
> #+BEGIN_SRC emacs-lisp
> (setq org-capture-templates
>       `(("u"
>         "Task: Read this URL"
>         entry
>         (file+headline "tasks.org" "Articles To Read")
>         ,(concat "* TODO Read article: '%:description'\nURL: %c\n\n")
>         :empty-lines 1
>         :immediate-finish t)
>
>        ("w"
>         "Capture web snippet"
>         entry
>         (file+headline "my-facts.org" "Inbox")
>         ,(concat "* Fact: '%:description'        :"
>                  (format "%s" org-drill-question-tag)
>                  ":\n:PROPERTIES:\n:DATE_ADDED: %u\n:SOURCE_URL:
> %c\n:END:\n\n%i\n%?\n")
>         :empty-lines 1
>         :immediate-finish t)
>        ;; ...other capture templates...
>    ))
> #+END_EXAMPLE
>
> Basically, every time I tried to export this file to HTML, Emacs would
> become unresponsive (C-g did nothing) and would have to be killed with
> the task manager (or xkill in Linux -- I tried on 2 systems).
>
> After about 20 crashes and restarts of Emacs, I finally identified the
> problem (I think). when I changed the above block from BEGIN_SRC to
> BEGIN_EXAMPLE, the file exported correctly.
>
> I think org was seeing the ":PROPERTIES" string within the elisp code
> and trying to interpret it as the beginning of a drawer, with  
> disastrous
> results.
>
> Once I managed to fix the problem for myself I did not investigate it
> further. However I hope someone can fix it as it certainly caused a
> stressful afternoon.
>
> Paul
>
> PS: I also realised that I was confused regarding how to get a syntax-
> highlighted block of "example source code" into an org document, as
> BEGIN_SRC appears to execute the code by default,

What???? I hope that this is not the case.  Maybe you have org-babel
set up in a way that the default action is to evaluate???

> which was not what
> I wanted. Should BEGIN_EXAMPLE take an argument which specifies syntax
> highlighting (eg "BEGIN_EXAMPLE emacs-lisp")?

No, this is what begin_src is for.

one thing you should have done is to end begin_src with end_src, not  
end_example.  That
may be part of the problem.  Can we see your babel setup, please?

- Carsten

>
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

* Re: [BUG] some nasty bugs with PROPERTIES drawers
  2010-08-31  3:13 [BUG] some nasty bugs with PROPERTIES drawers Paul Sexton
  2010-08-31  7:28 ` Carsten Dominik
@ 2010-08-31 16:09 ` David Maus
  2010-08-31 18:49   ` Paul Sexton
  1 sibling, 1 reply; 6+ messages in thread
From: David Maus @ 2010-08-31 16:09 UTC (permalink / raw)
  To: Paul Sexton; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1643 bytes --]

Paul Sexton wrote:
>There seems to be a fairly nasty bug caused by :PROPERTIES: drawers still
>being recognised by org when they appear inside BEGIN_EXAMPLE or
>BEGIN_SRC blocks. I encountered this behaviour while writing docs for
>"org-drill". The doc file, README.org, contains quoted examples of org
>"items", and also of an emacs lisp capture template containing the string
>":PROPERTIES:".

>The first thing I noticed was that PROPERTIES drawers inside EXAMPLE/SRC
>blocks appear *folded* when the file is opened in org mode, and
>'org-cycle' toggles their folded status, as if they belonged to a
>real org heading.

>That is cosmetic, but I also encountered a more serious problem.
>README.org contains the following block of example elisp code, which
>is meant to illustrate an example setup of org-capture:

> [snip]

>Basically, every time I tried to export this file to HTML, Emacs would
>become unresponsive (C-g did nothing) and would have to be killed with
>the task manager (or xkill in Linux -- I tried on 2 systems).

I cannot reproduce this wiht Org-mode version 7.01trans (pulled
yesterday) on GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version
2.20.0) of 2010-08-14 on raven, modified by Debian

>PS: I also realised that I was confused regarding how to get a syntax-
>highlighted block of "example source code" into an org document, as
>BEGIN_SRC appears to execute the code by default, which was not what
>I wanted.

No, at least not for Elisp.  What is your assumption of Org mode
executing source blocks based on?

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: [BUG] some nasty bugs with PROPERTIES drawers
  2010-08-31 16:09 ` David Maus
@ 2010-08-31 18:49   ` Paul Sexton
  2010-08-31 18:55     ` Erik Iverson
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Sexton @ 2010-08-31 18:49 UTC (permalink / raw)
  To: emacs-orgmode

David Maus <dmaus <at> ictsoc.de> writes:
> I cannot reproduce this wiht Org-mode version 7.01trans (pulled
> yesterday) on GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version
> 2.20.0) of 2010-08-14 on raven, modified by Debian

There is a documentation file, README.org, that accompanies org-drill.
It can be downloaded at:
http://bitbucket.org/eeeickythump/org-drill/src/tip/README.org

The quoted emacs lisp example occurs near the end of the file. As is, it
exports to HTML (C-c C-e h) successfully for me, but if I change 
BEGIN_EXAMPLE/END_EXAMPLE to BEGIN_SRC/END_SRC for that block, it 
reproduces the bug.

> >PS: I also realised that I was confused regarding how to get a syntax-
> >highlighted block of "example source code" into an org document, as
> >BEGIN_SRC appears to execute the code by default, which was not what
> >I wanted.
> 
> No, at least not for Elisp.  What is your assumption of Org mode
> executing source blocks based on?
> 

My assumption is based on reading the manual. I couldn't find clearly stated 
anywhere exactly what BEGIN_SRC blocks do by default during export, and there 
are ":eval never" and "eval query" headline option, implying that these are not 
the default behaviours. But perhaps I read it wrong.

Paul

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

* Re: Re: [BUG] some nasty bugs with PROPERTIES drawers
  2010-08-31 18:49   ` Paul Sexton
@ 2010-08-31 18:55     ` Erik Iverson
  2010-08-31 19:05       ` Paul Sexton
  0 siblings, 1 reply; 6+ messages in thread
From: Erik Iverson @ 2010-08-31 18:55 UTC (permalink / raw)
  To: Paul Sexton; +Cc: emacs-orgmode



Paul Sexton wrote:
> David Maus <dmaus <at> ictsoc.de> writes:
>> I cannot reproduce this wiht Org-mode version 7.01trans (pulled
>> yesterday) on GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version
>> 2.20.0) of 2010-08-14 on raven, modified by Debian
> 
> There is a documentation file, README.org, that accompanies org-drill.
> It can be downloaded at:
> http://bitbucket.org/eeeickythump/org-drill/src/tip/README.org
> 
> The quoted emacs lisp example occurs near the end of the file. As is, it
> exports to HTML (C-c C-e h) successfully for me, but if I change 
> BEGIN_EXAMPLE/END_EXAMPLE to BEGIN_SRC/END_SRC for that block, it 
> reproduces the bug.
> 
>>> PS: I also realised that I was confused regarding how to get a syntax-
>>> highlighted block of "example source code" into an org document, as
>>> BEGIN_SRC appears to execute the code by default, which was not what
>>> I wanted.
>> No, at least not for Elisp.  What is your assumption of Org mode
>> executing source blocks based on?
>>
> 
> My assumption is based on reading the manual. I couldn't find clearly stated 
> anywhere exactly what BEGIN_SRC blocks do by default during export, and there 
> are ":eval never" and "eval query" headline option, implying that these are not 
> the default behaviours. But perhaps I read it wrong.

See the :exports argument, the default is code only.

http://orgmode.org/org.html#exports

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

* Re: [BUG] some nasty bugs with PROPERTIES drawers
  2010-08-31 18:55     ` Erik Iverson
@ 2010-08-31 19:05       ` Paul Sexton
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Sexton @ 2010-08-31 19:05 UTC (permalink / raw)
  To: emacs-orgmode

Erik Iverson <eriki <at> ccbr.umn.edu> writes:
> See the :exports argument, the default is code only.
> 
> http://orgmode.org/org.html#exports

That was my initial assumption, which is why I had BEGIN_SRC blocks in the file.
But then I found that it crashed during export with these blocks, and stopped
crashing once I changed them to BEGIN_EXAMPLE, which made me question my initial 
assumption and suspect that the BEGIN_SRC blocks were being evaluated/executed 
somehow.

Paul

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

end of thread, other threads:[~2010-08-31 19:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-31  3:13 [BUG] some nasty bugs with PROPERTIES drawers Paul Sexton
2010-08-31  7:28 ` Carsten Dominik
2010-08-31 16:09 ` David Maus
2010-08-31 18:49   ` Paul Sexton
2010-08-31 18:55     ` Erik Iverson
2010-08-31 19:05       ` Paul Sexton

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