zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane@chazelas.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Roman Perepelitsa <roman.perepelitsa@gmail.com>,
	Zsh hackers list <zsh-workers@zsh.org>,
	Beverly Pope <countryone77@gmail.com>
Subject: Re: print -C and terminators
Date: Sun, 31 Jan 2021 09:36:05 +0000	[thread overview]
Message-ID: <20210131093605.kusgjbaezp3foxbc@chazelas.org> (raw)
In-Reply-To: <CAH+w=7ZPLDMUOSRTh1BkiRomrW04mr7pYnfSfeQ62bxY8_LmLg@mail.gmail.com>

2021-01-30 17:08:21 -0800, Bart Schaefer:
> On Sat, Jan 30, 2021 at 2:47 PM Roman Perepelitsa
> <roman.perepelitsa@gmail.com> wrote:
> >
> > I learned about it from the documentation for print:
> 
> The paragraph about the "-l" option seems like an odd place for the
> only mention of this, but the zsh doc is like that a lot.
> 
> > I don't think I ever wrote or saw code where -l is correct and -C1 is wrong.
> 
> With the exception of those doc examples, I don't think I ever saw or
> wrote code where the argument to -C was less than two (unless it was a
> variable).  Oh, well.
[...]

I have always been annoyed at that behaviour of print -rl -
outputting an empty line when not being given any argument (and
print -f '%s\n' -- has the same problem).

Until I saw someone on unix.stackexchange.com use print -rC1 --
which addresses the problem. I was the one suggesting it be more
explicitly documented at
https://www.zsh.org/mla/workers/2019/msg01202.html
Since then, I've replaced all my (broken) usages of print -rl
with print -rC1.

I agree it wouldn't harm to also clarify in the -C documentation
that nothing is output if no argument is given.

This:

~$ print -raC2 a b c | sed -n l
a  b  $
c  $

(
~$ print -rC2 a b c | sed -n l
a  c$
b$
)

could also be improved.

-- 
Stephane


  reply	other threads:[~2021-01-31  9:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d611ab66-c6f9-655f-89dc-ded8697fe0ed@eastlink.ca>
     [not found] ` <CAN=4vMp+JykOWEYQ5qO495-hOpQXh+4RN6iHcYTP-APg8XHESQ@mail.gmail.com>
     [not found]   ` <CAH+w=7bN7miEudLZcLknDQH3im=u8CCe_3GUqtEJMtyidV8bUg@mail.gmail.com>
     [not found]     ` <CAN=4vMop86hkyYMaBkF-tJaVRaN5Z28gJLqL9tSdy-uy1DNMgg@mail.gmail.com>
     [not found]       ` <0421713D-25C5-477A-90AD-C0BD2B40EED2@gmail.com>
2021-01-30 18:51         ` Bart Schaefer
2021-01-30 19:08           ` Beverly Pope
2021-01-30 22:47           ` Roman Perepelitsa
2021-01-31  1:08             ` Bart Schaefer
2021-01-31  9:36               ` Stephane Chazelas [this message]
2021-01-31 21:12                 ` Bart Schaefer

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

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

  git send-email \
    --in-reply-to=20210131093605.kusgjbaezp3foxbc@chazelas.org \
    --to=stephane@chazelas.org \
    --cc=countryone77@gmail.com \
    --cc=roman.perepelitsa@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /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.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).