help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

`when-let' (was: Re: My read-buffer-function doesn't work when called by


From: Emanuel Berg
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
User-agent: Gnus/5.13 (Gnus v5.13)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]