From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Sexton Subject: [BUG] some nasty bugs with PROPERTIES drawers Date: Tue, 31 Aug 2010 03:13:45 +0000 (UTC) Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=59099 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OqHIL-0008Nc-NN for emacs-orgmode@gnu.org; Mon, 30 Aug 2010 23:13:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OqHIK-0006G6-5N for emacs-orgmode@gnu.org; Mon, 30 Aug 2010 23:13:57 -0400 Received: from lo.gmane.org ([80.91.229.12]:42517) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OqHIJ-0006G1-Pc for emacs-orgmode@gnu.org; Mon, 30 Aug 2010 23:13:56 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OqHIH-0005M0-Q0 for emacs-orgmode@gnu.org; Tue, 31 Aug 2010 05:13:53 +0200 Received: from rp.young.med.auckland.ac.nz ([130.216.140.20]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 31 Aug 2010 05:13:53 +0200 Received: from psexton by rp.young.med.auckland.ac.nz with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 31 Aug 2010 05:13:53 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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")?