emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Samuel Wales <samologist@gmail.com>
To: Samuel Wales <samologist@gmail.com>,
	Richard Lawrence <wyley.r@gmail.com>,
	emacs-orgmode@gnu.org
Subject: Re: newline or no newline at end of capture: expected behavior
Date: Sun, 27 Sep 2020 14:07:01 -0700	[thread overview]
Message-ID: <CAJcAo8sR4Qk+Hb7cYqx_6ek-KRcrfPNBdqqX-7+4V2-jH_yS1g@mail.gmail.com> (raw)
In-Reply-To: <87wo0f4i75.fsf@nicolasgoaziou.fr>

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 <mail@nicolasgoaziou.fr> wrote:
> Hello,
>
> Samuel Wales <samologist@gmail.com> 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


  reply	other threads:[~2020-09-27 21:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-20  5:29 newline or no newline at end of capture: expected behavior Samuel Wales
2020-09-20  5:36 ` Samuel Wales
2020-09-23  7:24   ` Bastien
2020-09-23 21:29     ` Samuel Wales
2020-09-23 21:30   ` Samuel Wales
2020-09-27  4:13     ` Samuel Wales
2020-09-27  7:16       ` Richard Lawrence
2020-09-27  7:42         ` Samuel Wales
2020-09-27 10:39           ` Nicolas Goaziou
2020-09-27 21:07             ` Samuel Wales [this message]
2020-09-27 21:08               ` Samuel Wales
2020-09-28  2:31                 ` Samuel Wales

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJcAo8sR4Qk+Hb7cYqx_6ek-KRcrfPNBdqqX-7+4V2-jH_yS1g@mail.gmail.com \
    --to=samologist@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=wyley.r@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).