emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Auto-fill-mode with code sections
@ 2012-05-01 13:51 Ken Williams
  0 siblings, 0 replies; 5+ messages in thread
From: Ken Williams @ 2012-05-01 13:51 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1053 bytes --]

Hi,

I use org-mode extensively with R code sections, as a scientific notebook.  One annoyance I have is that when I have auto-fill-mode turned on (which is convenient for the main body parts of the document), it extends to the code section and starts auto-filling my code.

Can anyone recommend a configuration that will get me folding in the body sections, but not in the code sections?  It could use another mechanism besides auto-fill-mode if that's what's preferred these days, but auto-fill-mode is the one I'm familiar with.

Thanks.

--
Ken Williams, Senior Research Scientist
WindLogics
http://windlogics.com


________________________________
CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution of any kind is strictly prohibited. If you are not the intended recipient, please contact the sender via reply e-mail and destroy all copies of the original message. Thank you.

[-- Attachment #2: Type: text/html, Size: 3391 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Auto-fill-mode with code sections
  2012-05-04 22:00 Auto-fill-mode with code sections Ken Williams
@ 2012-05-04 20:09 ` Eric Schulte
  2012-05-05  4:07   ` cberry
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2012-05-04 20:09 UTC (permalink / raw)
  To: Ken Williams; +Cc: emacs-orgmode@gnu.org

Ken Williams <Ken.Williams@windlogics.com> writes:

> Ping - I'm still interested in this, if anyone has any recommendations.  Thanks.
>

Hi Ken,

I don't know of an automatic solution here.  One option is to edit code
sections with org-edit-special, i.e., press C-c ' from within a code
block.

Best,

>
>  -Ken
>
>> From: Ken Williams
>> Sent: Tuesday, May 01, 2012 8:51 AM
>> To: emacs-orgmode@gnu.org
>> Subject: Auto-fill-mode with code sections
>>
>> Hi,
>>
>> I use org-mode extensively with R code sections, as a scientific notebook.
>> One annoyance I have is that when I have auto-fill-mode turned on (which
>> is convenient for the main body parts of the document), it extends to the
>> code section and starts auto-filling my code.
>>
>> Can anyone recommend a configuration that will get me folding in the body
>> sections, but not in the code sections?  It could use another mechanism
>> besides auto-fill-mode if that's what's preferred these days, but auto-fill-mode
>> is the one I'm familiar with.
>
>
> CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the
> intended recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or distribution
> of any kind is strictly prohibited. If you are not the intended
> recipient, please contact the sender via reply e-mail and destroy all
> copies of the original message. Thank you.
>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Auto-fill-mode with code sections
@ 2012-05-04 22:00 Ken Williams
  2012-05-04 20:09 ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Ken Williams @ 2012-05-04 22:00 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

Ping - I'm still interested in this, if anyone has any recommendations.  Thanks.

 -Ken

> From: Ken Williams
> Sent: Tuesday, May 01, 2012 8:51 AM
> To: emacs-orgmode@gnu.org
> Subject: Auto-fill-mode with code sections
>
> Hi,
>
> I use org-mode extensively with R code sections, as a scientific notebook.
> One annoyance I have is that when I have auto-fill-mode turned on (which
> is convenient for the main body parts of the document), it extends to the
> code section and starts auto-filling my code.
>
> Can anyone recommend a configuration that will get me folding in the body
> sections, but not in the code sections?  It could use another mechanism
> besides auto-fill-mode if that's what's preferred these days, but auto-fill-mode
> is the one I'm familiar with.


CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution of any kind is strictly prohibited. If you are not the intended recipient, please contact the sender via reply e-mail and destroy all copies of the original message. Thank you.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Auto-fill-mode with code sections
  2012-05-04 20:09 ` Eric Schulte
@ 2012-05-05  4:07   ` cberry
  2012-05-05  6:17     ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: cberry @ 2012-05-05  4:07 UTC (permalink / raw)
  To: emacs-orgmode

Eric Schulte <eric.schulte@gmx.com> writes:

> Ken Williams <Ken.Williams@windlogics.com> writes:
>
>> Ping - I'm still interested in this, if anyone has any recommendations.  Thanks.
>>
>
> Hi Ken,
>
> I don't know of an automatic solution here.  One option is to edit code
> sections with org-edit-special, i.e., press C-c ' from within a code
> block.
>
> Best,

Here is a start. 

It fills normal text, but leaves src blocks alone. 

Maybe add something to one of the org-mode hooks ?

HTH,

Chuck

,----
| 
| * autofill, but not src blocks
| 
| #+begin_src emacs-lisp
|   (defun org-auto-fill-function ()
|     "auto fill function to leave src blocks alone"
|     (if (not (org-babel-get-src-block-info))
|         (do-auto-fill)))
|   (setq normal-auto-fill-function 'org-auto-fill-function)
| #+end_src
| 
| 
| aaa aaa vvv aaa aaa vvv aaa aaa vvv aaa aaa vvv aaa aaa vvv  aaa aaa
| aaa aaa vvv  aaa aaa vvv aaa aaa vvv aaa aaa vvv aaa aaa vvv aaa aaa
| vvv aaaaaa  vvv aaa aaa vvv 
| 
| #+begin_src R
| x <- y + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 3 
| #+end_src
`----

>
>>
>>  -Ken
>>
>>> From: Ken Williams
>>> Sent: Tuesday, May 01, 2012 8:51 AM
>>> To: emacs-orgmode@gnu.org
>>> Subject: Auto-fill-mode with code sections
>>>
>>> Hi,
>>>
>>> I use org-mode extensively with R code sections, as a scientific notebook.
>>> One annoyance I have is that when I have auto-fill-mode turned on (which
>>> is convenient for the main body parts of the document), it extends to the
>>> code section and starts auto-filling my code.
>>>
>>> Can anyone recommend a configuration that will get me folding in the body
>>> sections, but not in the code sections?  It could use another mechanism
>>> besides auto-fill-mode if that's what's preferred these days, but auto-fill-mode
>>> is the one I'm familiar with.
>>
>>
>> CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the
>> intended recipient(s) and may contain confidential and privileged
>> information. Any unauthorized review, use, disclosure or distribution
>> of any kind is strictly prohibited. If you are not the intended
>> recipient, please contact the sender via reply e-mail and destroy all
>> copies of the original message. Thank you.
>>

-- 
Charles C. Berry                            Dept of Family/Preventive Medicine
cberry at ucsd edu			    UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Auto-fill-mode with code sections
  2012-05-05  4:07   ` cberry
@ 2012-05-05  6:17     ` Bastien
  0 siblings, 0 replies; 5+ messages in thread
From: Bastien @ 2012-05-05  6:17 UTC (permalink / raw)
  To: cberry; +Cc: emacs-orgmode

Hi Charles,

cberry@tajo.ucsd.edu writes:

> It fills normal text, but leaves src blocks alone. 
>
> Maybe add something to one of the org-mode hooks ?

`org-auto-fill-function' already exists in the code, adding 
a new function with the same name would confuse things.

I patched the current `org-auto-fill-function' so that, when
̀org-src-prevent-auto-filling' is non-nil, no auto-fill happens
in src blocks.

The new option defaults to nil so that people are not surprised
when ̀auto-fill-mode' is enable and does not happen *everywhere* 
in Org buffers.

Thanks to Ken Williams for the request and to you for your 
suggestion!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-05 15:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-04 22:00 Auto-fill-mode with code sections Ken Williams
2012-05-04 20:09 ` Eric Schulte
2012-05-05  4:07   ` cberry
2012-05-05  6:17     ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2012-05-01 13:51 Ken Williams

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).