From ec612bd3baaf02ebe24793177495526ffd3c9e87 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sun, 26 Apr 2026 19:57:27 +0200 Subject: [PATCH] update llama --- .../.dir-locals.el | 2 + elpa/llama-20260301.1253/README-elpa | 56 ++++ .../llama-autoloads.el | 12 +- .../llama-pkg.el | 6 +- .../llama.el | 271 +++++++++--------- 5 files changed, 204 insertions(+), 143 deletions(-) rename elpa/{llama-20250901.1544 => llama-20260301.1253}/.dir-locals.el (64%) create mode 100644 elpa/llama-20260301.1253/README-elpa rename elpa/{llama-20250901.1544 => llama-20260301.1253}/llama-autoloads.el (92%) rename elpa/{llama-20250901.1544 => llama-20260301.1253}/llama-pkg.el (62%) rename elpa/{llama-20250901.1544 => llama-20260301.1253}/llama.el (73%) diff --git a/elpa/llama-20250901.1544/.dir-locals.el b/elpa/llama-20260301.1253/.dir-locals.el similarity index 64% rename from elpa/llama-20250901.1544/.dir-locals.el rename to elpa/llama-20260301.1253/.dir-locals.el index 7c6424f0..f1fff942 100644 --- a/elpa/llama-20250901.1544/.dir-locals.el +++ b/elpa/llama-20260301.1253/.dir-locals.el @@ -1,5 +1,7 @@ ((nil (indent-tabs-mode . nil)) + (emacs-lisp-mode + (lisp-indent-local-overrides . ((cond . 0) (interactive . 0)))) (makefile-mode (indent-tabs-mode . t)) (git-commit-mode diff --git a/elpa/llama-20260301.1253/README-elpa b/elpa/llama-20260301.1253/README-elpa new file mode 100644 index 00000000..ba465ee8 --- /dev/null +++ b/elpa/llama-20260301.1253/README-elpa @@ -0,0 +1,56 @@ +This package implements a macro named `##', which provides a compact way +to write short `lambda' expressions. + +The signature of the macro is (## FN &rest BODY) and it expands to a +`lambda' expression, which calls the function FN with the arguments BODY +and returns the value of that. The arguments of the `lambda' expression +are derived from symbols found in BODY. + +Each symbol from `%1' through `%9', which appears in an unquoted part +of BODY, specifies a mandatory argument. Each symbol from `&1' through +`&9', which appears in an unquoted part of BODY, specifies an optional +argument. The symbol `&*' specifies extra (`&rest') arguments. + +The shorter symbol `%' can be used instead of `%1', but using both in +the same expression is not allowed. Likewise `&' can be used instead +of `&1'. These shorthands are not recognized in function position. + +To support binding forms that use a vector as VARLIST (such as `-let' +from the `dash' package), argument symbols are also detected inside of +vectors. + +The space between `##' and FN can be omitted because `##' is read-syntax +for the symbol whose name is the empty string. If you prefer you can +place a space there anyway, and if you prefer to not use this somewhat +magical symbol at all, you can instead use the alternative name `llama'. + +Instead of: + + (lambda (a &optional _ c &rest d) + (foo a (bar c) d)) + +you can use this macro and write: + + (##foo %1 (bar &3) &*) + +which expands to: + + (lambda (%1 &optional _&2 &3 &rest &*) + (foo %1 (bar &3) &*)) + +Unused trailing arguments and mandatory unused arguments at the border +between mandatory and optional arguments are also supported: + + (##list %1 _%3 &5 _&6) + +becomes: + + (lambda (%1 _%2 _%3 &optional _&4 &5 _&6) + (list %1 &5)) + +Note how `_%3' and `_&6' are removed from the body, because their names +begin with an underscore. Also note that `_&4' is optional, unlike the +explicitly specified `_%3'. + +Consider enabling `llama-fontify-mode' to highlight `##' and its +special arguments. diff --git a/elpa/llama-20250901.1544/llama-autoloads.el b/elpa/llama-20260301.1253/llama-autoloads.el similarity index 92% rename from elpa/llama-20250901.1544/llama-autoloads.el rename to elpa/llama-20260301.1253/llama-autoloads.el index 49443cc4..c0e1d335 100644 --- a/elpa/llama-20250901.1544/llama-autoloads.el +++ b/elpa/llama-20260301.1253/llama-autoloads.el @@ -11,8 +11,8 @@ ;;; Generated autoloads from llama.el -(autoload 'llama "llama" "\ -Expand to a `lambda' expression that wraps around FN and BODY. +(autoload 'llama "llama" +"Expand to a `lambda' expression that wraps around FN and BODY. This macro provides a compact way to write short `lambda' expressions. It expands to a `lambda' expression, which calls the function FN with @@ -69,16 +69,16 @@ Consider enabling `llama-fontify-mode' to highlight `##' and its special arguments. (fn FN &rest BODY)" nil t) -(defvar llama-fontify-mode nil "\ -Non-nil if Llama-Fontify mode is enabled. +(defvar llama-fontify-mode nil +"Non-nil if Llama-Fontify mode is enabled. See the `llama-fontify-mode' command for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') or call the function `llama-fontify-mode'.") (custom-autoload 'llama-fontify-mode "llama" nil) -(autoload 'llama-fontify-mode "llama" "\ -In Emacs Lisp mode, highlight the `##' macro and its special arguments. +(autoload 'llama-fontify-mode "llama" +"In Emacs Lisp mode, highlight the `##' macro and its special arguments. This is a global minor mode. If called interactively, toggle the `Llama-Fontify mode' mode. If the prefix argument is positive, enable diff --git a/elpa/llama-20250901.1544/llama-pkg.el b/elpa/llama-20260301.1253/llama-pkg.el similarity index 62% rename from elpa/llama-20250901.1544/llama-pkg.el rename to elpa/llama-20260301.1253/llama-pkg.el index 61330fed..5734b973 100644 --- a/elpa/llama-20250901.1544/llama-pkg.el +++ b/elpa/llama-20260301.1253/llama-pkg.el @@ -1,9 +1,9 @@ ;; -*- no-byte-compile: t; lexical-binding: nil -*- -(define-package "llama" "20250901.1544" +(define-package "llama" "20260301.1253" "Compact syntax for short lambda." '((emacs "26.1") (compat "30.1")) :url "https://github.com/tarsius/llama" - :commit "ec1d4ef02f5572fc5aff3f62d3e7ef791f444456" - :revdesc "ec1d4ef02f55" + :commit "d430d48e0b5afd2a34b5531f103dcb110c3539c4" + :revdesc "d430d48e0b5a" :keywords '("extensions")) diff --git a/elpa/llama-20250901.1544/llama.el b/elpa/llama-20260301.1253/llama.el similarity index 73% rename from elpa/llama-20250901.1544/llama.el rename to elpa/llama-20260301.1253/llama.el index 28151245..18c6cb33 100644 --- a/elpa/llama-20250901.1544/llama.el +++ b/elpa/llama-20260301.1253/llama.el @@ -1,14 +1,16 @@ ;;; llama.el --- Compact syntax for short lambda -*- lexical-binding:t -*- -;; Copyright (C) 2020-2025 Jonas Bernoulli +;; Copyright (C) 2020-2026 Jonas Bernoulli ;; Authors: Jonas Bernoulli ;; Homepage: https://github.com/tarsius/llama ;; Keywords: extensions -;; Package-Version: 20250901.1544 -;; Package-Revision: ec1d4ef02f55 -;; Package-Requires: ((emacs "26.1") (compat "30.1")) +;; Package-Version: 20260301.1253 +;; Package-Revision: d430d48e0b5a +;; Package-Requires: ( +;; (emacs "26.1") +;; (compat "30.1")) ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -173,14 +175,14 @@ special arguments." (args (mapcar (lambda (symbol) (cond - ((string-match-p "\\`_?%" (symbol-name symbol)) - (when opt - (error "`%s' cannot follow optional arguments" symbol)) - (list symbol)) - (opt - (list symbol)) - ((setq opt t) - (list '&optional symbol)))) + ((string-match-p "\\`_?%" (symbol-name symbol)) + (when opt + (error "`%s' cannot follow optional arguments" symbol)) + (list symbol)) + (opt + (list symbol)) + ((setq opt t) + (list '&optional symbol)))) (nreverse args)))) `(lambda (,@(apply #'nconc args) @@ -194,61 +196,61 @@ special arguments." (defun llama--collect (expr args &optional fnpos backquoted unquote) (cond - ((memq (car-safe expr) (list (intern "") 'llama 'quote)) expr) - ((and backquoted (symbolp expr)) expr) - ((and backquoted - (memq (car-safe expr) - (list backquote-unquote-symbol - backquote-splice-symbol))) - (list (car expr) - (llama--collect (cadr expr) args nil nil t))) - ((memq (car-safe expr) - (list backquote-backquote-symbol - backquote-splice-symbol)) - (list (car expr) - (llama--collect (cadr expr) args nil t))) - ((symbolp expr) - (let ((name (symbol-name expr))) - (save-match-data - (cond - ((string-match "\\`\\(_\\)?[%&]\\([1-9*]\\)?\\'" name) - (let* ((pos (match-string 2 name)) - (pos (cond ((equal pos "*") 0) - ((not pos) 1) - ((string-to-number pos)))) - (sym (aref args pos))) - (unless (and fnpos (not unquote) (memq expr '(% &))) - (when (and sym (not (equal expr sym))) - (error "`%s' and `%s' are mutually exclusive" sym expr)) - (aset args pos expr))) - (if (match-string 1 name) - llama--unused-argument - expr)) - (expr))))) - ((or (listp expr) - (vectorp expr)) - (let* ((vectorp (vectorp expr)) - (expr (if vectorp (append expr ()) expr)) - (fnpos (and (not vectorp) - (not backquoted) - (ignore-errors (length expr)))) ;proper-list-p - (ret ())) - (catch t - (while t - (let ((elt (llama--collect (car expr) args fnpos backquoted))) - (unless (eq elt llama--unused-argument) - (push elt ret))) - (setq fnpos nil) - (setq expr (cdr expr)) - (unless (and expr - (listp expr) - (not (eq (car expr) backquote-unquote-symbol))) - (throw t nil)))) - (setq ret (nreverse ret)) - (when expr - (setcdr (last ret) (llama--collect expr args nil backquoted))) - (if vectorp (vconcat ret) ret))) - (expr))) + ((memq (car-safe expr) (list (intern "") 'llama 'quote)) expr) + ((and backquoted (symbolp expr)) expr) + ((and backquoted + (memq (car-safe expr) + (list backquote-unquote-symbol + backquote-splice-symbol))) + (list (car expr) + (llama--collect (cadr expr) args nil nil t))) + ((memq (car-safe expr) + (list backquote-backquote-symbol + backquote-splice-symbol)) + (list (car expr) + (llama--collect (cadr expr) args nil t))) + ((symbolp expr) + (let ((name (symbol-name expr))) + (save-match-data + (cond + ((string-match "\\`\\(_\\)?[%&]\\([1-9*]\\)?\\'" name) + (let* ((pos (match-string 2 name)) + (pos (cond ((equal pos "*") 0) + ((not pos) 1) + ((string-to-number pos)))) + (sym (aref args pos))) + (unless (and fnpos (not unquote) (memq expr '(% &))) + (when (and sym (not (equal expr sym))) + (error "`%s' and `%s' are mutually exclusive" sym expr)) + (aset args pos expr))) + (if (match-string 1 name) + llama--unused-argument + expr)) + (expr))))) + ((or (listp expr) + (vectorp expr)) + (let* ((vectorp (vectorp expr)) + (expr (if vectorp (append expr ()) expr)) + (fnpos (and (not vectorp) + (not backquoted) + (ignore-errors (length expr)))) ;proper-list-p + (ret ())) + (catch t + (while t + (let ((elt (llama--collect (car expr) args fnpos backquoted))) + (unless (eq elt llama--unused-argument) + (push elt ret))) + (setq fnpos nil) + (setq expr (cdr expr)) + (unless (and expr + (listp expr) + (not (eq (car expr) backquote-unquote-symbol))) + (throw t nil)))) + (setq ret (nreverse ret)) + (when expr + (setcdr (last ret) (llama--collect expr args nil backquoted))) + (if vectorp (vconcat ret) ret))) + (expr))) ;;; Completion @@ -353,9 +355,10 @@ expansion, and the looks of this face should hint at that.") (prog1 t (save-excursion (goto-char (match-beginning 0)) - (when-let ((_(save-match-data (not (nth 8 (syntax-ppss))))) - (expr (ignore-errors - (read-positioning-symbols (current-buffer))))) + (when-let* + ((_(save-match-data (not (nth 8 (syntax-ppss))))) + (expr (ignore-errors + (read-positioning-symbols (current-buffer))))) (put-text-property (match-beginning 0) (point) 'font-lock-multiline t) (llama--fontify (cdr expr) nil nil t))))) @@ -364,58 +367,58 @@ expansion, and the looks of this face should hint at that.") (defun llama--fontify (expr &optional fnpos backquoted top) (static-if (fboundp 'bare-symbol) (cond - ((null expr) expr) - ((eq (car-safe expr) 'quote)) - ((eq (ignore-errors (bare-symbol (car-safe expr))) 'quote)) - ((and (memq (ignore-errors (bare-symbol (car-safe expr))) - (list (intern "") 'llama)) - (not top))) - ((and backquoted (symbol-with-pos-p expr))) - ((and backquoted - (memq (car-safe expr) - (list backquote-unquote-symbol - backquote-splice-symbol))) - (llama--fontify expr)) - ((symbol-with-pos-p expr) - (save-match-data - (when-let* - ((name (symbol-name (bare-symbol expr))) - (face (cond - ((and (string-match - "\\_<\\(?:\\(_\\)?%\\([1-9]\\)?\\)\\_>" name) - (or (not fnpos) (match-end 2))) - 'llama-mandatory-argument) - ((and (string-match - "\\_<\\(?:\\(_\\)?&\\([1-9*]\\)?\\)\\_>" name) - (or (not fnpos) (match-end 2))) - 'llama-optional-argument)))) - (when (match-end 1) - (setq face (list 'llama-deleted-argument face))) - (let ((beg (symbol-with-pos-pos expr))) - (put-text-property - beg (save-excursion (goto-char beg) (forward-symbol 1)) - 'face face))))) - ((or (listp expr) - (vectorp expr)) - (let* ((vectorp (vectorp expr)) - (expr (if vectorp (append expr ()) expr)) - (fnpos (and (not vectorp) - (not backquoted) - (ignore-errors (length expr))))) - (catch t - (while t - (cond ((eq (car expr) backquote-backquote-symbol) - (setq expr (cdr expr)) - (llama--fontify (car expr) t t)) - ((llama--fontify (car expr) fnpos backquoted))) - (setq fnpos nil) - (setq expr (cdr expr)) - (unless (and expr - (listp expr) - (not (eq (car expr) backquote-unquote-symbol))) - (throw t nil)))) - (when expr - (llama--fontify expr fnpos)))))) + ((null expr) expr) + ((eq (car-safe expr) 'quote)) + ((eq (ignore-errors (bare-symbol (car-safe expr))) 'quote)) + ((and (memq (ignore-errors (bare-symbol (car-safe expr))) + (list (intern "") 'llama)) + (not top))) + ((and backquoted (symbol-with-pos-p expr))) + ((and backquoted + (memq (car-safe expr) + (list backquote-unquote-symbol + backquote-splice-symbol))) + (llama--fontify expr)) + ((symbol-with-pos-p expr) + (save-match-data + (when-let* + ((name (symbol-name (bare-symbol expr))) + (face (cond + ((and (string-match + "\\_<\\(?:\\(_\\)?%\\([1-9]\\)?\\)\\_>" name) + (or (not fnpos) (match-end 2))) + 'llama-mandatory-argument) + ((and (string-match + "\\_<\\(?:\\(_\\)?&\\([1-9*]\\)?\\)\\_>" name) + (or (not fnpos) (match-end 2))) + 'llama-optional-argument)))) + (when (match-end 1) + (setq face (list 'llama-deleted-argument face))) + (let ((beg (symbol-with-pos-pos expr))) + (put-text-property + beg (save-excursion (goto-char beg) (forward-symbol 1)) + 'face face))))) + ((or (listp expr) + (vectorp expr)) + (let* ((vectorp (vectorp expr)) + (expr (if vectorp (append expr ()) expr)) + (fnpos (and (not vectorp) + (not backquoted) + (ignore-errors (length expr))))) + (catch t + (while t + (cond ((eq (car expr) backquote-backquote-symbol) + (setq expr (cdr expr)) + (llama--fontify (car expr) t t)) + ((llama--fontify (car expr) fnpos backquoted))) + (setq fnpos nil) + (setq expr (cdr expr)) + (unless (and expr + (listp expr) + (not (eq (car expr) backquote-unquote-symbol))) + (throw t nil)))) + (when expr + (llama--fontify expr fnpos)))))) (list expr fnpos backquoted top)) ; Silence compiler. (defvar llama-fontify-mode-lighter nil) @@ -426,18 +429,18 @@ expansion, and the looks of this face should hint at that.") :lighter llama-fontify-mode-lighter :global t (cond - (llama-fontify-mode - (advice-add 'lisp--el-match-keyword :override - #'lisp--el-match-keyword@llama '((depth . -80))) - (advice-add 'elisp-mode-syntax-propertize :override - #'elisp-mode-syntax-propertize@llama) - (add-hook 'emacs-lisp-mode-hook #'llama--add-font-lock-keywords)) - (t - (advice-remove 'lisp--el-match-keyword - #'lisp--el-match-keyword@llama) - (advice-remove 'elisp-mode-syntax-propertize - #'elisp-mode-syntax-propertize@llama) - (remove-hook 'emacs-lisp-mode-hook #'llama--add-font-lock-keywords))) + (llama-fontify-mode + (advice-add 'lisp--el-match-keyword :override + #'lisp--el-match-keyword@llama '((depth . -80))) + (advice-add 'elisp-mode-syntax-propertize :override + #'elisp-mode-syntax-propertize@llama) + (add-hook 'emacs-lisp-mode-hook #'llama--add-font-lock-keywords)) + (t + (advice-remove 'lisp--el-match-keyword + #'lisp--el-match-keyword@llama) + (advice-remove 'elisp-mode-syntax-propertize + #'elisp-mode-syntax-propertize@llama) + (remove-hook 'emacs-lisp-mode-hook #'llama--add-font-lock-keywords))) (dolist (buffer (buffer-list)) (with-current-buffer buffer (when (derived-mode-p 'emacs-lisp-mode) -- 2.47.3