unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19975: 25.0.50; Add %s-like descriptor to `format' that treats nil like empty string
@ 2015-03-01 15:32 Drew Adams
  2015-03-01 15:37 ` Drew Adams
  2015-03-01 16:44 ` Andreas Schwab
  0 siblings, 2 replies; 6+ messages in thread
From: Drew Adams @ 2015-03-01 15:32 UTC (permalink / raw)
  To: 19975

Enhancement request.  Add a new format descriptor to `format' that would
behave just like %s except that a nil argument would be treated as if it
were "".

This is a convenience only, to obviate needing to pass an argument such
as `(if something "foobar" "")' or needing to combine use of `format'
with use of `concat'.

In GNU Emacs 25.0.50.1 (i686-pc-mingw32)
 of 2014-10-20 on LEG570
Bzr revision: 118168 rgm@gnu.org-20141020195941-icp42t8ttcnud09g
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --enable-checking=yes,glyphs CPPFLAGS=-DGLYPH_DEBUG=1'





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#19975: 25.0.50; Add %s-like descriptor to `format' that treats nil like empty string
  2015-03-01 15:32 bug#19975: 25.0.50; Add %s-like descriptor to `format' that treats nil like empty string Drew Adams
@ 2015-03-01 15:37 ` Drew Adams
  2015-03-01 16:44 ` Andreas Schwab
  1 sibling, 0 replies; 6+ messages in thread
From: Drew Adams @ 2015-03-01 15:37 UTC (permalink / raw)
  To: 19975

FYI, this request was inspired by this emacs.stackexchange
question: http://emacs.stackexchange.com/q/9698/105.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#19975: 25.0.50; Add %s-like descriptor to `format' that treats nil like empty string
  2015-03-01 15:32 bug#19975: 25.0.50; Add %s-like descriptor to `format' that treats nil like empty string Drew Adams
  2015-03-01 15:37 ` Drew Adams
@ 2015-03-01 16:44 ` Andreas Schwab
  2015-03-02  7:07   ` Drew Adams
  2016-04-30 17:10   ` Lars Ingebrigtsen
  1 sibling, 2 replies; 6+ messages in thread
From: Andreas Schwab @ 2015-03-01 16:44 UTC (permalink / raw)
  To: Drew Adams; +Cc: 19975

Drew Adams <drew.adams@oracle.com> writes:

> Enhancement request.  Add a new format descriptor to `format' that would
> behave just like %s except that a nil argument would be treated as if it
> were "".

It's easy enough to use (or foo "").

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#19975: 25.0.50; Add %s-like descriptor to `format' that treats nil like empty string
  2015-03-01 16:44 ` Andreas Schwab
@ 2015-03-02  7:07   ` Drew Adams
  2015-03-02  8:52     ` Andreas Schwab
  2016-04-30 17:10   ` Lars Ingebrigtsen
  1 sibling, 1 reply; 6+ messages in thread
From: Drew Adams @ 2015-03-02  7:07 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 19975

> > Enhancement request.  Add a new format descriptor to `format' that would
> > behave just like %s except that a nil argument would be treated as if it
> > were "".
> 
> It's easy enough to use (or foo "").

Yes of course "it's easy enough".  That's what we've all been
doing for decades.  It would be even clearer and simpler still
to have a format descriptor for this common use case.

That is what this enhancement request is about - not needing to
write such "easy enough" code.

And of course it is not always (or foo "").
It might well be (if foo "whatever" "").  Or if you prefer,
(let ((bar "whatever")) (or (and foo bar) "")).





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#19975: 25.0.50; Add %s-like descriptor to `format' that treats nil like empty string
  2015-03-02  7:07   ` Drew Adams
@ 2015-03-02  8:52     ` Andreas Schwab
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2015-03-02  8:52 UTC (permalink / raw)
  To: Drew Adams; +Cc: 19975

Drew Adams <drew.adams@oracle.com> writes:

> And of course it is not always (or foo "").
> It might well be (if foo "whatever" "").  Or if you prefer,
> (let ((bar "whatever")) (or (and foo bar) "")).

You can write arbitrary complicated expressions that compute (or foo
"").  What's your point?

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#19975: 25.0.50; Add %s-like descriptor to `format' that treats nil like empty string
  2015-03-01 16:44 ` Andreas Schwab
  2015-03-02  7:07   ` Drew Adams
@ 2016-04-30 17:10   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2016-04-30 17:10 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 19975

Andreas Schwab <schwab@linux-m68k.org> writes:

> Drew Adams <drew.adams@oracle.com> writes:
>
>> Enhancement request.  Add a new format descriptor to `format' that would
>> behave just like %s except that a nil argument would be treated as if it
>> were "".
>
> It's easy enough to use (or foo "").

Yes, I don't think that we want to clutter up the `format' language with
something as special as this.  Closing.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-04-30 17:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-01 15:32 bug#19975: 25.0.50; Add %s-like descriptor to `format' that treats nil like empty string Drew Adams
2015-03-01 15:37 ` Drew Adams
2015-03-01 16:44 ` Andreas Schwab
2015-03-02  7:07   ` Drew Adams
2015-03-02  8:52     ` Andreas Schwab
2016-04-30 17:10   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).