From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [BUG] Inconsistency in src block hiding Date: Wed, 18 Jan 2012 18:36:46 +0100 Message-ID: <8739bc3ob5.fsf@gmail.com> References: <8739djqfkv.fsf@gmail.com> <87fwhiwwr0.fsf@gmail.com> <87bos6pp1a.fsf@gmail.com> <8739dhnxjs.fsf@gmail.com> <87ipmcxboo.fsf@gmail.com> <87pqgjipu8.fsf@gmail.com> <87y5v6x3lv.fsf@gmail.com> <87fwh86533.fsf@gmail.com> <87ehwbdxk2.fsf@gnu.org> <874nx782wi.fsf@gmx.com> <87lip76p48.fsf@norang.ca> <87d3ai2p98.fsf@gmail.com> <8762ga6whl.fsf@norang.ca> <87pqehrnjv.fsf@gmx.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:37252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnZTO-0005hX-2t for emacs-orgmode@gnu.org; Wed, 18 Jan 2012 12:39:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RnZTH-0008NK-KD for emacs-orgmode@gnu.org; Wed, 18 Jan 2012 12:38:58 -0500 Received: from mail-wi0-f169.google.com ([209.85.212.169]:63450) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnZTH-0008N2-6u for emacs-orgmode@gnu.org; Wed, 18 Jan 2012 12:38:51 -0500 Received: by wicr5 with SMTP id r5so5245713wic.0 for ; Wed, 18 Jan 2012 09:38:50 -0800 (PST) In-Reply-To: <87pqehrnjv.fsf@gmx.com> (Eric Schulte's message of "Wed, 18 Jan 2012 09:19:16 -0700") 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: Eric Schulte Cc: Rick Frankel , emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hello, Eric Schulte writes: > Well maybe we should roll back this change. Please don't. _That_ would be a regression. > I'll wait to see if Nicolas has a solution which is both functional and > conforms to the Org-mode wide syntax norms. The problem comes from the current exporter, which isn't neutral about drawers, by default. I think that a temporary fix should be to: 1. Change default drawer formatting function to the following (neutral): #+begin_src emacs-lisp (defun org-export-format-drawer (name contents) "Export contents of a drawer as-is. Property drawers are ignored." (if (string= "PROPERTIES" name) "" contents)) #+end_src 2. Handle drawers earlier in org-export-preprocess-string function, i.e. just before footnote handling, so its contents can benefit from further modifications. 3. Allow drawers in export by default (excepted PROPERTIES drawers). That is change `org-export-with-drawers' default value to t. I'm packaging this in the following quick patch, highly untested. Regards, -- Nicolas Goaziou --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-exp-Set-neutral-behaviour-towards-drawers.patch Content-Description: patch for drawers >From 0c15bf694f8051eb58fd131868059460f28f2e0d Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 18 Jan 2012 18:34:11 +0100 Subject: [PATCH] org-exp: Set neutral behaviour towards drawers * lisp/org-exp.el (org-export-with-drawers): Change default value so all drawers are exportable as a default. (org-export-preprocess-string): Handle drawers earlier in the preprocess, so their contents can be modified further. (org-export-format-drawer): Change default behaviour contents of drawers are exported as Org code. As a special case, property drawers are still ignored. --- lisp/org-exp.el | 26 ++++++++------------------ 1 files changed, 8 insertions(+), 18 deletions(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index c7e1a94..d9b0a3e 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -406,7 +406,7 @@ This option can also be set with the +OPTIONS line, e.g. \"tags:nil\"." (const :tag "Not in TOC" not-in-toc) (const :tag "On" t))) -(defcustom org-export-with-drawers nil +(defcustom org-export-with-drawers t "Non-nil means export with drawers like the property drawer. When t, all drawers are exported. This may also be a list of drawer names to export." @@ -1156,6 +1156,10 @@ on this string to produce the exported version." ;; Get rid of tasks, depending on configuration (org-export-remove-tasks (plist-get parameters :tasks)) + ;; Get rid of drawers + (org-export-remove-or-extract-drawers + drawers (plist-get parameters :drawers)) + ;; Prepare footnotes for export. During that process, footnotes ;; actually included in the exported part of the buffer go ;; though some transformations: @@ -1209,10 +1213,6 @@ on this string to produce the exported version." ;; Find HTML special classes for headlines (org-export-remember-html-container-classes) - ;; Get rid of drawers - (org-export-remove-or-extract-drawers - drawers (plist-get parameters :drawers)) - ;; Get the correct stuff before the first headline (when (plist-get parameters :skip-before-1st-heading) (goto-char (point-min)) @@ -1500,19 +1500,9 @@ EXP-DRAWERS will be removed." name content)) (insert content))))))) -(defun org-export-format-drawer (name content) - "Format the content of a drawer as a colon example." - (if (string-match "[ \t]+\\'" content) - (setq content (substring content (match-beginning 0)))) - (while (string-match "\\`[ \t]*\n" content) - (setq content (substring content (match-end 0)))) - (setq content (org-remove-indentation content)) - (setq content (concat ": " (mapconcat 'identity - (org-split-string content "\n") - "\n: ") - "\n")) - (setq content (concat " : " (upcase name) "\n" content)) - (org-add-props content nil 'org-protected t)) +(defun org-export-format-drawer (name contents) + "Export contents of a drawer as-is." + (if (string= "PROPERTIES" name) "" contents)) (defun org-export-handle-export-tags (select-tags exclude-tags) "Modify the buffer, honoring SELECT-TAGS and EXCLUDE-TAGS. -- 1.7.8.3 --=-=-=--