Re: [O] org structuresin a drawer? (or some other presentation soution)

2013-09-12 Thread Nicolas Goaziou
Hello,

Matt Price mopto...@gmail.com writes:

 One way to do this is to make a drawer.  Unfortunately, from what I
 can tell, within a drawer it is not posible to use org structures like
 lists.

Drawers can contain any structure but drawers and headlines.


Regards,

-- 
Nicolas Goaziou



Re: [O] org structuresin a drawer? (or some other presentation soution)

2013-09-12 Thread Thorsten Jolitz
Matt Price mopto...@gmail.com writes:

 or- mark certain elements (like a list or subheading) as not-for-export?

Maybe using the :noexport: tag on a heading?

-- 
cheers,
Thorsten




Re: [O] org structuresin a drawer? (or some other presentation soution)

2013-09-12 Thread Matt Price
On Thu, Sep 12, 2013 at 1:26 PM, Nicolas Goaziou n.goaz...@gmail.com wrote:
 Hello,

 Matt Price mopto...@gmail.com writes:

 One way to do this is to make a drawer.  Unfortunately, from what I
 can tell, within a drawer it is not posible to use org structures like
 lists.

 Drawers can contain any structure but drawers and headlines.

inside a drawer, when I try to make a lit, org-meta-return doesn't
seem to create a new ist item, but instead just indents the next line
without also inserting a - .  Is this a bug? THanks,

Matt



Re: [O] org structuresin a drawer? (or some other presentation soution)

2013-09-12 Thread Nicolas Goaziou
Hello,

Carsten Dominik carsten.domi...@gmail.com writes:

 Well, it is to avoid that a new headline would be made inside a drawer,
 because it would violate Org syntax.  But of course, it would be OK to
 insert an item.  What would be a good solution?  Maybe we better catch
 this problem in org-insert-heading?  Or maybe not at all?  We also do
 not catch it in src block, for example.  So I am fine with removing
 this condition in org-meta-return.

