* Org mode export to HTML not working correctly with code blocks if block is after an item (-) and its delimiters are indented @ 2013-10-16 1:19 Omid 2013-10-16 2:41 ` Thorsten Jolitz ` (3 more replies) 0 siblings, 4 replies; 17+ messages in thread From: Omid @ 2013-10-16 1:19 UTC (permalink / raw) To: emacs-orgmode Hello All, When exporting to HTML (Org mode version 8.2.1 ELPA; GNU Emacs version 24.3.1) I see the a strange behavior which can be reproduced with the following minimal example: This exports correctly #+BEGIN_SRC sh ls #+END_SRC - This also exports correctly #+BEGIN_SRC sh ls #+END_SRC - This does NOT export correctly (code block is not detected) #+BEGIN_SRC sh ls #+END_SRC Is there any way around this behavior without removing the indentation for the code block delimiters? Thanks, -- Omid Sent from my Emacs ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Org mode export to HTML not working correctly with code blocks if block is after an item (-) and its delimiters are indented 2013-10-16 1:19 Org mode export to HTML not working correctly with code blocks if block is after an item (-) and its delimiters are indented Omid @ 2013-10-16 2:41 ` Thorsten Jolitz 2013-10-16 2:53 ` Thorsten Jolitz ` (2 subsequent siblings) 3 siblings, 0 replies; 17+ messages in thread From: Thorsten Jolitz @ 2013-10-16 2:41 UTC (permalink / raw) To: emacs-orgmode Omid <omidlink@gmail.com> writes: > - This does NOT export correctly (code block is not detected) > #+BEGIN_SRC sh > ls > #+END_SRC > > Is there any way around this behavior without removing the indentation > for the code block delimiters? I think the 'official'regexp to detect a src-block starts like this ,---------------------------------- | "^\\([ \t]*\\)#\\+begin_src [...] `---------------------------------- so I would guess that this should work, and its a bug if it doesn't. Inside a list like this - First item #+begin_src emacs-lisp :exports both (+ 3 4) #+end_src - Second Item Some text it should work too, lets test: #+begin_src emacs-lisp :exports value (with-current-buffer (current-buffer) (org-export-as 'ascii)) #+end_src ,----------------------------------------------------------------------- | #+results: | _________________ | | 427 | | Thorsten Jolitz | _________________ | | | | | | 1 --text follows this line-- | ============================ | | Omid <omidlink@gmail.com> writes: | | > - This does NOT export correctly (code block is not detected) | > #+BEGIN_SRC sh ls #+END_SRC Is there any way around this behavior | > without removing the indentation for the code block delimiters? | | I think the 'official'regexp to detect a src-block starts like this | | ,---------------------------------- | "^\\([ \t]*\\)#\\+begin_src [...] | `---------------------------------- | | so I would guess that this should work, and its a bug if it doesn't. | | Inside a list like like this | | - First item | | ,---- | | (+ 3 4) | `---- | | ,---- | | 7 | `---- | | | - Second Item | | Some text | | it should work too, lets test: | | ,---- | | (with-current-buffer | | (current-buffer) | | (org-export-as 'ascii)) | `---- | | | -- cheers, Thorsten `----------------------------------------------------------------------- looks as if it works for me ... -- cheers, Thorsten ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Org mode export to HTML not working correctly with code blocks if block is after an item (-) and its delimiters are indented 2013-10-16 1:19 Org mode export to HTML not working correctly with code blocks if block is after an item (-) and its delimiters are indented Omid 2013-10-16 2:41 ` Thorsten Jolitz @ 2013-10-16 2:53 ` Thorsten Jolitz 2013-10-16 3:12 ` Omid 2013-10-16 11:25 ` Nicolas Goaziou 2014-02-05 20:40 ` Behavior of Org mode Babel code snippets with respect to M-q (fill-paragraph) and C-/ (undo) Omid 3 siblings, 1 reply; 17+ messages in thread From: Thorsten Jolitz @ 2013-10-16 2:53 UTC (permalink / raw) To: emacs-orgmode PS: Omid <omidlink@gmail.com> writes: > When exporting to HTML (Org mode version 8.2.1 ELPA; GNU Emacs version > 24.3.1) I see the a strange behavior which can be reproduced with the > following minimal example: > > This exports correctly > #+BEGIN_SRC sh > ls > #+END_SRC > > - This also exports correctly > #+BEGIN_SRC sh > ls > #+END_SRC > > - This does NOT export correctly (code block is not detected) > #+BEGIN_SRC sh > ls > #+END_SRC > > Is there any way around this behavior without removing the indentation > for the code block delimiters? This exports correctly #+BEGIN_SRC sh ls #+END_SRC - This also exports correctly #+BEGIN_SRC sh ls #+END_SRC - This does NOT export correctly (code block is not detected) #+BEGIN_SRC sh ls #+END_SRC #+begin_src emacs-lisp :exports value (with-current-buffer (current-buffer) (org-export-as 'html)) #+end_src #+results: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" [...] This exports correctly </p> <div class="org-src-container"> <pre class="src src-sh">ls </pre> </div> <ul class="org-ul"> <li>This also exports correctly </li> </ul> <div class="org-src-container"> <pre class="src src-sh">ls </pre> </div> <ul class="org-ul"> <li>This does NOT export correctly (code block is not detected) <p> #+BEGIN_SRC sh </p> </li> </ul> <p> ls </p> <p> #+END_SRC </p> with html export, the last case does look quite different from the other ones. -- cheers, Thorsten ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Org mode export to HTML not working correctly with code blocks if block is after an item (-) and its delimiters are indented 2013-10-16 2:53 ` Thorsten Jolitz @ 2013-10-16 3:12 ` Omid 0 siblings, 0 replies; 17+ messages in thread From: Omid @ 2013-10-16 3:12 UTC (permalink / raw) To: emacs-orgmode Thank you for your quick reply, Thorsten. Yes, as I mentioned, and as you noticed, the HTML export does not seem to work correctly for the last case. The #BEGIN_SRC and #END_SRC delimiters are exported literally. -- Omid Sent from my Emacs On 10/15/2013 10:53 PM, Thorsten Jolitz wrote: > > PS: > > Omid <omidlink@gmail.com> writes: > >> When exporting to HTML (Org mode version 8.2.1 ELPA; GNU Emacs version >> 24.3.1) I see the a strange behavior which can be reproduced with the >> following minimal example: >> >> This exports correctly >> #+BEGIN_SRC sh >> ls >> #+END_SRC >> >> - This also exports correctly >> #+BEGIN_SRC sh >> ls >> #+END_SRC >> >> - This does NOT export correctly (code block is not detected) >> #+BEGIN_SRC sh >> ls >> #+END_SRC >> >> Is there any way around this behavior without removing the indentation >> for the code block delimiters? > > This exports correctly > #+BEGIN_SRC sh > ls > #+END_SRC > > - This also exports correctly > #+BEGIN_SRC sh > ls > #+END_SRC > > - This does NOT export correctly (code block is not detected) > #+BEGIN_SRC sh > ls > #+END_SRC > > > #+begin_src emacs-lisp :exports value > (with-current-buffer > (current-buffer) > (org-export-as 'html)) > #+end_src > > #+results: > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > [...] > This exports correctly > </p> > <div class="org-src-container"> > > <pre class="src src-sh">ls > </pre> > </div> > > <ul class="org-ul"> > <li>This also exports correctly > </li> > </ul> > <div class="org-src-container"> > > <pre class="src src-sh">ls > </pre> > </div> > > <ul class="org-ul"> > <li>This does NOT export correctly (code block is not detected) > <p> > #+BEGIN_SRC sh > </p> > </li> > </ul> > <p> > ls > </p> > <p> > #+END_SRC > </p> > > with html export, the last case does look quite different from the other ones. > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Org mode export to HTML not working correctly with code blocks if block is after an item (-) and its delimiters are indented 2013-10-16 1:19 Org mode export to HTML not working correctly with code blocks if block is after an item (-) and its delimiters are indented Omid 2013-10-16 2:41 ` Thorsten Jolitz 2013-10-16 2:53 ` Thorsten Jolitz @ 2013-10-16 11:25 ` Nicolas Goaziou 2014-02-05 20:40 ` Behavior of Org mode Babel code snippets with respect to M-q (fill-paragraph) and C-/ (undo) Omid 3 siblings, 0 replies; 17+ messages in thread From: Nicolas Goaziou @ 2013-10-16 11:25 UTC (permalink / raw) To: Omid; +Cc: emacs-orgmode Hello, Omid <omidlink@gmail.com> writes: > When exporting to HTML (Org mode version 8.2.1 ELPA; GNU Emacs version > 24.3.1) I see the a strange behavior which can be reproduced with the > following minimal example: > > This exports correctly > #+BEGIN_SRC sh > ls > #+END_SRC > > - This also exports correctly > #+BEGIN_SRC sh > ls > #+END_SRC > > - This does NOT export correctly (code block is not detected) > #+BEGIN_SRC sh > ls > #+END_SRC > > Is there any way around this behavior without removing the indentation > for the code block delimiters? This should now be fixed. Thank you for reporting it. Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 17+ messages in thread
* Behavior of Org mode Babel code snippets with respect to M-q (fill-paragraph) and C-/ (undo) 2013-10-16 1:19 Org mode export to HTML not working correctly with code blocks if block is after an item (-) and its delimiters are indented Omid ` (2 preceding siblings ...) 2013-10-16 11:25 ` Nicolas Goaziou @ 2014-02-05 20:40 ` Omid 2014-02-05 21:34 ` Nick Dokos 2014-05-25 20:37 ` Is there a variable/way to change <div id="content"> to something else, e.g. <div class="container"> for use with Bootstrap CSS? Omid 3 siblings, 2 replies; 17+ messages in thread From: Omid @ 2014-02-05 20:40 UTC (permalink / raw) To: emacs-orgmode Hello, I am using Org-mode version 8.2.5g (8.2.5g-elpa) in GNU Emacs 24.3.1. I have two questions about the behavior of the fantastic Org mode+Babel with respect to code and comments: Here is a minimal example: #+BEGIN_SRC f90 :results verbatim :exports both program main ! This is a very very very very very very very very very very very very very very very very long comment line. print *, "Hello, World!" end program main #+END_SRC Below is the code snippet after M-q (fill-paragraph) on the comment line. The comment line has been refilled (intended behavior) but all lines have been indented. This may also be an intended behavior; but FIRST QUESTION: Is there a way to disable this indentation upon M-Q in Org Babel code snippets? #+BEGIN_SRC f90 :results verbatim :exports both program main ! This is a very very very very very very very very very very very very ! very very very very long comment line. print *, "Hello, World!" end program main #+END_SRC Below is the code snippet after a C-/ (undo). Note that the indentation and the refill which were done by the last command above (M-q) are not being undone. The text in the comment is being removed which I believe means that the previous (self-insert-command)'s that created the text are being undone. This is very undesirable since even a user who is aware of this behavior may by mistake issue the command M-q, have the code snippet formatted in an undesirable way (e.g., sometimes new lines are not respected and code and comments get mixed up), without any immediate way to undo this reformatting. SECOND QUESTION: How can one get the usual (undo) behavior in a Babel code snippet? #+BEGIN_SRC f90 :results verbatim :exports both program main ! This is a very very very very very very very very very very very very ! very v comment line. print *, "Hello, World!" end program main #+END_SRC Please note that these edits are done in the Org mode buffer directly. If I switch to the native language mode using C-c ' things work as expected. Thanks, Omid ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Behavior of Org mode Babel code snippets with respect to M-q (fill-paragraph) and C-/ (undo) 2014-02-05 20:40 ` Behavior of Org mode Babel code snippets with respect to M-q (fill-paragraph) and C-/ (undo) Omid @ 2014-02-05 21:34 ` Nick Dokos 2014-02-05 23:02 ` Omid 2014-05-25 20:37 ` Is there a variable/way to change <div id="content"> to something else, e.g. <div class="container"> for use with Bootstrap CSS? Omid 1 sibling, 1 reply; 17+ messages in thread From: Nick Dokos @ 2014-02-05 21:34 UTC (permalink / raw) To: emacs-orgmode Omid <omidlink@gmail.com> writes: > Hello, > > I am using Org-mode version 8.2.5g (8.2.5g-elpa) in GNU Emacs 24.3.1. > I have two questions about the behavior of the fantastic Org > mode+Babel with respect to code and comments: > > Here is a minimal example: > > #+BEGIN_SRC f90 :results verbatim :exports both > program main > ! This is a very very very very very very very very very very very very > very very very very long comment line. > print *, "Hello, World!" > end program main > #+END_SRC > > Below is the code snippet after M-q (fill-paragraph) on the comment > line. The comment line has been refilled (intended behavior) but all > lines have been indented. This may also be an intended behavior; but > > FIRST QUESTION: Is there a way to disable this indentation upon M-Q in > Org Babel code snippets? > Try setting org-edit-src-content-indentation to 0. I'm not sure that it is going to work, but (based on rather flimsy numerological evidence, namely that its default value is 2 as is the indent below) it might. > #+BEGIN_SRC f90 :results verbatim :exports both > program main > ! This is a very very very very very very very very very very very very > ! very very very very long comment line. > print *, "Hello, World!" > end program main > #+END_SRC > BTW, I don't get this behavior but I don't use f90 mode, so I'm not sure whether there is some setup I'm missing. I get (with org-edit-src-content-indentation set to 0): #+BEGIN_SRC f90 :results verbatim :exports both program main ! This is a very very very very very very very very very very very very very very very very long comment line. print *, "Hello, World!" end program main #+END_SRC Nick ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Behavior of Org mode Babel code snippets with respect to M-q (fill-paragraph) and C-/ (undo) 2014-02-05 21:34 ` Nick Dokos @ 2014-02-05 23:02 ` Omid 2014-02-13 23:38 ` Samuel Wales 0 siblings, 1 reply; 17+ messages in thread From: Omid @ 2014-02-05 23:02 UTC (permalink / raw) To: emacs-orgmode Hello Nick, Thanks for your quick reply. The variable org-edit-src-content-indentation does indeed have to do with the indentation I was referring to. But it is relative. According to the documentation, it sets the "Indentation for the content of a source code block. This should be the number of spaces added to the indentation of the #+begin line in order to compute the indentation of the block content after editing it with M-x org-edit-src-code. Has no effect if `org-src-preserve-indentation' is non-nil." I wonder if one can set it to be zero as an absolute value, meaning that if the a line of code in the source block starts at column n of the buffer, it is left at column n after M-q. Regarding the behavior you observe, as I said I get that too from time to time. In fact, doing M-q on my own example in a fresh Org mode buffer, I now get what you get: #+BEGIN_SRC f90 :results verbatim :exports both program main ! This is a very very very very very very very very very very very very very very very very long comment line. print *, "Hello, World!" end program main #+END_SRC I don't have any special settings for the f90 mode in my .emacs. In fact, I have observed the same behavior for other languages too when edited in an Org source block. The "destructive" nature of this behavior is very special (C-/ (undo) doesn't work). Many a times, I have tried refilling a line of comments and ended up with a huge mix of code and comment that was impossible to undo (at least to the best of my knowledge) and I had to either revert the change if I had the file under version control, go to an auto backup file, or painfully and manually separate the code and comments to get back the original code block. Omid On 02/05/2014 04:34 PM, Nick Dokos wrote: > Omid <omidlink@gmail.com> writes: > >> Hello, >> >> I am using Org-mode version 8.2.5g (8.2.5g-elpa) in GNU Emacs 24.3.1. >> I have two questions about the behavior of the fantastic Org >> mode+Babel with respect to code and comments: >> >> Here is a minimal example: >> >> #+BEGIN_SRC f90 :results verbatim :exports both >> program main >> ! This is a very very very very very very very very very very very very >> very very very very long comment line. >> print *, "Hello, World!" >> end program main >> #+END_SRC >> >> Below is the code snippet after M-q (fill-paragraph) on the comment >> line. The comment line has been refilled (intended behavior) but all >> lines have been indented. This may also be an intended behavior; but >> >> FIRST QUESTION: Is there a way to disable this indentation upon M-Q in >> Org Babel code snippets? >> > > Try setting org-edit-src-content-indentation to 0. I'm not sure that > it is going to work, but (based on rather flimsy numerological evidence, > namely that its default value is 2 as is the indent below) it might. > >> #+BEGIN_SRC f90 :results verbatim :exports both >> program main >> ! This is a very very very very very very very very very very very very >> ! very very very very long comment line. >> print *, "Hello, World!" >> end program main >> #+END_SRC >> > > BTW, I don't get this behavior but I don't use f90 mode, so I'm not sure > whether there is some setup I'm missing. I get (with > org-edit-src-content-indentation set to 0): > > #+BEGIN_SRC f90 :results verbatim :exports both > program main ! This is a very very very very very very very very very > very very very very very very very long comment line. print *, > "Hello, World!" end program main > #+END_SRC > > Nick > > > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Behavior of Org mode Babel code snippets with respect to M-q (fill-paragraph) and C-/ (undo) 2014-02-05 23:02 ` Omid @ 2014-02-13 23:38 ` Samuel Wales 2014-02-14 0:21 ` Samuel Wales 0 siblings, 1 reply; 17+ messages in thread From: Samuel Wales @ 2014-02-13 23:38 UTC (permalink / raw) To: Omid; +Cc: emacs-orgmode Undo not working is a bug. I think we identified the bug on the mailing list, but the fix was never implemented, although I think an attempted fix was. I think it has to do with editing a source code block trying to do things with undo or undo-boundary. The fix is probably to rip out all undo-related code there. On 2/5/14, Omid <omidlink@gmail.com> wrote: > Hello Nick, > > Thanks for your quick reply. The variable > org-edit-src-content-indentation does indeed have to do with the > indentation I was referring to. But it is relative. According to the > documentation, it sets the "Indentation for the content of a source > code block. This should be the number of spaces added to the > indentation of the #+begin line in order to compute the indentation of > the block content after editing it with M-x org-edit-src-code. Has no > effect if `org-src-preserve-indentation' is non-nil." I wonder if one > can set it to be zero as an absolute value, meaning that if the a line > of code in the source block starts at column n of the buffer, it is > left at column n after M-q. > > Regarding the behavior you observe, as I said I get that too from time > to time. In fact, doing M-q on my own example in a fresh Org mode > buffer, I now get what you get: > > #+BEGIN_SRC f90 :results verbatim :exports both > program main ! This is a very very very very very very very very very > very very very very very very very long comment line. print *, "Hello, > World!" end program main > #+END_SRC > > I don't have any special settings for the f90 mode in my .emacs. In > fact, I have observed the same behavior for other languages too when > edited in an Org source block. The "destructive" nature of this > behavior is very special (C-/ (undo) doesn't work). Many a times, I > have tried refilling a line of comments and ended up with a huge mix > of code and comment that was impossible to undo (at least to the best > of my knowledge) and I had to either revert the change if I had the > file under version control, go to an auto backup file, or painfully and > manually separate the code and comments to get back the original code > block. > > Omid > > > On 02/05/2014 04:34 PM, Nick Dokos wrote: >> Omid <omidlink@gmail.com> writes: >> >>> Hello, >>> >>> I am using Org-mode version 8.2.5g (8.2.5g-elpa) in GNU Emacs 24.3.1. >>> I have two questions about the behavior of the fantastic Org >>> mode+Babel with respect to code and comments: >>> >>> Here is a minimal example: >>> >>> #+BEGIN_SRC f90 :results verbatim :exports both >>> program main >>> ! This is a very very very very very very very very very very very very >>> very very very very long comment line. >>> print *, "Hello, World!" >>> end program main >>> #+END_SRC >>> >>> Below is the code snippet after M-q (fill-paragraph) on the comment >>> line. The comment line has been refilled (intended behavior) but all >>> lines have been indented. This may also be an intended behavior; but >>> >>> FIRST QUESTION: Is there a way to disable this indentation upon M-Q in >>> Org Babel code snippets? >>> >> >> Try setting org-edit-src-content-indentation to 0. I'm not sure that >> it is going to work, but (based on rather flimsy numerological evidence, >> namely that its default value is 2 as is the indent below) it might. >> >>> #+BEGIN_SRC f90 :results verbatim :exports both >>> program main >>> ! This is a very very very very very very very very very very very >>> very >>> ! very very very very long comment line. >>> print *, "Hello, World!" >>> end program main >>> #+END_SRC >>> >> >> BTW, I don't get this behavior but I don't use f90 mode, so I'm not sure >> whether there is some setup I'm missing. I get (with >> org-edit-src-content-indentation set to 0): >> >> #+BEGIN_SRC f90 :results verbatim :exports both >> program main ! This is a very very very very very very very very very >> very very very very very very very long comment line. print *, >> "Hello, World!" end program main >> #+END_SRC >> >> Nick >> >> >> > > -- The Kafka Pandemic: http://thekafkapandemic.blogspot.com The disease DOES progress. MANY people have died from it. ANYBODY can get it. Denmark: free Karina Hansen NOW. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Behavior of Org mode Babel code snippets with respect to M-q (fill-paragraph) and C-/ (undo) 2014-02-13 23:38 ` Samuel Wales @ 2014-02-14 0:21 ` Samuel Wales 2014-03-21 7:56 ` Bastien 0 siblings, 1 reply; 17+ messages in thread From: Samuel Wales @ 2014-02-14 0:21 UTC (permalink / raw) To: Omid; +Cc: emacs-orgmode "[bug] [babel] babel corrupts undo history" On 2/13/14, Samuel Wales <samologist@gmail.com> wrote: > Undo not working is a bug. I think we identified the bug on the > mailing list, but the fix was never implemented, although I think an > attempted fix was. > > I think it has to do with editing a source code block trying to do > things with undo or undo-boundary. The fix is probably to rip out all > undo-related code there. > > > On 2/5/14, Omid <omidlink@gmail.com> wrote: >> Hello Nick, >> >> Thanks for your quick reply. The variable >> org-edit-src-content-indentation does indeed have to do with the >> indentation I was referring to. But it is relative. According to the >> documentation, it sets the "Indentation for the content of a source >> code block. This should be the number of spaces added to the >> indentation of the #+begin line in order to compute the indentation of >> the block content after editing it with M-x org-edit-src-code. Has no >> effect if `org-src-preserve-indentation' is non-nil." I wonder if one >> can set it to be zero as an absolute value, meaning that if the a line >> of code in the source block starts at column n of the buffer, it is >> left at column n after M-q. >> >> Regarding the behavior you observe, as I said I get that too from time >> to time. In fact, doing M-q on my own example in a fresh Org mode >> buffer, I now get what you get: >> >> #+BEGIN_SRC f90 :results verbatim :exports both >> program main ! This is a very very very very very very very very very >> very very very very very very very long comment line. print *, "Hello, >> World!" end program main >> #+END_SRC >> >> I don't have any special settings for the f90 mode in my .emacs. In >> fact, I have observed the same behavior for other languages too when >> edited in an Org source block. The "destructive" nature of this >> behavior is very special (C-/ (undo) doesn't work). Many a times, I >> have tried refilling a line of comments and ended up with a huge mix >> of code and comment that was impossible to undo (at least to the best >> of my knowledge) and I had to either revert the change if I had the >> file under version control, go to an auto backup file, or painfully and >> manually separate the code and comments to get back the original code >> block. >> >> Omid >> >> >> On 02/05/2014 04:34 PM, Nick Dokos wrote: >>> Omid <omidlink@gmail.com> writes: >>> >>>> Hello, >>>> >>>> I am using Org-mode version 8.2.5g (8.2.5g-elpa) in GNU Emacs 24.3.1. >>>> I have two questions about the behavior of the fantastic Org >>>> mode+Babel with respect to code and comments: >>>> >>>> Here is a minimal example: >>>> >>>> #+BEGIN_SRC f90 :results verbatim :exports both >>>> program main >>>> ! This is a very very very very very very very very very very very very >>>> very very very very long comment line. >>>> print *, "Hello, World!" >>>> end program main >>>> #+END_SRC >>>> >>>> Below is the code snippet after M-q (fill-paragraph) on the comment >>>> line. The comment line has been refilled (intended behavior) but all >>>> lines have been indented. This may also be an intended behavior; but >>>> >>>> FIRST QUESTION: Is there a way to disable this indentation upon M-Q in >>>> Org Babel code snippets? >>>> >>> >>> Try setting org-edit-src-content-indentation to 0. I'm not sure that >>> it is going to work, but (based on rather flimsy numerological evidence, >>> namely that its default value is 2 as is the indent below) it might. >>> >>>> #+BEGIN_SRC f90 :results verbatim :exports both >>>> program main >>>> ! This is a very very very very very very very very very very very >>>> very >>>> ! very very very very long comment line. >>>> print *, "Hello, World!" >>>> end program main >>>> #+END_SRC >>>> >>> >>> BTW, I don't get this behavior but I don't use f90 mode, so I'm not sure >>> whether there is some setup I'm missing. I get (with >>> org-edit-src-content-indentation set to 0): >>> >>> #+BEGIN_SRC f90 :results verbatim :exports both >>> program main ! This is a very very very very very very very very very >>> very very very very very very very long comment line. print *, >>> "Hello, World!" end program main >>> #+END_SRC >>> >>> Nick >>> >>> >>> >> >> > > > -- > The Kafka Pandemic: http://thekafkapandemic.blogspot.com > > The disease DOES progress. MANY people have died from it. ANYBODY can get > it. > > Denmark: free Karina Hansen NOW. > -- The Kafka Pandemic: http://thekafkapandemic.blogspot.com The disease DOES progress. MANY people have died from it. ANYBODY can get it. Denmark: free Karina Hansen NOW. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Behavior of Org mode Babel code snippets with respect to M-q (fill-paragraph) and C-/ (undo) 2014-02-14 0:21 ` Samuel Wales @ 2014-03-21 7:56 ` Bastien 0 siblings, 0 replies; 17+ messages in thread From: Bastien @ 2014-03-21 7:56 UTC (permalink / raw) To: Samuel Wales; +Cc: emacs-orgmode, Omid Hi Samuel, Samuel Wales <samologist@gmail.com> writes: > "[bug] [babel] babel corrupts undo history" I've reread this thread but I currently nothing wrong with undoing wrt source code editing. Let me know if I missed something, thanks, -- Bastien ^ permalink raw reply [flat|nested] 17+ messages in thread
* Is there a variable/way to change <div id="content"> to something else, e.g. <div class="container"> for use with Bootstrap CSS? 2014-02-05 20:40 ` Behavior of Org mode Babel code snippets with respect to M-q (fill-paragraph) and C-/ (undo) Omid 2014-02-05 21:34 ` Nick Dokos @ 2014-05-25 20:37 ` Omid 2014-05-26 2:10 ` Eric Abrahamsen 1 sibling, 1 reply; 17+ messages in thread From: Omid @ 2014-05-25 20:37 UTC (permalink / raw) To: emacs-orgmode Hello, - I am trying to build a statically-generated website purely with Org mode. I would like to use Bootstrap CSS to make the site mobile friendly. Bootstrap uses <div class="container"> for the "main" part of the <body> of HTML; Org mode export produces <div id="content"> for that part. Is there a variable to set/way to make Org wrap this part in the "container" class? Looking at several "apropos" results (with all the search keywords I could think of), I only see a setting for pre/postamble-class: org-html--pre/postamble-class Variable: CSS class used for pre/postamble - Assuming there is no Org-internal way to do this, is there a function that is run after a project is published to that I can, e.g., run a sed script on the HTML files generated? Again, the only remotely relevant result I see in M-x apropos RET org post is org-babel-post-tangle-hook Variable: Hook run in code files tangled by `org-babel-tangle'. Properties: standard-value custom-version custom-type custom-requests variable-documentation - As a "meta question", how would one find the answer to these and similar questions without leaving Emacs, since we know Emacs is self-documenting and Org mode has a very comprehensive set of functions and documentation. Looking in the usual places (C-u M-x apropos, C-h v) did not lead me to an answer. Thanks, Omid Sent from my Emacs ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Is there a variable/way to change <div id="content"> to something else, e.g. <div class="container"> for use with Bootstrap CSS? 2014-05-25 20:37 ` Is there a variable/way to change <div id="content"> to something else, e.g. <div class="container"> for use with Bootstrap CSS? Omid @ 2014-05-26 2:10 ` Eric Abrahamsen 2014-05-26 4:08 ` Omid 0 siblings, 1 reply; 17+ messages in thread From: Eric Abrahamsen @ 2014-05-26 2:10 UTC (permalink / raw) To: emacs-orgmode Omid <omidlink@gmail.com> writes: > Hello, > > - I am trying to build a statically-generated website purely with Org > mode. I would like to use Bootstrap CSS to make the site mobile > friendly. Bootstrap uses <div class="container"> for the "main" part > of the <body> of HTML; Org mode export produces <div id="content"> > for that part. > > Is there a variable to set/way to make Org wrap this part in the > "container" class? > > Looking at several "apropos" results (with all the search keywords I > could think of), I only see a setting for pre/postamble-class: > > org-html--pre/postamble-class > Variable: CSS class used for pre/postamble It would help to know your Org mode version, but I'm pretty sure org-html-divs has been around for a bit. Check out its docstring, and modify its second element, which is '(content "div" "content") by default. > - Assuming there is no Org-internal way to do this, is there a > function that is run after a project is published to that I can, > e.g., run a sed script on the HTML files generated? Again, the only > remotely relevant result I see in M-x apropos RET org post is > > org-babel-post-tangle-hook > Variable: Hook run in code files tangled by `org-babel-tangle'. > Properties: standard-value custom-version custom-type > custom-requests variable-documentation > > - As a "meta question", how would one find the answer to these and > similar questions without leaving Emacs, since we know Emacs is > self-documenting and Org mode has a very comprehensive set of > functions and documentation. Looking in the usual places (C-u M-x > apropos, C-h v) did not lead me to an answer. One good thing to know is that Org export variables related to a certain backend all start with org-BACKEND-*. So you could do C-h v org-html-TAB and see... a lot of variables. Still, that would (eventually) get you there. I did apropos-variable for "org html container" and that got me a similar list as C-h v, albeit slimmed down somewhat, and with docstrings. Hope that helps, Eric ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Is there a variable/way to change <div id="content"> to something else, e.g. <div class="container"> for use with Bootstrap CSS? 2014-05-26 2:10 ` Eric Abrahamsen @ 2014-05-26 4:08 ` Omid 2014-05-26 4:26 ` Omid 0 siblings, 1 reply; 17+ messages in thread From: Omid @ 2014-05-26 4:08 UTC (permalink / raw) To: emacs-orgmode Thank you, Eric for your quick response. - I am using Org mode 8.2.6 (from ELPA) and Emacs 24.3.1. - org-html-divs does almost what I have been looking for, except for one, unfortunately crucial, shortcoming: I don't see any way of changing the "id" tag to "class". Bootstrap's container is a "class" and will not work as an "id". As far as see, I can only do (setq org-html-divs (quote ((preamble "div" "preamble") (content "div" "container") (postamble "div" "postamble")))) Looking at ox-html.el I see that the "id" tag is hard coded: (list :tag "Content" (const :format "" content) (string :tag "element") (string :tag " id")) Am I missing something here? - I still could not find a "post publish" hook/variable. Neither apropos-variable with org publish, apropos with org publish gives me anything useful. C-h v reveals org-export-before-parsing-hook and org-export-before-processing-hook but I don't see anything with "after" or "post". The only way I see around my problem is to define an external publishing-function in org-publish-project-alist (maybe a makefile) and do the necessary post processing there. Any better suggestion is greatly appreciated. Thanks, Omid Sent from my Emacs On 05/25/2014 10:10 PM, Eric Abrahamsen wrote: > Omid <omidlink@gmail.com> writes: > >> Hello, >> >> - I am trying to build a statically-generated website purely with Org >> mode. I would like to use Bootstrap CSS to make the site mobile >> friendly. Bootstrap uses <div class="container"> for the "main" part >> of the <body> of HTML; Org mode export produces <div id="content"> >> for that part. >> >> Is there a variable to set/way to make Org wrap this part in the >> "container" class? >> >> Looking at several "apropos" results (with all the search keywords I >> could think of), I only see a setting for pre/postamble-class: >> >> org-html--pre/postamble-class >> Variable: CSS class used for pre/postamble > > It would help to know your Org mode version, but I'm pretty sure > org-html-divs has been around for a bit. Check out its docstring, and > modify its second element, which is '(content "div" "content") by > default. > >> - Assuming there is no Org-internal way to do this, is there a >> function that is run after a project is published to that I can, >> e.g., run a sed script on the HTML files generated? Again, the only >> remotely relevant result I see in M-x apropos RET org post is >> >> org-babel-post-tangle-hook >> Variable: Hook run in code files tangled by `org-babel-tangle'. >> Properties: standard-value custom-version custom-type >> custom-requests variable-documentation >> >> - As a "meta question", how would one find the answer to these and >> similar questions without leaving Emacs, since we know Emacs is >> self-documenting and Org mode has a very comprehensive set of >> functions and documentation. Looking in the usual places (C-u M-x >> apropos, C-h v) did not lead me to an answer. > > One good thing to know is that Org export variables related to a certain > backend all start with org-BACKEND-*. So you could do C-h v org-html-TAB > and see... a lot of variables. Still, that would (eventually) get you > there. I did apropos-variable for "org html container" and that got me a > similar list as C-h v, albeit slimmed down somewhat, and with > docstrings. > > Hope that helps, > Eric > > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Is there a variable/way to change <div id="content"> to something else, e.g. <div class="container"> for use with Bootstrap CSS? 2014-05-26 4:08 ` Omid @ 2014-05-26 4:26 ` Omid 2014-05-26 5:11 ` Eric Abrahamsen 0 siblings, 1 reply; 17+ messages in thread From: Omid @ 2014-05-26 4:26 UTC (permalink / raw) To: emacs-orgmode I think I found the answer to my second question: in org-publish-project-alist, there is the property completion-function that can be set to a (list of) functions to do some post processing. My first question still stands, though. Omid Sent from my Emacs On 05/26/2014 12:08 AM, Omid wrote: > Thank you, Eric for your quick response. > - I am using Org mode 8.2.6 (from ELPA) and Emacs 24.3.1. > - org-html-divs does almost what I have been looking for, except for > one, unfortunately crucial, shortcoming: I don't see any way of > changing the "id" tag to "class". Bootstrap's container is a "class" > and will not work as an "id". As far as see, I can only do > > (setq org-html-divs (quote ((preamble "div" "preamble") > (content "div" "container") > (postamble "div" "postamble")))) > > Looking at ox-html.el I see that the "id" tag is hard coded: > > (list :tag "Content" > (const :format "" content) > (string :tag "element") (string :tag " id")) > > Am I missing something here? > > - I still could not find a "post publish" hook/variable. Neither > apropos-variable with org publish, apropos with org publish gives me > anything useful. C-h v reveals org-export-before-parsing-hook and > org-export-before-processing-hook but I don't see anything with > "after" or "post". The only way I see around my problem is to define > an external publishing-function in org-publish-project-alist (maybe > a makefile) and do the necessary post processing there. Any better > suggestion is greatly appreciated. > > Thanks, > > Omid > > Sent from my Emacs > > On 05/25/2014 10:10 PM, Eric Abrahamsen wrote: >> Omid <omidlink@gmail.com> writes: >> >>> Hello, >>> >>> - I am trying to build a statically-generated website purely with Org >>> mode. I would like to use Bootstrap CSS to make the site mobile >>> friendly. Bootstrap uses <div class="container"> for the "main" part >>> of the <body> of HTML; Org mode export produces <div id="content"> >>> for that part. >>> >>> Is there a variable to set/way to make Org wrap this part in the >>> "container" class? >>> >>> Looking at several "apropos" results (with all the search keywords I >>> could think of), I only see a setting for pre/postamble-class: >>> >>> org-html--pre/postamble-class >>> Variable: CSS class used for pre/postamble >> >> It would help to know your Org mode version, but I'm pretty sure >> org-html-divs has been around for a bit. Check out its docstring, and >> modify its second element, which is '(content "div" "content") by >> default. >> >>> - Assuming there is no Org-internal way to do this, is there a >>> function that is run after a project is published to that I can, >>> e.g., run a sed script on the HTML files generated? Again, the only >>> remotely relevant result I see in M-x apropos RET org post is >>> >>> org-babel-post-tangle-hook >>> Variable: Hook run in code files tangled by `org-babel-tangle'. >>> Properties: standard-value custom-version custom-type >>> custom-requests variable-documentation >>> >>> - As a "meta question", how would one find the answer to these and >>> similar questions without leaving Emacs, since we know Emacs is >>> self-documenting and Org mode has a very comprehensive set of >>> functions and documentation. Looking in the usual places (C-u M-x >>> apropos, C-h v) did not lead me to an answer. >> >> One good thing to know is that Org export variables related to a certain >> backend all start with org-BACKEND-*. So you could do C-h v org-html-TAB >> and see... a lot of variables. Still, that would (eventually) get you >> there. I did apropos-variable for "org html container" and that got me a >> similar list as C-h v, albeit slimmed down somewhat, and with >> docstrings. >> >> Hope that helps, >> Eric >> >> ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Is there a variable/way to change <div id="content"> to something else, e.g. <div class="container"> for use with Bootstrap CSS? 2014-05-26 4:26 ` Omid @ 2014-05-26 5:11 ` Eric Abrahamsen 2014-05-26 6:28 ` Omid 0 siblings, 1 reply; 17+ messages in thread From: Eric Abrahamsen @ 2014-05-26 5:11 UTC (permalink / raw) To: emacs-orgmode Omid <omidlink@gmail.com> writes: > I think I found the answer to my second question: in > org-publish-project-alist, there is the property completion-function > that can be set to a (list of) functions to do some post processing. > My first question still stands, though. Yup, that's a bit of a pain. When you need to really mess with the results of an Org export, the way to do it is through the "filter" system, not regular hooks. See the comments under "The Filter System" in lisp/ox.el for details on that. Filters give you access to the exported strings produced from various elements in the org buffer. Unfortunately there isn't a filter that reaches the contents template, which is where ox-html is setting the div id, so you'll probably need to use the nuclear option: org-export-filter-final-output-functions. Functions placed in that variable get access to the whole export string, and you can just do a search-and-replace for your id/class string there. Yours, Eric > On 05/26/2014 12:08 AM, Omid wrote: >> Thank you, Eric for your quick response. >> - I am using Org mode 8.2.6 (from ELPA) and Emacs 24.3.1. >> - org-html-divs does almost what I have been looking for, except for >> one, unfortunately crucial, shortcoming: I don't see any way of >> changing the "id" tag to "class". Bootstrap's container is a "class" >> and will not work as an "id". As far as see, I can only do >> >> (setq org-html-divs (quote ((preamble "div" "preamble") >> (content "div" "container") >> (postamble "div" "postamble")))) >> >> Looking at ox-html.el I see that the "id" tag is hard coded: >> >> (list :tag "Content" >> (const :format "" content) >> (string :tag "element") (string :tag " id")) >> >> Am I missing something here? >> >> - I still could not find a "post publish" hook/variable. Neither >> apropos-variable with org publish, apropos with org publish gives me >> anything useful. C-h v reveals org-export-before-parsing-hook and >> org-export-before-processing-hook but I don't see anything with >> "after" or "post". The only way I see around my problem is to define >> an external publishing-function in org-publish-project-alist (maybe >> a makefile) and do the necessary post processing there. Any better >> suggestion is greatly appreciated. >> >> Thanks, >> >> Omid >> >> Sent from my Emacs >> >> On 05/25/2014 10:10 PM, Eric Abrahamsen wrote: >>> Omid <omidlink@gmail.com> writes: >>> >>>> Hello, >>>> >>>> - I am trying to build a statically-generated website purely with Org >>>> mode. I would like to use Bootstrap CSS to make the site mobile >>>> friendly. Bootstrap uses <div class="container"> for the "main" part >>>> of the <body> of HTML; Org mode export produces <div id="content"> >>>> for that part. >>>> >>>> Is there a variable to set/way to make Org wrap this part in the >>>> "container" class? >>>> >>>> Looking at several "apropos" results (with all the search keywords I >>>> could think of), I only see a setting for pre/postamble-class: >>>> >>>> org-html--pre/postamble-class >>>> Variable: CSS class used for pre/postamble >>> >>> It would help to know your Org mode version, but I'm pretty sure >>> org-html-divs has been around for a bit. Check out its docstring, and >>> modify its second element, which is '(content "div" "content") by >>> default. >>> >>>> - Assuming there is no Org-internal way to do this, is there a >>>> function that is run after a project is published to that I can, >>>> e.g., run a sed script on the HTML files generated? Again, the only >>>> remotely relevant result I see in M-x apropos RET org post is >>>> >>>> org-babel-post-tangle-hook >>>> Variable: Hook run in code files tangled by `org-babel-tangle'. >>>> Properties: standard-value custom-version custom-type >>>> custom-requests variable-documentation >>>> >>>> - As a "meta question", how would one find the answer to these and >>>> similar questions without leaving Emacs, since we know Emacs is >>>> self-documenting and Org mode has a very comprehensive set of >>>> functions and documentation. Looking in the usual places (C-u M-x >>>> apropos, C-h v) did not lead me to an answer. >>> >>> One good thing to know is that Org export variables related to a certain >>> backend all start with org-BACKEND-*. So you could do C-h v org-html-TAB >>> and see... a lot of variables. Still, that would (eventually) get you >>> there. I did apropos-variable for "org html container" and that got me a >>> similar list as C-h v, albeit slimmed down somewhat, and with >>> docstrings. >>> >>> Hope that helps, >>> Eric >>> >>> ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Is there a variable/way to change <div id="content"> to something else, e.g. <div class="container"> for use with Bootstrap CSS? 2014-05-26 5:11 ` Eric Abrahamsen @ 2014-05-26 6:28 ` Omid 0 siblings, 0 replies; 17+ messages in thread From: Omid @ 2014-05-26 6:28 UTC (permalink / raw) To: emacs-orgmode Eric, Thanks a lot for the pointer to the "Filter System." I was not aware of it and, as you pointed out, the org-export-filter-final-output-functions variable will help me achieve what I was looking for. Cheers, Omid Sent from my Emacs On 05/26/2014 01:11 AM, Eric Abrahamsen wrote: > Omid <omidlink@gmail.com> writes: > >> I think I found the answer to my second question: in >> org-publish-project-alist, there is the property completion-function >> that can be set to a (list of) functions to do some post processing. >> My first question still stands, though. > > Yup, that's a bit of a pain. > > When you need to really mess with the results of an Org export, the way > to do it is through the "filter" system, not regular hooks. See the > comments under "The Filter System" in lisp/ox.el for details on that. > > Filters give you access to the exported strings produced from various > elements in the org buffer. Unfortunately there isn't a filter that > reaches the contents template, which is where ox-html is setting the div > id, so you'll probably need to use the nuclear option: > org-export-filter-final-output-functions. Functions placed in that > variable get access to the whole export string, and you can just do a > search-and-replace for your id/class string there. > > Yours, > Eric > >> On 05/26/2014 12:08 AM, Omid wrote: >>> Thank you, Eric for your quick response. >>> - I am using Org mode 8.2.6 (from ELPA) and Emacs 24.3.1. >>> - org-html-divs does almost what I have been looking for, except for >>> one, unfortunately crucial, shortcoming: I don't see any way of >>> changing the "id" tag to "class". Bootstrap's container is a "class" >>> and will not work as an "id". As far as see, I can only do >>> >>> (setq org-html-divs (quote ((preamble "div" "preamble") >>> (content "div" "container") >>> (postamble "div" "postamble")))) >>> >>> Looking at ox-html.el I see that the "id" tag is hard coded: >>> >>> (list :tag "Content" >>> (const :format "" content) >>> (string :tag "element") (string :tag " id")) >>> >>> Am I missing something here? >>> >>> - I still could not find a "post publish" hook/variable. Neither >>> apropos-variable with org publish, apropos with org publish gives me >>> anything useful. C-h v reveals org-export-before-parsing-hook and >>> org-export-before-processing-hook but I don't see anything with >>> "after" or "post". The only way I see around my problem is to define >>> an external publishing-function in org-publish-project-alist (maybe >>> a makefile) and do the necessary post processing there. Any better >>> suggestion is greatly appreciated. >>> >>> Thanks, >>> >>> Omid >>> >>> Sent from my Emacs >>> >>> On 05/25/2014 10:10 PM, Eric Abrahamsen wrote: >>>> Omid <omidlink@gmail.com> writes: >>>> >>>>> Hello, >>>>> >>>>> - I am trying to build a statically-generated website purely with Org >>>>> mode. I would like to use Bootstrap CSS to make the site mobile >>>>> friendly. Bootstrap uses <div class="container"> for the "main" part >>>>> of the <body> of HTML; Org mode export produces <div id="content"> >>>>> for that part. >>>>> >>>>> Is there a variable to set/way to make Org wrap this part in the >>>>> "container" class? >>>>> >>>>> Looking at several "apropos" results (with all the search keywords I >>>>> could think of), I only see a setting for pre/postamble-class: >>>>> >>>>> org-html--pre/postamble-class >>>>> Variable: CSS class used for pre/postamble >>>> >>>> It would help to know your Org mode version, but I'm pretty sure >>>> org-html-divs has been around for a bit. Check out its docstring, and >>>> modify its second element, which is '(content "div" "content") by >>>> default. >>>> >>>>> - Assuming there is no Org-internal way to do this, is there a >>>>> function that is run after a project is published to that I can, >>>>> e.g., run a sed script on the HTML files generated? Again, the only >>>>> remotely relevant result I see in M-x apropos RET org post is >>>>> >>>>> org-babel-post-tangle-hook >>>>> Variable: Hook run in code files tangled by `org-babel-tangle'. >>>>> Properties: standard-value custom-version custom-type >>>>> custom-requests variable-documentation >>>>> >>>>> - As a "meta question", how would one find the answer to these and >>>>> similar questions without leaving Emacs, since we know Emacs is >>>>> self-documenting and Org mode has a very comprehensive set of >>>>> functions and documentation. Looking in the usual places (C-u M-x >>>>> apropos, C-h v) did not lead me to an answer. >>>> >>>> One good thing to know is that Org export variables related to a certain >>>> backend all start with org-BACKEND-*. So you could do C-h v org-html-TAB >>>> and see... a lot of variables. Still, that would (eventually) get you >>>> there. I did apropos-variable for "org html container" and that got me a >>>> similar list as C-h v, albeit slimmed down somewhat, and with >>>> docstrings. >>>> >>>> Hope that helps, >>>> Eric >>>> >>>> > > ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2014-05-26 6:28 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-10-16 1:19 Org mode export to HTML not working correctly with code blocks if block is after an item (-) and its delimiters are indented Omid 2013-10-16 2:41 ` Thorsten Jolitz 2013-10-16 2:53 ` Thorsten Jolitz 2013-10-16 3:12 ` Omid 2013-10-16 11:25 ` Nicolas Goaziou 2014-02-05 20:40 ` Behavior of Org mode Babel code snippets with respect to M-q (fill-paragraph) and C-/ (undo) Omid 2014-02-05 21:34 ` Nick Dokos 2014-02-05 23:02 ` Omid 2014-02-13 23:38 ` Samuel Wales 2014-02-14 0:21 ` Samuel Wales 2014-03-21 7:56 ` Bastien 2014-05-25 20:37 ` Is there a variable/way to change <div id="content"> to something else, e.g. <div class="container"> for use with Bootstrap CSS? Omid 2014-05-26 2:10 ` Eric Abrahamsen 2014-05-26 4:08 ` Omid 2014-05-26 4:26 ` Omid 2014-05-26 5:11 ` Eric Abrahamsen 2014-05-26 6:28 ` Omid
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).