emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <eric.schulte@gmx.com>
To: Nicolas Goaziou <n.goaziou@gmail.com>
Cc: Rick Frankel <rick@rickster.com>, emacs-orgmode@gnu.org
Subject: Re: [BUG] Inconsistency in src block hiding
Date: Thu, 19 Jan 2012 07:41:26 -0700	[thread overview]
Message-ID: <87ehuv4la3.fsf@gmx.com> (raw)
In-Reply-To: 8739bc3ob5.fsf@gmail.com

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> Eric Schulte <eric.schulte@gmx.com> 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.
>

Thanks for taking the time to collect these changes into a patch,
however I believe the changes you describe present /new/ behavior (e.g.,
new export semantics for drawers), rather than a bug repair.  For the
time being I am going to bring back results folding until an acceptable
alternative can be agreed upon and implemented.

Best,

>
>
> Regards,
>
> -- 
> Nicolas Goaziou
> From 0c15bf694f8051eb58fd131868059460f28f2e0d Mon Sep 17 00:00:00 2001
> From: Nicolas Goaziou <n.goaziou@gmail.com>
> 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.

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

  parent reply	other threads:[~2012-01-19 18:14 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-20 10:00 [BUG] Inconsistency in src block hiding Nicolas Goaziou
2011-11-20 15:53 ` Eric Schulte
2011-11-20 19:33   ` Nicolas Goaziou
2011-11-21 18:24     ` Eric Schulte
2011-11-22 16:15       ` Eric Schulte
2011-11-22 18:19       ` Nicolas Goaziou
2011-11-22 23:23         ` Eric Schulte
2011-11-23 15:25           ` Nicolas Goaziou
2011-11-28  8:09             ` Eric Schulte
2011-12-11 13:53               ` Bastien
2011-12-11 14:08                 ` Nicolas Goaziou
2011-12-11 16:25                   ` Eric Schulte
2011-12-11 16:04                 ` Eric Schulte
2011-12-11 17:04                   ` Bastien
2012-01-17  2:26                   ` Bernt Hansen
2012-01-17 17:49                     ` Nicolas Goaziou
2012-01-17 17:59                       ` Bernt Hansen
2012-01-18 10:45                         ` Leo Alekseyev
2012-01-18 16:02                           ` Rick Frankel
2012-01-18 16:19                             ` Eric Schulte
2012-01-18 17:36                               ` Nicolas Goaziou
2012-01-19 12:10                                 ` Martyn Jago
2012-01-19 14:48                                   ` Eric Schulte
2012-01-19 15:22                                   ` Rick Frankel
2012-01-19 19:18                                   ` Nicolas Goaziou
2012-01-19 14:41                                 ` Eric Schulte [this message]
2012-01-19 19:26                                   ` Nicolas Goaziou
2012-01-24  3:41                                     ` Eric Schulte
2012-01-24  4:23                                       ` Leo Alekseyev
2012-01-24  4:44                                         ` Jambunathan K
2012-01-24  7:59                                       ` Andreas Leha
2012-01-24 20:39                                       ` Nicolas Goaziou
2012-01-28 16:08                                       ` Nicolas Goaziou
2012-01-25  0:00                         ` Nick Dokos
2012-01-25  2:23                           ` Bernt Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ehuv4la3.fsf@gmx.com \
    --to=eric.schulte@gmx.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@gmail.com \
    --cc=rick@rickster.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).