emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* c-c ' strips final newline or adds blank line, but never neither
@ 2014-07-24 22:48 Samuel Wales
  2014-07-25  8:01 ` Thorsten Jolitz
  2014-07-27 11:50 ` Bastien
  0 siblings, 2 replies; 7+ messages in thread
From: Samuel Wales @ 2014-07-24 22:48 UTC (permalink / raw)
  To: emacs-orgmode

i find that when i do c-c ' on a source block, it either strips the
final newline in the editing buffer or adds an unwanted blank line in
the source block.

i like to have final newlines in all of my buffers, including editing
buffers.  what setting allows this without introducing a blank line at
the end of a source block?

thanks.

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

* Re: c-c ' strips final newline or adds blank line, but never neither
  2014-07-24 22:48 c-c ' strips final newline or adds blank line, but never neither Samuel Wales
@ 2014-07-25  8:01 ` Thorsten Jolitz
  2014-07-25 22:45   ` Samuel Wales
  2014-07-25 22:47   ` Samuel Wales
  2014-07-27 11:50 ` Bastien
  1 sibling, 2 replies; 7+ messages in thread
From: Thorsten Jolitz @ 2014-07-25  8:01 UTC (permalink / raw)
  To: emacs-orgmode

Samuel Wales <samologist@gmail.com> writes:

> i find that when i do c-c ' on a source block, it either strips the
> final newline in the editing buffer or adds an unwanted blank line in
> the source block.
>
> i like to have final newlines in all of my buffers, including editing
> buffers.  what setting allows this without introducing a blank line at
> the end of a source block?

,----[ C-h v org-src-strip-leading-and-trailing-blank-lines RET ]
| org-src-strip-leading-and-trailing-blank-lines is a variable defined
| in `org-src.el'.  Its value is nil
| 
| Documentation:
| If non-nil, blank lines are removed when exiting the code edit buffer.
`----

-- 
cheers,
Thorsten

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

* Re: c-c ' strips final newline or adds blank line, but never neither
  2014-07-25  8:01 ` Thorsten Jolitz
@ 2014-07-25 22:45   ` Samuel Wales
  2014-07-26 10:23     ` Thorsten Jolitz
  2014-07-25 22:47   ` Samuel Wales
  1 sibling, 1 reply; 7+ messages in thread
From: Samuel Wales @ 2014-07-25 22:45 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

hi thorsten,

did you try it?

samuel


On 7/25/14, Thorsten Jolitz <tjolitz@gmail.com> wrote:
> Samuel Wales <samologist@gmail.com> writes:
>
>> i find that when i do c-c ' on a source block, it either strips the
>> final newline in the editing buffer or adds an unwanted blank line in
>> the source block.
>>
>> i like to have final newlines in all of my buffers, including editing
>> buffers.  what setting allows this without introducing a blank line at
>> the end of a source block?
>
> ,----[ C-h v org-src-strip-leading-and-trailing-blank-lines RET ]
> | org-src-strip-leading-and-trailing-blank-lines is a variable defined
> | in `org-src.el'.  Its value is nil
> |
> | Documentation:
> | If non-nil, blank lines are removed when exiting the code edit buffer.
> `----
>
> --
> cheers,
> Thorsten
>
>
>


-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  And
ANYBODY can get it.

Denmark: free Karina Hansen NOW.

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

* Re: c-c ' strips final newline or adds blank line, but never neither
  2014-07-25  8:01 ` Thorsten Jolitz
  2014-07-25 22:45   ` Samuel Wales
@ 2014-07-25 22:47   ` Samuel Wales
  1 sibling, 0 replies; 7+ messages in thread
From: Samuel Wales @ 2014-07-25 22:47 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

[this is why i mentioned the blank lines.  both settings of this
variable fail.  one adds blank lines and the other removes the final
newline.]

On 7/25/14, Thorsten Jolitz <tjolitz@gmail.com> wrote:
> ,----[ C-h v org-src-strip-leading-and-trailing-blank-lines RET ]

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

* Re: c-c ' strips final newline or adds blank line, but never neither
  2014-07-25 22:45   ` Samuel Wales
@ 2014-07-26 10:23     ` Thorsten Jolitz
  2014-07-26 21:54       ` Samuel Wales
  0 siblings, 1 reply; 7+ messages in thread
From: Thorsten Jolitz @ 2014-07-26 10:23 UTC (permalink / raw)
  To: emacs-orgmode

Samuel Wales <samologist@gmail.com> writes:

hi Samuel,

> did you try it?

no, that was just a hint.

But I know what you are talking about, since I had these problems with
Outorg too - whitespace changes in the conversion process between
programming language mode and org-mode although no editing at all took
place. 

The following chain of actions should not change the original (say
emacs-lisp) buffer:

1. M-# # (outorg-edit-as-org) in emacs-lisp buffer 

2. 2x C-c ' on emacs-lisp src-block

3. M-# in *outorg-edit-buffer*

since only 4 conversions but no editing at all took place. But depending
on your config (or the org defaults) and maybe org/outorg bugs
indentation and newlines might have been added removed.

In outorg I have e.g.

,----
| outorg-remove-trailing-blank-lines
| outorg-unindent-active-source-blocks
`----

to deal with this issue. IIRC I always first remove all
trailing-blank-lines, and then add one.

Isn't that even an 'upstream' issue? It seems Emacs itself inserts
trailing blank lines in buffers if they are missing, at least I had to deal
with this in the outorg conversion process.

I vaguley remember having read something about 'by default every buffer
should end with a trailing blank line, and this is enforced by Emacs',
but could not find any info about this nor related config vars.

> On 7/25/14, Thorsten Jolitz <tjolitz@gmail.com> wrote:
>> Samuel Wales <samologist@gmail.com> writes:
>>
>>> i find that when i do c-c ' on a source block, it either strips the
>>> final newline in the editing buffer or adds an unwanted blank line in
>>> the source block.
>>>
>>> i like to have final newlines in all of my buffers, including editing
>>> buffers.  what setting allows this without introducing a blank line at
>>> the end of a source block?
>>
>> ,----[ C-h v org-src-strip-leading-and-trailing-blank-lines RET ]
>> | org-src-strip-leading-and-trailing-blank-lines is a variable defined
>> | in `org-src.el'.  Its value is nil
>> |
>> | Documentation:
>> | If non-nil, blank lines are removed when exiting the code edit buffer.
>> `----
>>
>> --
>> cheers,
>> Thorsten
>>
>>
>>

-- 
cheers,
Thorsten

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

* Re: c-c ' strips final newline or adds blank line, but never neither
  2014-07-26 10:23     ` Thorsten Jolitz
@ 2014-07-26 21:54       ` Samuel Wales
  0 siblings, 0 replies; 7+ messages in thread
From: Samuel Wales @ 2014-07-26 21:54 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

On 7/26/14, Thorsten Jolitz <tjolitz@gmail.com> wrote:
>> did you try it?
>
> no, that was just a hint.

if you try it you will understand that it is broken.

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

* Re: c-c ' strips final newline or adds blank line, but never neither
  2014-07-24 22:48 c-c ' strips final newline or adds blank line, but never neither Samuel Wales
  2014-07-25  8:01 ` Thorsten Jolitz
@ 2014-07-27 11:50 ` Bastien
  1 sibling, 0 replies; 7+ messages in thread
From: Bastien @ 2014-07-27 11:50 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs-orgmode

Hi Samuel,

Samuel Wales <samologist@gmail.com> writes:

> i find that when i do c-c ' on a source block, it either strips the
> final newline in the editing buffer or adds an unwanted blank line in
> the source block.

I can't reproduce this.

With (setq org-src-strip-leading-and-trailing-blank-lines nil) there
is no change in the number of trailing newlines.

With (setq org-src-strip-leading-and-trailing-blank-lines t), blank
lines at the beginning and end of an *Org Src* editing buffer are
stripped away.

This is Org-mode version 8.3beta (release_8.3beta-74-g16e21a).

Hopefully someone can provide a reproducible recipe.

Thanks,

-- 
 Bastien

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

end of thread, other threads:[~2014-07-28 17:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-24 22:48 c-c ' strips final newline or adds blank line, but never neither Samuel Wales
2014-07-25  8:01 ` Thorsten Jolitz
2014-07-25 22:45   ` Samuel Wales
2014-07-26 10:23     ` Thorsten Jolitz
2014-07-26 21:54       ` Samuel Wales
2014-07-25 22:47   ` Samuel Wales
2014-07-27 11:50 ` Bastien

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