update packages
This commit is contained in:
6
lisp/llama/.dir-locals.el
Normal file
6
lisp/llama/.dir-locals.el
Normal file
@@ -0,0 +1,6 @@
|
||||
((nil
|
||||
(indent-tabs-mode . nil))
|
||||
(makefile-mode
|
||||
(indent-tabs-mode . t))
|
||||
(git-commit-mode
|
||||
(git-commit-major-mode . git-commit-elisp-text-mode)))
|
||||
@@ -1,9 +1,9 @@
|
||||
(define-package "llama" "20250309.1622" "Compact syntax for short lambda"
|
||||
'((emacs "26.1")
|
||||
(compat "30.0.2.0"))
|
||||
:commit "4d3141aceb70a1c672d1f4e9394037e2407d3a90" :keywords
|
||||
'("extensions")
|
||||
:url "https://github.com/tarsius/llama")
|
||||
;; Local Variables:
|
||||
;; no-byte-compile: t
|
||||
;; End:
|
||||
;; -*- no-byte-compile: t; lexical-binding: nil -*-
|
||||
(define-package "llama" "20250601.1000"
|
||||
"Compact syntax for short lambda."
|
||||
'((emacs "26.1")
|
||||
(compat "30.1"))
|
||||
:url "https://github.com/tarsius/llama"
|
||||
:commit "6a67e4253cc02aa9ce85ef96290c95198b65d913"
|
||||
:revdesc "6a67e4253cc0"
|
||||
:keywords '("extensions"))
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
;; Homepage: https://github.com/tarsius/llama
|
||||
;; Keywords: extensions
|
||||
|
||||
;; Package-Version: 0.6.1
|
||||
;; Package-Requires: ((emacs "26.1") (compat "30.0.2.0"))
|
||||
;; Package-Version: 20250601.1000
|
||||
;; Package-Revision: 6a67e4253cc0
|
||||
;; Package-Requires: ((emacs "26.1") (compat "30.1"))
|
||||
|
||||
;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
@@ -80,6 +81,9 @@
|
||||
;; 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.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'compat)
|
||||
@@ -137,7 +141,10 @@ becomes:
|
||||
|
||||
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'."
|
||||
explicitly specified `_%3'.
|
||||
|
||||
Consider enabling `llama-fontify-mode' to highlight `##' and its
|
||||
special arguments."
|
||||
(cond ((symbolp fn))
|
||||
((and (eq (car-safe fn) backquote-backquote-symbol)
|
||||
(not body))
|
||||
@@ -243,7 +250,7 @@ explicitly specified `_%3'."
|
||||
(if vectorp (vconcat ret) ret)))
|
||||
(expr)))
|
||||
|
||||
;;; Advices
|
||||
;;; Completion
|
||||
|
||||
(define-advice elisp--expect-function-p (:around (fn pos) llama)
|
||||
"Support function completion directly following `##'."
|
||||
@@ -254,42 +261,6 @@ explicitly specified `_%3'."
|
||||
(eq (char-before (- pos 2)) ?#))
|
||||
(funcall fn pos)))
|
||||
|
||||
(define-advice elisp-mode-syntax-propertize (:override (start end) llama)
|
||||
;; Synced with Emacs up to 6b9510d94f814cacf43793dce76250b5f7e6f64a.
|
||||
"Like `elisp-mode-syntax-propertize' but don't change syntax of `##'."
|
||||
(goto-char start)
|
||||
(let ((case-fold-search nil))
|
||||
(funcall
|
||||
(syntax-propertize-rules
|
||||
;; Empty symbol.
|
||||
;; {{ Comment out to prevent the `##' from becoming part of
|
||||
;; the following symbol when there is no space in between.
|
||||
;; ("##" (0 (unless (nth 8 (syntax-ppss))
|
||||
;; (string-to-syntax "_"))))
|
||||
;; }}
|
||||
;; {{ As for other symbols, use `font-lock-constant-face' in
|
||||
;; docstrings and comments.
|
||||
("##" (0 (when (nth 8 (syntax-ppss))
|
||||
(string-to-syntax "_"))))
|
||||
;; }}
|
||||
;; {{ Preserve this part, even though it is absent from
|
||||
;; this function in 29.1; backporting it by association.
|
||||
;; Prevent the @ from becoming part of a following symbol.
|
||||
(",@" (0 (unless (nth 8 (syntax-ppss))
|
||||
(string-to-syntax "'"))))
|
||||
;; }}
|
||||
;; Unicode character names. (The longest name is 88 characters
|
||||
;; long.)
|
||||
("\\?\\\\N{[-A-Za-z0-9 ]\\{,100\\}}"
|
||||
(0 (unless (nth 8 (syntax-ppss))
|
||||
(string-to-syntax "_"))))
|
||||
((rx "#" (or (seq (group-n 1 "&" (+ digit)) ?\") ; Bool-vector.
|
||||
(seq (group-n 1 "s") "(") ; Record.
|
||||
(seq (group-n 1 (+ "^")) "["))) ; Char-table.
|
||||
(1 (unless (save-excursion (nth 8 (syntax-ppss (match-beginning 0))))
|
||||
(string-to-syntax "'")))))
|
||||
start end)))
|
||||
|
||||
(define-advice all-completions (:around (fn str table &rest rest) llama)
|
||||
"Remove empty symbol from completion results if originating from `llama'.
|
||||
|
||||
@@ -310,36 +281,12 @@ that is used as TABLE."
|
||||
(delete "" result)
|
||||
result)))
|
||||
|
||||
(defvar llama-fontify-mode)
|
||||
|
||||
(define-advice lisp--el-match-keyword (:override (limit) llama -80)
|
||||
(catch 'found
|
||||
(while (re-search-forward
|
||||
(concat (if llama-fontify-mode
|
||||
"(\\(?:## ?\\)?\\("
|
||||
"(\\(")
|
||||
(static-if (get 'lisp-mode-symbol 'rx-definition) ;>= 29.1
|
||||
(rx lisp-mode-symbol)
|
||||
lisp-mode-symbol-regexp)
|
||||
"\\)\\_>")
|
||||
limit t)
|
||||
(let ((sym (intern-soft (match-string 1))))
|
||||
(when (and (or (special-form-p sym)
|
||||
(macrop sym)
|
||||
;; Same as in advice of `morlock' package.
|
||||
(get sym 'morlock-font-lock-keyword))
|
||||
(not (get sym 'no-font-lock-keyword))
|
||||
(static-if (fboundp 'lisp--el-funcall-position-p) ;>= 28.1
|
||||
(lisp--el-funcall-position-p (match-beginning 0))
|
||||
(not (lisp--el-non-funcall-position-p
|
||||
(match-beginning 0)))))
|
||||
(throw 'found t))))))
|
||||
|
||||
;;; Fontification
|
||||
|
||||
(defgroup llama ()
|
||||
"Compact syntax for short lambda."
|
||||
:group 'extensions
|
||||
:group 'faces
|
||||
:group 'lisp)
|
||||
|
||||
(defface llama-\#\#-macro '((t :inherit font-lock-function-call-face))
|
||||
@@ -475,20 +422,94 @@ expansion, and the looks of this face should hint at that.")
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode llama-fontify-mode
|
||||
"Toggle fontification of the `##' macro and its positional arguments."
|
||||
"In Emacs Lisp mode, highlight the `##' macro and its special arguments."
|
||||
:lighter llama-fontify-mode-lighter
|
||||
(if llama-fontify-mode
|
||||
(font-lock-add-keywords nil llama-font-lock-keywords)
|
||||
(font-lock-remove-keywords nil llama-font-lock-keywords)))
|
||||
: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)))
|
||||
(dolist (buffer (buffer-list))
|
||||
(with-current-buffer buffer
|
||||
(when (derived-mode-p 'emacs-lisp-mode)
|
||||
(if llama-fontify-mode
|
||||
(font-lock-add-keywords nil llama-font-lock-keywords)
|
||||
(font-lock-remove-keywords nil llama-font-lock-keywords))
|
||||
(font-lock-flush)))))
|
||||
|
||||
(defun llama--turn-on-fontify-mode ()
|
||||
"Enable `llama-fontify-mode' if in an Emacs Lisp buffer."
|
||||
(when (derived-mode-p #'emacs-lisp-mode)
|
||||
(llama-fontify-mode)))
|
||||
(defun llama--add-font-lock-keywords ()
|
||||
(font-lock-add-keywords nil llama-font-lock-keywords))
|
||||
|
||||
;;;###autoload
|
||||
(define-globalized-minor-mode global-llama-fontify-mode
|
||||
llama-fontify-mode llama--turn-on-fontify-mode)
|
||||
(define-obsolete-function-alias 'global-llama-fontify-mode
|
||||
#'llama-fontify-mode "Llama 0.6.2")
|
||||
|
||||
(defun lisp--el-match-keyword@llama (limit)
|
||||
"Highlight symbols following \"(##\" the same as if they followed \"(\"."
|
||||
(catch 'found
|
||||
(while (re-search-forward
|
||||
(concat "(\\(?:## ?\\)?\\("
|
||||
(static-if (get 'lisp-mode-symbol 'rx-definition) ;>= 29.1
|
||||
(rx lisp-mode-symbol)
|
||||
lisp-mode-symbol-regexp)
|
||||
"\\)\\_>")
|
||||
limit t)
|
||||
(let ((sym (intern-soft (match-string 1))))
|
||||
(when (and (or (special-form-p sym)
|
||||
(macrop sym)
|
||||
(and (bound-and-true-p morlock-mode)
|
||||
;; Same as in advice of `morlock' package.
|
||||
(get sym 'morlock-font-lock-keyword)))
|
||||
(not (get sym 'no-font-lock-keyword))
|
||||
(static-if (fboundp 'lisp--el-funcall-position-p) ;>= 28.1
|
||||
(lisp--el-funcall-position-p (match-beginning 0))
|
||||
(not (lisp--el-non-funcall-position-p
|
||||
(match-beginning 0)))))
|
||||
(throw 'found t))))))
|
||||
|
||||
(defun elisp-mode-syntax-propertize@llama (start end)
|
||||
;; Synced with Emacs up to 6b9510d94f814cacf43793dce76250b5f7e6f64a.
|
||||
"Highlight `##' as the symbol which it is."
|
||||
(goto-char start)
|
||||
(let ((case-fold-search nil))
|
||||
(funcall
|
||||
(syntax-propertize-rules
|
||||
;; Empty symbol.
|
||||
;; {{ Comment out to prevent the `##' from becoming part of
|
||||
;; the following symbol when there is no space in between.
|
||||
;; ("##" (0 (unless (nth 8 (syntax-ppss))
|
||||
;; (string-to-syntax "_"))))
|
||||
;; }}
|
||||
;; {{ As for other symbols, use `font-lock-constant-face' in
|
||||
;; docstrings and comments.
|
||||
("##" (0 (when (nth 8 (syntax-ppss))
|
||||
(string-to-syntax "_"))))
|
||||
;; }}
|
||||
;; {{ Preserve this part, even though it is absent from
|
||||
;; this function in 29.1; backporting it by association.
|
||||
;; Prevent the @ from becoming part of a following symbol.
|
||||
(",@" (0 (unless (nth 8 (syntax-ppss))
|
||||
(string-to-syntax "'"))))
|
||||
;; }}
|
||||
;; Unicode character names. (The longest name is 88 characters
|
||||
;; long.)
|
||||
("\\?\\\\N{[-A-Za-z0-9 ]\\{,100\\}}"
|
||||
(0 (unless (nth 8 (syntax-ppss))
|
||||
(string-to-syntax "_"))))
|
||||
((rx "#" (or (seq (group-n 1 "&" (+ digit)) ?\") ; Bool-vector.
|
||||
(seq (group-n 1 "s") "(") ; Record.
|
||||
(seq (group-n 1 (+ "^")) "["))) ; Char-table.
|
||||
(1 (unless (save-excursion (nth 8 (syntax-ppss (match-beginning 0))))
|
||||
(string-to-syntax "'")))))
|
||||
start end)))
|
||||
|
||||
;;; Partial applications
|
||||
|
||||
|
||||
Reference in New Issue
Block a user