Re: newline or no newline at end of capture: expected behavior

2020-09-27 Thread Samuel Wales
well, fwiw, i am still getting empty lines for capture buffers with a
final newline and empty capture buffers.  idk if htat helps by
iutself.  recent maint [new org version] emacs 25.

On 9/27/20, Samuel Wales  wrote:
> ... but i want to know what is expected.  it sopunds like org is
> intended to produce the desired result regardless.  so i will messa
> aroud more with my settings.
>
> i am limited in comput3er use so it might take a while for me to
> produce anything liek an mwe.  but i will check a few things.
>
> On 9/27/20, Samuel Wales  wrote:
>> hi nicolas,
>>
>> thanks, that helps to know that org adds a newline.  this prevents the
>> failure mode of corrupted headers.
>>
>> just to confirm, do you mean capture /templates/ [potentially
>> verifiable by org] vs. /finalized buffers/?
>>
>> it sounds like you mean templates, because otherwise org just does
>> whatever is necessary to create desired lines?
>>
>> the user can mess with the buffer, so might leave a trailing newline
>> or not.  might copy from a file that ensures trailing newline, or one
>> that does not, etc.
>>
>> thus finalized buffers can contain anything.  or nothing.
>>
>> at present, possibly due to my own errors, without the options
>> specified explicitly, i get blank lines below the header if i finalize
>> the buffer with a trailing newline, and blank lines below the target
>> header if i capture with an empty buffer.  in maint.
>>
>>
>> On 9/27/20, Nicolas Goaziou  wrote:
>>> Hello,
>>>
>>> Samuel Wales  writes:
>>>
 thank you.  when i can, i will try explicitly setting all three to 0
 to see if that prevents the unwanted newlines, in the buffer with
 newline on last line, and empty buffer, cases.

 the docstring says empty-lines defaults to 0, which is what i want.
 it does not say what the default for after and before are.

 it /sounds/ like capture is supposed to produce the desired number
 [and position] of empty lines regardless of whether the buffer is
 empty or there is or is not a trailing newline on the final line of
 hte buffer.  is this more or less correct?
>>>
>>> I didn't read the whole thread, but a final newline is mandatory in all
>>> capture templates, independently on the number of desired blank lines.
>>> If such final newline is not provided, the capture mechanism will add
>>> one.
>>>
>>> The only exception is about empty capture templates, which are left
>>> as-is, i.e. a "final newline" is not added in that case.
>>>
>>> I don't know if that answers your question, but HTH.
>>>
>>> Regards,
>>> --
>>> Nicolas Goaziou
>>>
>>
>>
>> --
>> The Kafka Pandemic
>>
>> Please learn what misopathy is.
>> https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html
>>
>
>
> --
> The Kafka Pandemic
>
> Please learn what misopathy is.
> https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html
>


-- 
The Kafka Pandemic

Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html



Re: newline or no newline at end of capture: expected behavior

2020-09-27 Thread Samuel Wales
... but i want to know what is expected.  it sopunds like org is
intended to produce the desired result regardless.  so i will messa
aroud more with my settings.

i am limited in comput3er use so it might take a while for me to
produce anything liek an mwe.  but i will check a few things.

On 9/27/20, Samuel Wales  wrote:
> hi nicolas,
>
> thanks, that helps to know that org adds a newline.  this prevents the
> failure mode of corrupted headers.
>
> just to confirm, do you mean capture /templates/ [potentially
> verifiable by org] vs. /finalized buffers/?
>
> it sounds like you mean templates, because otherwise org just does
> whatever is necessary to create desired lines?
>
> the user can mess with the buffer, so might leave a trailing newline
> or not.  might copy from a file that ensures trailing newline, or one
> that does not, etc.
>
> thus finalized buffers can contain anything.  or nothing.
>
> at present, possibly due to my own errors, without the options
> specified explicitly, i get blank lines below the header if i finalize
> the buffer with a trailing newline, and blank lines below the target
> header if i capture with an empty buffer.  in maint.
>
>
> On 9/27/20, Nicolas Goaziou  wrote:
>> Hello,
>>
>> Samuel Wales  writes:
>>
>>> thank you.  when i can, i will try explicitly setting all three to 0
>>> to see if that prevents the unwanted newlines, in the buffer with
>>> newline on last line, and empty buffer, cases.
>>>
>>> the docstring says empty-lines defaults to 0, which is what i want.
>>> it does not say what the default for after and before are.
>>>
>>> it /sounds/ like capture is supposed to produce the desired number
>>> [and position] of empty lines regardless of whether the buffer is
>>> empty or there is or is not a trailing newline on the final line of
>>> hte buffer.  is this more or less correct?
>>
>> I didn't read the whole thread, but a final newline is mandatory in all
>> capture templates, independently on the number of desired blank lines.
>> If such final newline is not provided, the capture mechanism will add
>> one.
>>
>> The only exception is about empty capture templates, which are left
>> as-is, i.e. a "final newline" is not added in that case.
>>
>> I don't know if that answers your question, but HTH.
>>
>> Regards,
>> --
>> Nicolas Goaziou
>>
>
>
> --
> The Kafka Pandemic
>
> Please learn what misopathy is.
> https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html
>


