update packages and add valign
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; cond-let.el --- Additional and improved binding conditionals -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 2025 Jonas Bernoulli
|
||||
;; Copyright (C) 2025-2026 Jonas Bernoulli
|
||||
|
||||
;; May contain traces of Emacs, which is
|
||||
;; Copyright (C) 1985-2025 Free Software Foundation, Inc.
|
||||
@@ -9,8 +9,8 @@
|
||||
;; Homepage: https://github.com/tarsius/cond-let
|
||||
;; Keywords: extensions
|
||||
|
||||
;; Package-Version: 20251101.1942
|
||||
;; Package-Revision: 288b7d365632
|
||||
;; Package-Version: 20260201.1500
|
||||
;; Package-Revision: 8bf87d45e169
|
||||
;; Package-Requires: ((emacs "28.1"))
|
||||
|
||||
;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
@@ -30,14 +30,16 @@
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This is an ALPHA release!
|
||||
;; Breaking changes are possible!
|
||||
;; This is a BETA release!
|
||||
;; Breaking changes are unlikely but still possible!
|
||||
;; See https://github.com/tarsius/cond-let/wiki.
|
||||
|
||||
;; Emacs provides the binding conditionals `if-let', `if-let*',
|
||||
;; `when-let', `when-let*', `and-let*' and `while-let'.
|
||||
|
||||
;; This package implements the missing `and-let' and `while-let*',
|
||||
;; and the original `cond-let', `cond-let*', `and$' and `and>'.
|
||||
;; and the original `cond-let', `cond-let*', `when$', `and$' and
|
||||
;; `and>'.
|
||||
|
||||
;; This package additionally provides more consistent and improved
|
||||
;; implementations of the binding conditionals already provided by
|
||||
@@ -61,6 +63,7 @@
|
||||
;; ("and>" . "cond-let--and>")
|
||||
;; ("and-let" . "cond-let--and-let")
|
||||
;; ("if-let" . "cond-let--if-let")
|
||||
;; ("when$" . "cond-let--when$")
|
||||
;; ("when-let" . "cond-let--when-let")
|
||||
;; ("while-let" . "cond-let--while-let"))
|
||||
;; End:
|
||||
@@ -73,8 +76,8 @@
|
||||
;; Due to limitations of the shorthand implementation this has to be
|
||||
;; done for each individual library. "dir-locals.el" cannot be used.
|
||||
|
||||
;; If you use `and$' and `and>', you might want to add this to your
|
||||
;; configuration:
|
||||
;; If you use `when$', `and$' and `and>', you might want to add this
|
||||
;; to your configuration:
|
||||
|
||||
;; (with-eval-after-load 'cond-let
|
||||
;; (font-lock-add-keywords 'emacs-lisp-mode
|
||||
@@ -93,38 +96,38 @@
|
||||
(let (body)
|
||||
(dolist (clause (nreverse clauses))
|
||||
(cond
|
||||
((vectorp clause)
|
||||
(setq body
|
||||
`((,(if (and sequential (length> clause 1)) 'let* 'let)
|
||||
,(mapcar (lambda (vec) (append vec nil)) clause)
|
||||
,@body))))
|
||||
((let (varlist)
|
||||
(while (vectorp (car clause))
|
||||
(push (append (pop clause) nil) varlist))
|
||||
(push (cond
|
||||
(varlist
|
||||
`(,(pcase (list (and body t)
|
||||
(and sequential (length> varlist 1)))
|
||||
('(t t ) 'cond-let--when-let*)
|
||||
(`(t ,_) 'cond-let--when-let)
|
||||
('(nil t ) 'cond-let--and-let*)
|
||||
(`(nil ,_) 'cond-let--and-let))
|
||||
,(nreverse varlist)
|
||||
,(if body
|
||||
`(throw ',tag ,(macroexp-progn clause))
|
||||
(macroexp-progn clause))))
|
||||
((length= clause 1)
|
||||
(if body
|
||||
(let ((a (gensym "anon")))
|
||||
`(let ((,a ,(car clause)))
|
||||
(when ,a (throw ',tag ,a))))
|
||||
(car clause)))
|
||||
((and (eq (car clause) t) (not body))
|
||||
(macroexp-progn (cdr clause)))
|
||||
(t
|
||||
`(when ,(pop clause)
|
||||
(throw ',tag ,(macroexp-progn clause)))))
|
||||
body)))))
|
||||
((vectorp clause)
|
||||
(setq body
|
||||
`((,(if (and sequential (length> clause 1)) 'let* 'let)
|
||||
,(mapcar (lambda (vec) (append vec nil)) clause)
|
||||
,@body))))
|
||||
((let (varlist)
|
||||
(while (vectorp (car clause))
|
||||
(push (append (pop clause) nil) varlist))
|
||||
(push (cond
|
||||
(varlist
|
||||
`(,(pcase (list (and body t)
|
||||
(and sequential (length> varlist 1)))
|
||||
('(t t ) 'cond-let--when-let*)
|
||||
(`(t ,_) 'cond-let--when-let)
|
||||
('(nil t ) 'cond-let--and-let*)
|
||||
(`(nil ,_) 'cond-let--and-let))
|
||||
,(nreverse varlist)
|
||||
,(if body
|
||||
`(throw ',tag ,(macroexp-progn clause))
|
||||
(macroexp-progn clause))))
|
||||
((length= clause 1)
|
||||
(if body
|
||||
(let ((a (gensym "anon")))
|
||||
`(let ((,a ,(car clause)))
|
||||
(when ,a (throw ',tag ,a))))
|
||||
(car clause)))
|
||||
((and (eq (car clause) t) (not body))
|
||||
(macroexp-progn (cdr clause)))
|
||||
(t
|
||||
`(when ,(pop clause)
|
||||
(throw ',tag ,(macroexp-progn clause)))))
|
||||
body)))))
|
||||
body))
|
||||
|
||||
(defmacro cond-let* (&rest clauses)
|
||||
@@ -452,7 +455,7 @@ BODY must be one or more expressions. If VARLIST is empty, do nothing
|
||||
and return nil.
|
||||
|
||||
\(fn VARLIST BODY...)"
|
||||
(declare (debug (form form)))
|
||||
(declare (indent 1) (debug (form form)))
|
||||
`(let (($ ,varform))
|
||||
(when $
|
||||
,bodyform ,@body)))
|
||||
|
||||
Reference in New Issue
Block a user