all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Basil L. Contovounesios" <contovob@tcd.ie>
Cc: 41571@debbugs.gnu.org
Subject: bug#41571: 27.0.91; "(elisp) Interpolated Strings" is under "(elisp) Text"
Date: Sun, 31 May 2020 19:03:55 +0300	[thread overview]
Message-ID: <831rn0ks5w.fsf@gnu.org> (raw)
In-Reply-To: <87wo4s8nj5.fsf@tcd.ie> (contovob@tcd.ie)

> From: "Basil L. Contovounesios" <contovob@tcd.ie>
> Cc: 41571@debbugs.gnu.org
> Date: Sun, 31 May 2020 10:24:46 +0100
> 
> > (Btw, why are you attachments appear before the text?  It makes
> > responding harder, because I need to bring the citations to the
> > front.)
> 
> Sorry, I got into the habit of doing that because I wasn't sure whether
> attachments should go before or after the email signature.  I'm guessing
> after?

Yes, after is better if you include text that is worded as a preamble
to the patch (which is usually the case).

> >   @defun format-spec template spec-alist &optional only-present
> >   This function returns a format string suitable for using in
> >   @code{format} and similar functions.  The format string is produced
> >   from @var{template} according to conversions specified in
> >   @var{spec-alist}, which is an alist (@pxref{Association Lists}) of
> >   the form @w{@code{(@var{letter} . @var{replacement})}}.  Each
> >   specification @code{%@var{letter}} in @var{template} will be
> >   replaced by @var{replacement} when producing the resulting format
> >   string.
> 
> This wording is much clearer, but the description of the output is
> wrong: 'format-spec' and 'format' both produce the same result - a
> formatted string, not a format string.

Well, that just reflects on how the original text could lead to a
grave misunderstanding, doesn't it? ;-)

> > Here you use "key" without first explaining what it is.
> 
> I was relying on the preceding xref to the node on alists, which defines
> the terms "alist", "key", and "associated value".

I don't recommend to rely on that, not in general.  Cross-references
are there for readers who want to see additional details, but the text
should be self-explanatory even if the cross-references are not
followed.  IOW, the cross-references are optional reading.

> > How is what's described in the last sentence "an exception"?  Format
> > strings used by 'format' also behave like that, right?
> 
> It's an exception to "beginning with % and ending with a letter".

Ah!  But the text was worded in a way that led me to believe the
exception was from the similarity between 'format' and 'format-spec'.

> Would it be clearer if I said "the only specification that does not end
> in a letter is %%, which is replaced with a single % in the output"?

Not sure.  Perhaps that sentence should simply be removed, because it
looks like the differences between these two APIs are described in the
following paragraph.  And %% is supported the same by both of them, so
mentioning it here is just a distraction.

> The main use case for format-spec I've seen is where one part of the
> program produces an alist with all the information that could ever be
> needed, and another part of the program formats an often
> user-customisable format string using this data.
> 
> An example of such a use case is in battery.el, where the alist produced
> by battery-status-function is used to format battery-echo-area-format
> and battery-mode-line-format (battery.el doesn't currently use
> format-spec, but it could and my WIP patch for master changes that).

How about saying this in the text?  In fact, "user-customizable format
string" is never mentioned in the text, it is only hinted upon in the
menu entry leading to this node.  If the main use case is to let users
customize string-valued variables conveniently, that use case should
be described and explained in more detail, including why it makes
customization more convenient.

> How's the new attached version?

It is much better, thanks.





  reply	other threads:[~2020-05-31 16:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 23:57 bug#41571: 27.0.91; "(elisp) Interpolated Strings" is under "(elisp) Text" Basil L. Contovounesios
2020-05-28  6:58 ` Eli Zaretskii
2020-05-28 10:41   ` Basil L. Contovounesios
2020-05-28 11:33     ` Eli Zaretskii
2020-05-29 18:35       ` Basil L. Contovounesios
2020-05-29 19:41         ` Eli Zaretskii
2020-05-31  9:24           ` Basil L. Contovounesios
2020-05-31 16:03             ` Eli Zaretskii [this message]
2020-06-02 14:03               ` Basil L. Contovounesios
2020-06-02 16:56                 ` Eli Zaretskii
2020-06-02 19:57                   ` Basil L. Contovounesios

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=831rn0ks5w.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=41571@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.