zsh-workers
 help / color / mirror / code / Atom feed
From: Jesse Weinstein <jesse@wefu.org>
To: Bart Schaefer <schaefer@brasslantern.com>,
	zsh-workers <zsh-workers@zsh.org>
Subject: Re: 'r' history parameter documentation fix
Date: Mon, 25 Jul 2011 17:47:11 -0700	[thread overview]
Message-ID: <1311641231.25825.418.camel@zareason> (raw)
In-Reply-To: <110725013402.ZM15058@torch.brasslantern.com>

A more exact suggestion:

On Mon, 2011-07-25 at 01:34 -0700, Bart Schaefer wrote:
> On Jul 22, 11:37pm, Jesse Weinstein wrote:
> }
> } In the Modifier's section of the docs, defining the 'r' history
> } modifier, "Remove a filename extension of the form `.XXX', leaving the
> } root name." appears to be subtly wrong.
> } 
> } At least in 4.3.10.Debian, (foo=blah.flac; echo ${foo:r}) gives blah, 
> } although it should't, according to the manual, as .flac isn't of the
> } form .XXX .  
> }  
> } I think the doc should be changed to "Remove a filename extension
> } leaving the root name."
> 
> That'd be at least as wrong (except maybe less subtly) because it
> doesn't define "extension" at all.
It would be less wrong, because rather than defining extension wrongly, 
it leaves it up to the expectations of the reader, which in many cases
may be correct.

However, you convinced me to look up how the 'r' modifier is handled in
the code, so we can be strictly correct.  It's implemented by a call to
hist.c:remtext() which simply trims off the last dot in the filename,
and whatever characters follow it, i.e. ${variable%%.[^.]#} (with
EXTENDED_GLOB set).

So we could rephrase the documentation as:

"Remove a filename extension (the rightmost period and everything
following it) leaving the root name."

> I guess the question is whether anyone is really confused by what the
> doc currently says?
Currently, the doc implies behavior that differs from what the shell
does.  This is a (minor) problem whether anyone is "really confused" or
not.

Jesse


      parent reply	other threads:[~2011-07-26  0:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-23  6:37 Jesse Weinstein
2011-07-25  8:34 ` Bart Schaefer
2011-07-25 10:06   ` Štěpán Němec
2011-07-25 10:15     ` Peter Stephenson
2011-07-25 11:45       ` Štěpán Němec
2011-07-25 11:57         ` Peter Stephenson
2011-07-25 12:27           ` Štěpán Němec
2011-07-25 12:40             ` Peter Stephenson
2011-07-25 13:30               ` Manuel Presnitz
2011-07-25 13:32               ` Štěpán Němec
2011-07-25 13:41               ` Benjamin R. Haskell
2011-07-25 13:47                 ` Peter Stephenson
2011-07-26  0:47   ` Jesse Weinstein [this message]

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=1311641231.25825.418.camel@zareason \
    --to=jesse@wefu.org \
    --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).