I suggest to be very permissive and allow a user to shoot himself in the
foot.  The following function implements the same behaviour as before,
without the drawer check, but with Elements.

  (defun org-meta-return (optional arg)
Insert a new heading or wrap a region in a table.
  Calls `org-insert-heading' or `org-table-wrap-region', depending
  on context. See the individual commands for more information.
(interactive P)
(org-check-before-invisible-edit 'insert)
(or (run-hook-with-args-until-success 'org-metareturn-hook)
(let* ((element (org-element-at-point))
   (type (org-element-type element)))
  (when (eq type 'table-row)
(setq element (org-element-property :parent element)))
  (if (and (eq type 'table)
   (eq (org-element-property :type element) 'org)
   (= (point) (org-element-property :contents-begin element))
   ( (point) (org-element-property :contents-end element)))
  (call-interactively 'org-table-wrap-region)
(call-interactively 'org-insert-heading)



Regards,

-- 
Nicolas Goaziou



Re: [O] org structuresin a drawer? (or some other presentation soution)

2013-09-12 Thread Nicolas Goaziou
Correcting myself,

Nicolas Goaziou n.goaz...@gmail.com writes:

   (defun org-meta-return (optional arg)
 Insert a new heading or wrap a region in a table.
   Calls `org-insert-heading' or `org-table-wrap-region', depending
   on context. See the individual commands for more information.
 (interactive P)
 (org-check-before-invisible-edit 'insert)
 (or (run-hook-with-args-until-success 'org-metareturn-hook)
 (let* ((element (org-element-at-point))
(type (org-element-type element)))
   (when (eq type 'table-row)
 (setq element (org-element-property :parent element)))

Oops. I forgot a (setq type 'table) within the `when'.

   (if (and (eq type 'table)
(eq (org-element-property :type element) 'org)
(= (point) (org-element-property :contents-begin element))
( (point) (org-element-property :contents-end element)))
   (call-interactively 'org-table-wrap-region)
 (call-interactively 'org-insert-heading)



Re: [O] org structuresin a drawer? (or some other presentation soution)

2013-09-12 Thread Nicolas Goaziou
Matt Price mopto...@gmail.com writes:

 inside a drawer, when I try to make a lit, org-meta-return doesn't
 seem to create a new ist item, but instead just indents the next line
 without also inserting a - .  Is this a bug? THanks,

I think it is a bug, indeed.

There's this condition in `org-meta-return', but I'm not sure why it is
here. Probably historical reasons.

  (cond
   ...
   ((or (org-at-drawer-p) (org-in-drawer-p) (org-at-property-p))
(newline-and-indent))
   ...)


Regards,

-- 
Nicolas Goaziou



Re: [O] org structuresin a drawer? (or some other presentation soution)

2013-09-12 Thread Carsten Dominik
Hi Nicolas, this looks good to me, please apply it.

Thanks

- Carsten

On 12.9.2013, at 21:41, Nicolas Goaziou n.goaz...@gmail.com wrote:

 Hello,
 
 Carsten Dominik carsten.domi...@gmail.com writes:
 
 Well, it is to avoid that a new headline would be made inside a drawer,
 because it would violate Org syntax.  But of course, it would be OK to
 insert an item.  What would be a good solution?  Maybe we better catch
 this problem in org-insert-heading?  Or maybe not at all?  We also do
 not catch it in src block, for example.  So I am fine with removing
 this condition in org-meta-return.
 
 I suggest to be very permissive and allow a user to shoot himself in the
 foot.  The following function implements the same behaviour as before,
 without the drawer check, but with Elements.
 
  (defun org-meta-return (optional arg)
Insert a new heading or wrap a region in a table.
  Calls `org-insert-heading' or `org-table-wrap-region', depending
  on context. See the individual commands for more information.
(interactive P)
(org-check-before-invisible-edit 'insert)
(or (run-hook-with-args-until-success 'org-metareturn-hook)
(let* ((element (org-element-at-point))
   (type (org-element-type element)))
  (when (eq type 'table-row)
(setq element (org-element-property :parent element)))
  (if (and (eq type 'table)
   (eq (org-element-property :type element) 'org)
   (= (point) (org-element-property :contents-begin element))
   ( (point) (org-element-property :contents-end element)))
  (call-interactively 'org-table-wrap-region)
(call-interactively 'org-insert-heading)
 
 
 
 Regards,
 
 -- 
 Nicolas Goaziou



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [O] org structuresin a drawer? (or some other presentation soution)

2013-09-12 Thread Matt Price
On Thu, Sep 12, 2013 at 1:16 PM, Thorsten Jolitz tjol...@gmail.com wrote:
 Matt Price mopto...@gmail.com writes:

 or- mark certain elements (like a list or subheading) as not-for-export?

 Maybe using the :noexport: tag on a heading?

yes, that works!  thank you! sorry I missed it in the manual.
Matt


 --
 cheers,
 Thorsten





Re: [O] org structuresin a drawer? (or some other presentation soution)

2013-09-12 Thread Michael Brand
Hi Carsten

On Thu, Sep 12, 2013 at 9:13 PM, Carsten Dominik
carsten.domi...@gmail.com wrote:
 Well, it is to avoid that a new headline would be made inside a drawer,
 because it would violate Org syntax.  But of course, it would be OK to
 insert an item.  What would be a good solution?  Maybe we better catch
 this problem in org-insert-heading?  Or maybe not at all?  We also do
 not catch it in src block, for example.  So I am fine with removing
 this condition in org-meta-return.

What is the plan with my patches here?:
http://thread.gmane.org/gmane.emacs.orgmode/75367/focus=76221

Michael



Re: [O] org structuresin a drawer? (or some other presentation soution)

2013-09-12 Thread Nicolas Goaziou
Carsten Dominik carsten.domi...@gmail.com writes:

 Hi Nicolas, this looks good to me, please apply it.

Done (in master).


Regards,

-- 
Nicolas Goaziou



Re: [O] org structuresin a drawer? (or some other presentation soution)

2013-09-12 Thread Carsten Dominik

On 12.9.2013, at 19:49, Nicolas Goaziou n.goaz...@gmail.com wrote:

 Matt Price mopto...@gmail.com writes:
 
 inside a drawer, when I try to make a lit, org-meta-return doesn't
 seem to create a new ist item, but instead just indents the next line
 without also inserting a - .  Is this a bug? THanks,
 
 I think it is a bug, indeed.
 
 There's this condition in `org-meta-return', but I'm not sure why it is
 here. Probably historical reasons.

Well, it is to avoid that a new headline would be made inside a drawer,
because it would violate Org syntax.  But of course, it would be OK to
insert an item.  What would be a good solution?  Maybe we better catch
this problem in org-insert-heading?  Or maybe not at all?  We also do
not catch it in src block, for example.  So I am fine with removing
this condition in org-meta-return.

- Carsten

 
  (cond
   ...
   ((or (org-at-drawer-p) (org-in-drawer-p) (org-at-property-p))
(newline-and-indent))
   ...)
 
 
 Regards,
 
 -- 
 Nicolas Goaziou
 



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [O] org structuresin a drawer? (or some other presentation soution)

2013-09-12 Thread Michael Brand
Hi Nicolas

On Thu, Sep 12, 2013 at 10:35 PM, Nicolas Goaziou n.goaz...@gmail.com wrote:
 Done (in master).

Thank you for this improvement. AFAIU org-in-drawer-p was introduced
only for org-meta-return and can now be removed.

Michael



Re: [O] org structuresin a drawer? (or some other presentation soution)

2013-09-12 Thread Carsten Dominik

On 12.9.2013, at 22:35, Nicolas Goaziou n.goaz...@gmail.com wrote:

 Carsten Dominik carsten.domi...@gmail.com writes:
 
 Hi Nicolas, this looks good to me, please apply it.
 
 Done (in master).

Thank you!

- Carsten

 
 
 Regards,
 
 -- 
 Nicolas Goaziou



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [O] org structuresin a drawer? (or some other presentation soution)

2013-09-12 Thread Nicolas Goaziou
Hello,

Michael Brand michael.ch.br...@gmail.com writes:

 What is the plan with my patches here?:
 http://thread.gmane.org/gmane.emacs.orgmode/75367/focus=76221

I think the approach taken is wrong. But we should definitely keep the
tests.


Regards,

-- 
Nicolas Goaziou



Re: [O] org structuresin a drawer? (or some other presentation soution)

2013-09-12 Thread Carsten Dominik

On 12.9.2013, at 21:18, Michael Brand michael.ch.br...@gmail.com wrote:

 Hi Carsten
 
 On Thu, Sep 12, 2013 at 9:13 PM, Carsten Dominik
 carsten.domi...@gmail.com wrote:
 Well, it is to avoid that a new headline would be made inside a drawer,
 because it would violate Org syntax.  But of course, it would be OK to
 insert an item.  What would be a good solution?  Maybe we better catch
 this problem in org-insert-heading?  Or maybe not at all?  We also do
 not catch it in src block, for example.  So I am fine with removing
 this condition in org-meta-return.
 
 What is the plan with my patches here?:
 http://thread.gmane.org/gmane.emacs.orgmode/75367/focus=76221

Thank you for the reminder.  I will take a look - these are in my
action queue, but I had not gotten to them yet.

- Carsten


 
 Michael



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [O] org structuresin a drawer? (or some other presentation soution)

2013-09-12 Thread Matt Price
Thanks Nicolas!  Works great.
Matt

On Thu, Sep 12, 2013 at 4:35 PM, Nicolas Goaziou n.goaz...@gmail.com wrote:
 Carsten Dominik carsten.domi...@gmail.com writes:

 Hi Nicolas, this looks good to me, please apply it.

 Done (in master).


 Regards,

 --
 Nicolas Goaziou