From mboxrd@z Thu Jan 1 00:00:00 1970 From: tftorrey@tftorrey.com (T.F. Torrey) Subject: [PATCH] Works around bug in exporting subtree with HTML_CONTAINER_CLASS Date: Sat, 01 Sep 2012 03:31:06 -0700 Message-ID: <87sjb2f311.fsf@lapcat.tftorrey.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:46369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7l5c-0007hk-VY for emacs-orgmode@gnu.org; Sat, 01 Sep 2012 06:38:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T7l5b-0001tf-Sn for emacs-orgmode@gnu.org; Sat, 01 Sep 2012 06:38:08 -0400 Received: from slow3-v.mail.gandi.net ([217.70.178.89]:45738) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7l5b-0001tQ-M6 for emacs-orgmode@gnu.org; Sat, 01 Sep 2012 06:38:07 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by slow3-v.mail.gandi.net (Postfix) with ESMTP id 875A4382BB for ; Sat, 1 Sep 2012 12:31:25 +0200 (CEST) Received: from mfilter3-d.gandi.net (mfilter3-d.gandi.net [217.70.178.133]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id E9A5D17207C for ; Sat, 1 Sep 2012 12:31:23 +0200 (CEST) Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by mfilter3-d.gandi.net (mfilter3-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id rJfAxkaWBK4D for ; Sat, 1 Sep 2012 12:31:22 +0200 (CEST) Received: from lapcat.tftorrey.com.tftorrey.com (fat-69-171-172-176.evdo.leapwireless.net [69.171.172.176]) (Authenticated sender: tftorrey@tftorrey.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 72E48172081 for ; Sat, 1 Sep 2012 12:31:21 +0200 (CEST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hello all, When exporting a subtree with an HTML_CONTAINER_CLASS property set, exporting fails with this error: (error "Before first headline at position 455 in buffer *temp*") This happens because the system is trying to apply the class to the parent level, but the exporting of a subtree doesn't bring the parent level into the temp buffer. The attached patch modifies org-export-remember-html-container-classes to ignore the HTML_CONTAINER_CLASS property altogether in these cases. It would probably be better to apply the designated class to the container div or perhaps the body, but this change works for me, and I may be the only one bothered by this. If it is determined that another fix is more in the spirit of these files, I will not be offended. ChangeLog entry: Fix export of subtree with HTML_CONTAINER_CLASS Modify org-export-remember-html-container-classes to work around problem when exporting subtree with HTML_CONTAINER_CLASS property. TINYCHANGE All the best, Terry -- T.F. Torrey --=-=-= Content-Type: text/plain Content-Disposition: inline Content-Description: Patch for org-export-remember-html-container-classes diff --git a/lisp/org-exp.el b/lisp/org-exp.el index c901a88..875bdf8 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1476,8 +1476,11 @@ the current file." "^[ \t]*:HTML_CONTAINER_CLASS:[ \t]+\\(.+\\)$" nil t) (setq class (match-string 1)) (save-excursion + (if (re-search-backward "^\\*" (point-min) t) + (progn (org-back-to-heading t) (put-text-property (point-at-bol) (point-at-eol) 'html-container-class class))))) +)) (defvar org-export-format-drawer-function nil "Function to be called to format the contents of a drawer. --=-=-=--