[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/adoc-mode 2a088d1e83 020/199: added meta-face-cleanup, in
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/adoc-mode 2a088d1e83 020/199: added meta-face-cleanup, initial version |
Date: |
Sun, 3 Sep 2023 06:59:15 -0400 (EDT) |
branch: elpa/adoc-mode
commit 2a088d1e834ac8ac81825039de47d00f6d161f17
Author: Florian Kaufmann <sensorflo@gmail.com>
Commit: Florian Kaufmann <sensorflo@gmail.com>
added meta-face-cleanup, initial version
---
adoc-mode-test.el | 17 +++++++++++++++++
adoc-mode.el | 26 ++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/adoc-mode-test.el b/adoc-mode-test.el
index a4ba94d4ae..79e2f3a5d6 100644
--- a/adoc-mode-test.el
+++ b/adoc-mode-test.el
@@ -168,4 +168,21 @@
"+" markup-meta-face "\n" nil
"2nd list paragraph\n" nil ))
+(ert-deftest adoctest-test-meta-face-cleanup ()
+ ;; begin with a few simple explicit cases which are easier to debug in case
of troubles
+ (adoctest-faces
+ "*" markup-meta-hide-face "lorem " markup-strong-face
+ "_" markup-meta-hide-face "ipsum" '(markup-strong-face
markup-emphasis-face) "_" markup-meta-hide-face
+ " dolor" markup-strong-face "*" markup-meta-hide-face "\n" nil)
+ (adoctest-faces
+ "_" markup-meta-hide-face "lorem " markup-emphasis-face
+ "*" markup-meta-hide-face "ipsum" '(markup-strong-face
markup-emphasis-face) "*" markup-meta-hide-face
+ " dolor" markup-emphasis-face "_" markup-meta-hide-face "\n" nil)
+
+ ;; now test all possible cases
+ ;; mmm, that is all possible cases inbetween constrained/unconstrained quotes
+
+ ;; .... todo
+ )
+
(ert-run-tests-interactively "^adoctest-test-")
diff --git a/adoc-mode.el b/adoc-mode.el
index 3262668f84..c80e75e96b 100644
--- a/adoc-mode.el
+++ b/adoc-mode.el
@@ -957,6 +957,29 @@ When LITERAL-P is non-nil, the contained text is literal
text."
'adoc-flf-first-whites-fixed-width
'(1 adoc-align t)))
+;; ensures that faces from the markup-text group don't overwrite faces from the
+;; markup-meta group
+(defun adoc-flf-meta-face-cleanup (end)
+ (while (< (point) end)
+ (let* ((next-pos (next-single-property-change (point) 'face nil end))
+ (faces-raw (get-text-property (point) 'face))
+ (faces (if (listp faces-raw) faces-raw (list faces-raw)))
+ newfaces
+ meta-p)
+ (while faces
+ (if (member (car faces) '(markup-meta-hide-face markup-command-face
markup-attribute-face markup-value-face markup-complex-replacement-face
markup-list-face markup-table-face markup-table-row-face markup-table-cell-face
markup-anchor-face markup-internal-reference-face markup-comment-face
markup-preprocessor-face))
+ (progn
+ (setq meta-p t)
+ (setq newfaces (cons (car faces) newfaces)))
+ (if (not (string-match "markup-" (symbol-name (car faces))))
+ (setq newfaces (cons (car faces) newfaces))))
+ (setq faces (cdr faces)))
+ (if meta-p
+ (put-text-property (point) next-pos 'face
+ (if (= 1 (length newfaces)) (car newfaces)
newfaces)))
+ (goto-char next-pos)))
+ nil)
+
(defun adoc-unfontify-region-function (beg end)
;;
(font-lock-default-unfontify-region beg end)
@@ -1462,6 +1485,9 @@ When LITERAL-P is non-nil, the contained text is literal
text."
;; wanted to add a normal paragraph. List paragraphs are appended
;; implicitely.
(list "^\\(\\+[ \t]*\\)\n\\([ \t]+\\)[^ \t\n]" '(1 adoc-warning t) '(2
adoc-warning t))
+
+ ;; cleanup
+ (list 'adoc-flf-meta-face-cleanup)
))
(defun adoc-show-version ()
- [nongnu] elpa/adoc-mode 03f080fe6b 019/199: extended delimited block tests with checking adoc-align face, (continued)
- [nongnu] elpa/adoc-mode 03f080fe6b 019/199: extended delimited block tests with checking adoc-align face, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 276e822b59 004/199: Merge markup-faces into font_lock_delimited_blocks, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode f4bbbea2ff 003/199: replaced adoc's own faces with markup-faces library, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 7a87ac9e5c 007/199: added customization var for delimited block regexps, added tests, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 113eba1bfe 008/199: changed/added docstring, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode b0d75800d0 012/199: edited comment, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode af7cd59e1b 013/199: added first-whites-fixed-width, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 5421059e54 015/199: small change in regexp for unconstrained quote, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 879f594ac9 017/199: comment change / removed a few unneeded adoc face variables, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 6cb365085b 018/199: removed/abandoned lexxer stuff, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 2a088d1e83 020/199: added meta-face-cleanup, initial version,
ELPA Syncer <=
- [nongnu] elpa/adoc-mode eb20a274e0 024/199: made it easier to run tests, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode de18a17505 031/199: fl keyword for comments now in new-style, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 8349f0e05e 032/199: added better support for attribute lists, no tests written yet, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode c8b39080f8 025/199: added that inline subst can't match across block boundaries, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 3ba0822b91 028/199: bugfix: quotes shall not cross labeled list item boundaries, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 2da645a750 040/199: attribute-list can have a local face alist / two faces for target of an inline macro can be specified, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 69e44f37ac 049/199: changed default of adoc-insert-replacement to nil, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode a16699bffe 050/199: test: adapted to new ert, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 6b84d70fe0 051/199: test: reworked adoctest-faces, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode a88d4ea5d5 052/199: bugfix: some regexps did not handle end of buffer correctly, ELPA Syncer, 2023/09/03