[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sweeprolog 6dd6433920 165/166: ENHANCED: fontify quasi-quo
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sweeprolog 6dd6433920 165/166: ENHANCED: fontify quasi-quotation content according to its type |
Date: |
Fri, 30 Sep 2022 04:59:36 -0400 (EDT) |
branch: elpa/sweeprolog
commit 6dd64339205c10adda9dbff90db96a067603398c
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>
ENHANCED: fontify quasi-quotation content according to its type
* sweeprolog-qq-mode-alist: new user option
* (sweeprolog--colour-term-to-faces): use it
---
sweep.pl | 3 +++
sweeprolog.el | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/sweep.pl b/sweep.pl
index c8a29f08ad..b445260711 100644
--- a/sweep.pl
+++ b/sweep.pl
@@ -638,6 +638,9 @@ sweep_color_normalized_(Offset, syntax_error,
[Message0,Start0-End0|_], ["syntax
sweep_color_normalized_(_, comment, [Kind0|_], ["comment"|Kind]) :-
!,
atom_string(Kind0, Kind).
+sweep_color_normalized_(_, qq_content, [Type0|_], ["qq_content"|Type]) :-
+ !,
+ atom_string(Type0, Type).
sweep_color_normalized_(_, Nom0, _, Nom) :-
atom_string(Nom0, Nom).
diff --git a/sweeprolog.el b/sweeprolog.el
index 77dffd94ab..3846c2cee0 100644
--- a/sweeprolog.el
+++ b/sweeprolog.el
@@ -40,6 +40,14 @@
:type 'integer
:group 'sweeprolog)
+(defcustom sweeprolog-qq-mode-alist '(("graphql" . graphql-mode)
+ ("javascript" . js-mode)
+ ("html" . html-mode))
+ "Association between Prolog quasi-quotation types and Emacs modes."
+ :package-version '((sweeprolog . "0.4.3"))
+ :type '(alist :key-type string :value-type symbol)
+ :group 'sweeprolog)
+
(defcustom sweeprolog-colourise-buffer-on-idle t
"If non-nil, update highlighting of `sweeprolog-mode' buffers on idle."
:package-version '((sweeprolog . "0.2.0"))
@@ -904,6 +912,13 @@ module name, F is a functor name and N is its arity."
(:weight bold)
"Quasi-quotation open sequences.")
+(sweeprolog-defface
+ qq-content
+ (:inherit default)
+ (:foreground "red4")
+ (:foreground "red4")
+ "Quasi-quotation content.")
+
(sweeprolog-defface
qq-close
(:inherit font-lock-type-face)
@@ -1245,6 +1260,29 @@ module name, F is a functor name and N is its arity."
(list (list beg end (sweeprolog-neck-face))))
("hook"
(list (list beg end (sweeprolog-hook-face))))
+ (`("qq_content" . ,type)
+ (let ((mode (cdr (assoc-string type sweeprolog-qq-mode-alist))))
+ (if (and mode (fboundp mode))
+ (let ((res nil)
+ (string (buffer-substring-no-properties beg end)))
+ (with-current-buffer
+ (get-buffer-create
+ (format " *sweep-qq-content:%s*" type))
+ (with-silent-modifications
+ (erase-buffer)
+ (insert string " "))
+ (unless (eq major-mode mode) (funcall mode))
+ (font-lock-ensure)
+ (let ((pos (point-min)) next)
+ (while (setq next (next-property-change pos))
+ (dolist (prop '(font-lock-face face))
+ (let ((new-prop (get-text-property pos prop)))
+ (when new-prop
+ (setq res (cons (list (+ beg (1- pos)) (1- (+ beg
next)) new-prop) res)))))
+ (setq pos next)))
+ (set-buffer-modified-p nil)
+ res))
+ (list (list beg end (sweeprolog-qq-content-face))))))
("qq_type"
(list (list beg end (sweeprolog-qq-type-face))))
("qq_sep"
- [nongnu] elpa/sweeprolog 04964e36b4 143/166: ENHANCED: also update highlighting between sub terms, (continued)
- [nongnu] elpa/sweeprolog 04964e36b4 143/166: ENHANCED: also update highlighting between sub terms, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 8affae71da 138/166: ADDED: sweep-faces-style user option for controlling highlighting, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 615312796c 048/166: FIXED: copy paste error (singleton variable), ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 37f83755f6 049/166: PORT: detect older swipl and disable custom GMP alloc functions, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 3139de3e6c 056/166: ENHANCED: prompt for buffer name in sweep-top-level with C-u, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog ea43b81c95 058/166: DOC: update manual section about filespec expansion, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 3351766605 103/166: sweep.el: bump Package-Version to 0.2.0, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 5b9e2d7d7c 126/166: ADDED: sweep_op_info/2: new_predicate, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 5eb4ede8f8 113/166: ADDED: (sweep-prefix-operators): New function, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 2abad939fe 108/166: DOC: Following file specifications: new section, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 6dd6433920 165/166: ENHANCED: fontify quasi-quotation content according to its type,
ELPA Syncer <=
- [nongnu] elpa/sweeprolog 48e8fb7c65 155/166: ENHANCED: (sweep--colour-term-to-face): return multiple regions, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 1c87ca72e3 163/166: DOC: document new variable highlighting in the manual, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog a8d186092f 157/166: ENHANCED: More indicative error on failure to locate sweep-module, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 97856b5c85 159/166: DOC: add installation instructions from NonGNU ELPA, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 348294a57f 002/166: Add swipl-devel submodule, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog b2838d5477 004/166: Cleanup, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 4f96499382 011/166: DOC: expand README.org, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 5c4aef50f2 041/166: Run `ninja install` as root in CI, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog a6e37f306b 069/166: ENHANCED: fontify mutlifile predicate calls in a dedicated face, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 4299c39d62 070/166: ENHANCED: indentation edge cases handling, ELPA Syncer, 2022/09/30