Re: [Orgmode] Re: How to add comments in a plain list

2009-09-28 Thread Carsten Dominik


On Sep 25, 2009, at 11:10 AM, Eric S Fraga wrote:


At Thu, 24 Sep 2009 10:27:57 +0100, Carsten Dominik wrote:

On Sep 22, 2009, at 7:30 PM, René wrote:

Unfortunately, in this case Emacs doesn't fontify those lines as if
they were comments.


It does now.

- Carsten


Carsten, thanks for this.  It works perfectly.

But this leads to me a more general question for all of you emacs
experts: comments in my org files typically consist of /less
important/ text and so I like to de-emphasise the text by changing the
face used (to a light gray, in my case, compared with the default of
firebrick).  However, for programming, I prefer the default.  Can
somebody suggest how I can have a different font-lock-comment-face for
org-mode files without making a global change?  Should I put something
in the org-mode hook?

Or even on a per-file basis?  I've tried using Emacs local variables
but haven't found the right incantation... :(

Any suggestions more than welcome!


Hi Eric,

I don't know how to change `font-lock-comment-face' on a per-buffer  
level.


What you can do though (I think) is use the function `font-lock-add- 
keywords'

to add your own regular expression for matching comments and specify
an arbitrary font for this match.  For example (untested):

 (font-lock-add-keywords 'org-mode
  '((^[ \t]*#.* 0 my-org-comment-face prepend)))

- Carsten



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: How to add comments in a plain list

2009-09-25 Thread Eric S Fraga
At Thu, 24 Sep 2009 10:27:57 +0100, Carsten Dominik wrote:
 On Sep 22, 2009, at 7:30 PM, René wrote:
  Unfortunately, in this case Emacs doesn't fontify those lines as if
  they were comments.
 
 It does now.
 
 - Carsten

Carsten, thanks for this.  It works perfectly.

But this leads to me a more general question for all of you emacs
experts: comments in my org files typically consist of /less
important/ text and so I like to de-emphasise the text by changing the
face used (to a light gray, in my case, compared with the default of
firebrick).  However, for programming, I prefer the default.  Can
somebody suggest how I can have a different font-lock-comment-face for
org-mode files without making a global change?  Should I put something
in the org-mode hook?

Or even on a per-file basis?  I've tried using Emacs local variables
but haven't found the right incantation... :(

Any suggestions more than welcome!

Thanks,
eric


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: How to add comments in a plain list

2009-09-24 Thread Carsten Dominik


On Sep 22, 2009, at 7:30 PM, René wrote:


Eric S Fraga ucecesf at ucl.ac.uk writes:

At Tue, 22 Sep 2009 10:10:41 -0400, Bernt Hansen wrote:

At column 0 - probably not.

1. first
2. second
   #+ comment about second item
   #+ Another comment goes here
3. third
4. fourth

The #+ comment probably isn't officially supported either... it just
happens to work.  Sorry about the run-around :)


Unfortunately, in this case Emacs doesn't fontify those lines as if  
they were

comments.


It does now.

- Carsten



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: How to add comments in a plain list

2009-09-22 Thread Eric S Fraga
At Tue, 22 Sep 2009 00:16:14 -0400, Bernt Hansen wrote:
 René jl...@yahoo.com writes:
  Is there a way to insert comments in a plain list without breaking it into 
  two
  distinct lists?

I've run into exactly this problem in the past few days, preparing a
document, intended for export to a variety of formats, containing a
number of enumerated lists.

 You can ident the comment like this
 
  1. first
  2. second
 
 # comment about second item
 
  3. third
  4. fourth
 
 -Bernt

I had already tried this but the export breaks.  At least for me,
indented comments come out in ascii, latex and html exports.  Is there
an option that turns off that behaviour?  I haven't seen one...

Thanks,
eric


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: How to add comments in a plain list

2009-09-22 Thread René
Bernt Hansen bernt at norang.ca writes:
 You can ident the comment like this
 
  1. first
  2. second
 
 # comment about second item
 
  3. third
  4. fourth

Unfortunately in this case your comment gets exported since the `#' is indented.

Of course one doesn't want the comments to appear in the html version of the
document. 

Is there a way to easily solve this issue?



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: How to add comments in a plain list

2009-09-22 Thread Carsten Dominik


On Sep 22, 2009, at 12:32 PM, René wrote:


Bernt Hansen bernt at norang.ca writes:

You can ident the comment like this

1. first
2. second

   # comment about second item

3. third
4. fourth


