From: Jean Louis <bugs@gnu.support>
To: help-gnu-emacs@gnu.org
Subject: [SOLVED] Re: Need `format' with position numbers
Date: Fri, 16 Sep 2022 09:09:55 +0300 [thread overview]
Message-ID: <YyQTM6DT1efrRggK@protected.localdomain> (raw)
In-Reply-To: <courier.000000006323AE0B.00000EE7@stw1.rcdrun.com>
* Jean Louis <bugs@gnu.support> [2022-09-16 02:00]:
> In Lisp and the command `format' does not have positioning number,
> order of arguments is static:
>
> (format "%s %s %s" name link description)
>
> and I would like to have positioning such as in PostgreSQL:
>
> "WHERE link = $2 AND name = $1" name link
>
> This is because arbitrary formats for command `format' may come in the
> system I am building, it is not predictable how users would like to
> place name, link, description in various markup languages.
>
> Maybe there exists different `format' command that uses position
> numbers in some package?
I have solved it by using my package:
RCD Template Interpolation System for Emacs:
https://hyperscope.link/3/7/1/3/3/RCD-Template-Interpolation-System-for-Emacs.html
Like this:
(defun wrs-markup-type-link (id link &optional name description)
"Return LINK formatted by markup type ID.
Optional NAME and DESCRIPTION."
(let ((format (rcd-db-table-markuptypes-link-format id)))
(rcd-dlet ((rcd::name name)
(rcd::link link)
(rcd::description description))
(rcd-template-eval format))))
and by having `format' as template, something like this:
⟦ (cond (rcd::description (format "[%s](%s \"%s\") - %s" rcd::name rcd::link rcd::name rcd::description))
(rcd::name (format "[%s](%s \"%s\")" rcd::name rcd::link rcd::name))
(t (format "<%s>" rcd::link))) ⟧
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
prev parent reply other threads:[~2022-09-16 6:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-15 22:57 Need `format' with position numbers Jean Louis
2022-09-16 6:09 ` Jean Louis [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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YyQTM6DT1efrRggK@protected.localdomain \
--to=bugs@gnu.support \
--cc=help-gnu-emacs@gnu.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.
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).