-- 
The Kafka Pandemic

Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html



Re: newline or no newline at end of capture: expected behavior

2020-09-27 Thread Samuel Wales
hi nicolas,

thanks, that helps to know that org adds a newline.  this prevents the
failure mode of corrupted headers.

just to confirm, do you mean capture /templates/ [potentially
verifiable by org] vs. /finalized buffers/?

it sounds like you mean templates, because otherwise org just does
whatever is necessary to create desired lines?

the user can mess with the buffer, so might leave a trailing newline
or not.  might copy from a file that ensures trailing newline, or one
that does not, etc.

thus finalized buffers can contain anything.  or nothing.

at present, possibly due to my own errors, without the options
specified explicitly, i get blank lines below the header if i finalize
the buffer with a trailing newline, and blank lines below the target
header if i capture with an empty buffer.  in maint.


On 9/27/20, Nicolas Goaziou  wrote:
> Hello,
>
> Samuel Wales  writes:
>
>> thank you.  when i can, i will try explicitly setting all three to 0
>> to see if that prevents the unwanted newlines, in the buffer with
>> newline on last line, and empty buffer, cases.
>>
>> the docstring says empty-lines defaults to 0, which is what i want.
>> it does not say what the default for after and before are.
>>
>> it /sounds/ like capture is supposed to produce the desired number
>> [and position] of empty lines regardless of whether the buffer is
>> empty or there is or is not a trailing newline on the final line of
>> hte buffer.  is this more or less correct?
>
> I didn't read the whole thread, but a final newline is mandatory in all
> capture templates, independently on the number of desired blank lines.
> If such final newline is not provided, the capture mechanism will add
> one.
>
> The only exception is about empty capture templates, which are left
> as-is, i.e. a "final newline" is not added in that case.
>
> I don't know if that answers your question, but HTH.
>
> Regards,
> --
> Nicolas Goaziou
>


-- 
The Kafka Pandemic

Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html



Re: newline or no newline at end of capture: expected behavior

2020-09-27 Thread Nicolas Goaziou
Hello,

Samuel Wales  writes:

> thank you.  when i can, i will try explicitly setting all three to 0
> to see if that prevents the unwanted newlines, in the buffer with
> newline on last line, and empty buffer, cases.
>
> the docstring says empty-lines defaults to 0, which is what i want.
> it does not say what the default for after and before are.
>
> it /sounds/ like capture is supposed to produce the desired number
> [and position] of empty lines regardless of whether the buffer is
> empty or there is or is not a trailing newline on the final line of
> hte buffer.  is this more or less correct?

I didn't read the whole thread, but a final newline is mandatory in all
capture templates, independently on the number of desired blank lines.
If such final newline is not provided, the capture mechanism will add
one.

The only exception is about empty capture templates, which are left
as-is, i.e. a "final newline" is not added in that case.

I don't know if that answers your question, but HTH.

Regards,
-- 
Nicolas Goaziou



Re: newline or no newline at end of capture: expected behavior

2020-09-27 Thread Samuel Wales
hi richard,

thank you.  when i can, i will try explicitly setting all three to 0
to see if that prevents the unwanted newlines, in the buffer with
newline on last line, and empty buffer, cases.

the docstring says empty-lines defaults to 0, which is what i want.
it does not say what the default for after and before are.

it /sounds/ like capture is supposed to produce the desired number
[and position] of empty lines regardless of whether the buffer is
empty or there is or is not a trailing newline on the final line of
hte buffer.  is this more or less correct?


On 9/27/20, Richard Lawrence  wrote:
> Hi Samuel,
>
>> On 9/23/20, Samuel Wales  wrote:
>>> i have the same question for headline-only capture
>>> buffers.  i.e. what is the expected result with and without trailing
>>> newline.
>
> Just to clarify: are you aware of the :empty-lines, :empty-lines-before
> and :empty-lines-after keys that you can set in org-capture-templates?
> Are your questions about the default values of these keys?
>
> I just tried a simple setup in emacs -Q with Org 9.4, namely:
>
> (setq org-capture-templates
>   '(("s" "simple" entry (file+headline "~/org/notes.org" "Foo")
>   "* %?" :empty-lines 1)))
>
> and Org seems to correctly respect the value of these keys when they are
> specified explicitly. That is, with :empty-lines 0, no newlines are
> added; with :empty-lines 1, a blank line appears on each side of the
> captured entry; with :empty-lines-after 1, a blank line appears after,
> but not before, the new entry; and so on.
>
> Can you use these keys to get the behavior you are looking for? Or is
> your question about something else?
>
> --
> Best,
> Richard
>


-- 
The Kafka Pandemic

Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html



Re: newline or no newline at end of capture: expected behavior

2020-09-27 Thread Richard Lawrence
Hi Samuel,

> On 9/23/20, Samuel Wales  wrote:
>> i have the same question for headline-only capture
>> buffers.  i.e. what is the expected result with and without trailing
>> newline.

Just to clarify: are you aware of the :empty-lines, :empty-lines-before
and :empty-lines-after keys that you can set in org-capture-templates?
Are your questions about the default values of these keys?

I just tried a simple setup in emacs -Q with Org 9.4, namely:

(setq org-capture-templates
  '(("s" "simple" entry (file+headline "~/org/notes.org" "Foo")
  "* %?" :empty-lines 1)))

and Org seems to correctly respect the value of these keys when they are
specified explicitly. That is, with :empty-lines 0, no newlines are
added; with :empty-lines 1, a blank line appears on each side of the
captured entry; with :empty-lines-after 1, a blank line appears after,
but not before, the new entry; and so on.

Can you use these keys to get the behavior you are looking for? Or is
your question about something else?

-- 
Best,
Richard



Re: newline or no newline at end of capture: expected behavior

2020-09-26 Thread Samuel Wales
hi bastien,

another example is, whenever i capture a headline like "* test\n" and
finalize, it creates a blank line after the headline.

is it expected that users should remove the final newline in the
capture buffer, in a finalize hook, to prevent this?

it would heolp me figure out whether it is pebcak, expected, or a bug
if i know what is the expected result, and whether users are expected
to capture only capture buffers that do not have final newlines.  [bug
on empty buffer still exists.]

On 9/23/20, Samuel Wales  wrote:
> i have the same question for headline-only capture
> buffers.  i.e. what is the expected result with and without trailing
> newline.
>


-- 
The Kafka Pandemic

Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html



Re: newline or no newline at end of capture: expected behavior

2020-09-23 Thread Samuel Wales
i have the same question for headline-only capture
buffers.  i.e. what is the expected result with and without trailing
newline.



Re: newline or no newline at end of capture: expected behavior

2020-09-23 Thread Samuel Wales
i have been trying various hooks so this might not be the worst case,
but i know that finalizing a completely empty buffer will insert a
newline after the target.  that can't be worked around with hooks.


On 9/23/20, Bastien  wrote:
> Hi Samuel,
>
> Samuel Wales  writes:
>
>> basically i am getting unwanted newlines all over the place when i
>> capture.  but i want to confirm expected behavior for all 4 questions.
>
> Let's take this one by one.
>
> Can you provide the *worst* use case of Org going completely insane
> regarding empty lines after captured notes?
>
> --
>  Bastien
>


-- 
The Kafka Pandemic

Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html



Re: newline or no newline at end of capture: expected behavior

2020-09-23 Thread Bastien
Hi Samuel,

Samuel Wales  writes:

> basically i am getting unwanted newlines all over the place when i
> capture.  but i want to confirm expected behavior for all 4 questions.

Let's take this one by one.  

Can you provide the *worst* use case of Org going completely insane
regarding empty lines after captured notes?

-- 
 Bastien



Re: newline or no newline at end of capture: expected behavior

2020-09-19 Thread Samuel Wales
third question:

if you capture a completely blank capture buffer, is it supposed to
insert a blank line right after the target headline, or is it supposed
to be a no-op?  [i prefer no-op.]

fourth question:

if you capture a capture buffer with a newline, [same options].  [i
prefer no-op.]


this is the complete set of questions now.

basically i am getting unwanted newlines all over the place when i
capture.  but i want to confirm expected behavior for all 4 questions.

thank you.


On 9/19/20, Samuel Wales  wrote:
> i want to check on what is /supposed/ to occur in 9.4 maint.
>
> if i capture an entry that has a newline at the end of the last line
> in the entry, is it supposed to end the entry with a blank line?  or
> is it supposed to end the entry with the last line?  [i want last
> line.]
>
> if i capture an entry that does NOT have a newline at the end of the
> last line in the entry, is it supposed to end the entry with the last
> line?  [i want last line but i never do this deliberately.]
>
> thank you.
>
> --
> The Kafka Pandemic
>
> Please learn what misopathy is.
> https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html
>


-- 
The Kafka Pandemic

Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html



newline or no newline at end of capture: expected behavior

2020-09-19 Thread Samuel Wales
i want to check on what is /supposed/ to occur in 9.4 maint.

if i capture an entry that has a newline at the end of the last line
in the entry, is it supposed to end the entry with a blank line?  or
is it supposed to end the entry with the last line?  [i want last
line.]

if i capture an entry that does NOT have a newline at the end of the
last line in the entry, is it supposed to end the entry with the last
line?  [i want last line but i never do this deliberately.]

thank you.

-- 
The Kafka Pandemic

Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html