Unfortunately in this case your comment gets exported since the `#'  
is indented.


Of course one doesn't want the comments to appear in the html  
version of the

document.

Is there a way to easily solve this issue?


You can always add a function to one of the org-export-preprocess-...  
hooks.

However, if you are not careful, you might remove something like

   #!/bin/sh

   in a source code block, or some normal text where,
   #25 starts a new line by accident.

It may be relatively safe to look for # followed by space, or
lines that have only # ad the only nonwhite character on a line.

Something like this might work (untested)

(add-hook
 'org-export-preprocess-before-backend-specifics-hook
 (lambda ()
   (goto-char (point-min))
   (while (re-search-forward ^[ \t]+#\\([ \t]*$\\| .*$\\)\n? nil t)
 (org-if-unprotected-at (match-beginning 1)
  (replace-match )


HTH

- Carsten

___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: How to add comments in a plain list

2009-09-22 Thread Bernt Hansen
Eric S Fraga ucec...@ucl.ac.uk writes:

 At Tue, 22 Sep 2009 00:16:14 -0400, Bernt Hansen wrote:
 René jl...@yahoo.com writes:
  Is there a way to insert comments in a plain list without breaking it into 
  two
  distinct lists?

 I've run into exactly this problem in the past few days, preparing a
 document, intended for export to a variety of formats, containing a
 number of enumerated lists.

 You can ident the comment like this
 
  1. first
  2. second
 
 # comment about second item
 
  3. third
  4. fourth
 
 -Bernt

 I had already tried this but the export breaks.  At least for me,
 indented comments come out in ascii, latex and html exports.  Is there
 an option that turns off that behaviour?  I haven't seen one...

If you're actually trying to make the comment not export this seems to
work for me

 1. first
 2. second
 #+ comment about second item
 3. third
 4. fourth

-Bernt


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: How to add comments in a plain list

2009-09-22 Thread Eric S Fraga
At Tue, 22 Sep 2009 08:52:13 -0400, Bernt Hansen wrote:
 If you're actually trying to make the comment not export this seems to
 work for me
 
  1. first
  2. second
  #+ comment about second item
  3. third
  4. fourth
 
 -Bernt

and in fact it works without the + sign and that's what I was using
initial, as was the OP (René I guess).  however, we're going around in
circles here because comments at column 0 cause org-mode to consider
the next item to start a new list so your fourth item (if you hit C-c
C-c on it) will be renumbered to 1, as indicated by the OP!

Basically, we wish to have comments which don't interrupt the list
numbering *and* are not exported either.  Is this possible?

thanks,
eric


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: How to add comments in a plain list

2009-09-22 Thread Bernt Hansen
Eric S Fraga ucec...@ucl.ac.uk writes:

 At Tue, 22 Sep 2009 08:52:13 -0400, Bernt Hansen wrote:
 If you're actually trying to make the comment not export this seems to
 work for me
 
  1. first
  2. second
  #+ comment about second item
  3. third
  4. fourth
 
 -Bernt

 and in fact it works without the + sign and that's what I was using
 initial, as was the OP (René I guess).  however, we're going around in
 circles here because comments at column 0 cause org-mode to consider
 the next item to start a new list so your fourth item (if you hit C-c
 C-c on it) will be renumbered to 1, as indicated by the OP!

 Basically, we wish to have comments which don't interrupt the list
 numbering *and* are not exported either.  Is this possible?

At column 0 - probably not.

 1. first
 2. second
#+ comment about second item
#+ Another comment goes here
 3. third
 4. fourth

The #+ comment probably isn't officially supported either... it just
happens to work.  Sorry about the run-around :)

-Bernt


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: How to add comments in a plain list

2009-09-22 Thread Eric S Fraga
At Tue, 22 Sep 2009 10:10:41 -0400,
Bernt Hansen wrote:
 At column 0 - probably not.
 
  1. first
  2. second
 #+ comment about second item
 #+ Another comment goes here
  3. third
  4. fourth
 
 The #+ comment probably isn't officially supported either... it just
 happens to work.  Sorry about the run-around :)
 
 -Bernt

Ah ha!  Of the four combinations (# versus #+ and column 0 or not),
this one works perfectly!  Thanks.


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: How to add comments in a plain list

2009-09-22 Thread René
Eric S Fraga ucecesf at ucl.ac.uk writes:
 At Tue, 22 Sep 2009 10:10:41 -0400, Bernt Hansen wrote:
  At column 0 - probably not.
  
   1. first
   2. second
  #+ comment about second item
  #+ Another comment goes here
   3. third
   4. fourth
  
  The #+ comment probably isn't officially supported either... it just
  happens to work.  Sorry about the run-around :)

Unfortunately, in this case Emacs doesn't fontify those lines as if they were
comments.





___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: How to add comments in a plain list

2009-09-21 Thread Bernt Hansen
René jl...@yahoo.com writes:

 Is there a way to insert comments in a plain list without breaking it into two
 distinct lists?

 Such a list:

  1. first
  2. second
  # comment about second item
  3. third
  4. fourth

 is actually considered as

  1. first
  2. second
  # comment about second item
  1. third
  2. fourth

You can ident the comment like this

 1. first
 2. second

# comment about second item

 3. third
 4. fourth

-Bernt


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode