5

Since Emacs 26, the underscore (or any variable symbol in general) can be omitted: if-let is a Lisp macro in `subr-x.el'. (if-let SPEC THEN &rest ELSE) Probably introduced at or before Emacs version 25.1. Bind variables according to SPEC and evaluate THEN or ELSE. Evaluate each binding in turn, as in `let*', stopping if a binding value is nil. If ...


3

Apologies for not helpfully answering the question posed, but hoping this might help anyway... Instead of something "similar to the first", I'd likely use something that (I think) is simpler than either of them. Your first example macro-"expands" to code that I think is clearer, than either of your examples: (macroexpand '(if-let* ((foo (...


2

I think this is what you want: (let ((flag1 nil) (flag2 nil)) (cl-loop if flag1 if flag2 return 1 else return 0 else return 2)) if flag1 is nil, you get 2 if flag1 is t, and flag2 is nil you get 0 if flag1 is t, and flag2 is t you get 1 Or to replicate the original pseudo code (complete with its infinite loop scenario): (cl-loop if ...


1

The backquote pcase pattern `--pcase-macroexpander is implemented using pcase-defmacro in the library pcase.el . There is no pattern included there that does what you discussed. But, it may be added as shown in the following Elisp code that defines an alternative pcase pattern bq-opt. The added lines are cleanly added as one block. This block is framed by ...


Only top voted, non community-wiki answers of a minimum length are eligible