From: Emanuel Berg <incal@dataswamp.org>
To: help-gnu-emacs@gnu.org
Subject: `when-let' (was: Re: My read-buffer-function doesn't work when called by switch-to-buffer)
Date: Sat, 11 Mar 2023 21:40:12 +0100 [thread overview]
Message-ID: <87pm9fkonn.fsf_-_@dataswamp.org> (raw)
In-Reply-To: 87fsabslcj.fsf@gnu.org
Tassilo Horn wrote:
> (when-let ((result (completing-read [...] ))))
`when-let' is so cool!
I didn't use it once. But I used `let' 457 times, and `when'
161 times.
So what about this
(setq initial-scratch-message nil)
(when-let ((buf (get-buffer "*scratch*")))
(kill-buffer buf) )
?
There is also `if-let'. But no "unless-let". Yeah, like if all
of these are nil, then do something with them ...
There are also the sequential/non-"parallel"/self-refering
`when-let*' and `if-let*'!
Actually, there are
and-let*
cl--loop-let
if-let[*]
macroexp-let*
macroexp-let2[*]
map-let
named-let
pcase-let[*]
rx-let
seq-let
when-let[*]
while-let
and more!
I have 6 `pcase-let' and 1 `pcase-let*' and - now -
1 `when-let'.
Yeah - it's not a lot :(
--
underground experts united
https://dataswamp.org/~incal
next prev parent reply other threads:[~2023-03-11 20:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 21:10 My read-buffer-function doesn't work when called by switch-to-buffer Tassilo Horn
2023-03-11 0:32 ` Michael Heerdegen
2023-03-11 8:58 ` Tassilo Horn
2023-03-11 20:40 ` Emanuel Berg [this message]
2023-03-12 3:32 ` Michael Heerdegen
2023-03-12 18:51 ` Tassilo Horn
2023-03-13 0:32 ` Michael Heerdegen
2023-03-15 9:06 ` Tassilo Horn
2023-03-15 18:57 ` Michael Heerdegen
2023-03-16 9:18 ` Tassilo Horn
2023-03-16 16:59 ` Tassilo Horn
2023-03-16 23:46 ` Michael Heerdegen
2023-03-17 7:04 ` Tassilo Horn
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=87pm9fkonn.fsf_-_@dataswamp.org \
--to=incal@dataswamp.org \
--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).