branch: elpa/llama commit 86115bc3a1c3d4db701687be69126c76c76af653 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
No longer highlight % and & in function position --- llama.el | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/llama.el b/llama.el index e80f7d4f31..06779f7135 100644 --- a/llama.el +++ b/llama.el @@ -344,11 +344,22 @@ expansion, and the looks of this face should hint at that.") (defvar llama-font-lock-keywords '(("(\\(##\\)" 1 'llama-macro) - ("\\_<\\(?:_?%[1-9]?\\)\\_>" 0 'llama-mandatory-argument) - ("\\_<\\(?:_?&[1-9*]?\\)\\_>" 0 'llama-optional-argument) + ("\\_<\\(?:_?%[1-9]?\\)\\_>" + 0 (llama--maybe-face 'llama-mandatory-argument)) + ("\\_<\\(?:_?&[1-9*]?\\)\\_>" + 0 (llama--maybe-face 'llama-optional-argument)) ("\\_<\\(?:_\\(?:%[1-9]?\\|&[1-9*]?\\)\\)\\_>" 0 'llama-deleted-argument prepend))) +(defun llama--maybe-face (face) + (and (not (and (member (match-string 0) '("%" "&")) + (and-let* ((beg (ignore-errors + (scan-lists (match-beginning 0) -1 1)))) + (string-match-p "\\`\\(##\\)?[ \t\n\r]*\\'" + (buffer-substring-no-properties + (1+ beg) (match-beginning 0)))))) + face)) + (defvar llama-fontify-mode-lighter nil) ;;;###autoload