[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/adoc-mode 625388ac44 010/199: improved superscript/subscti
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/adoc-mode 625388ac44 010/199: improved superscript/subsctipt unfontify |
Date: |
Sun, 3 Sep 2023 06:59:12 -0400 (EDT) |
branch: elpa/adoc-mode
commit 625388ac449418925b0f74c9b55753096e6390e2
Author: Florian Kaufmann <sensorflo@gmail.com>
Commit: Florian Kaufmann <sensorflo@gmail.com>
improved superscript/subsctipt unfontify
now does it almost like latex-mode.
---
adoc-mode.el | 35 ++++++++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/adoc-mode.el b/adoc-mode.el
index c2dc8985f1..53f77eabe9 100644
--- a/adoc-mode.el
+++ b/adoc-mode.el
@@ -125,7 +125,9 @@ This is a list of two floats. The first is negative and
specifies
how much subscript is lowered, the second is positive and
specifies how much superscript is raised. Heights are measured
relative to that of the normal text. The faces used are
-adoc-superscript and adoc-subscript respectively."
+adoc-superscript and adoc-subscript respectively.
+
+You need to call `adoc-calc' after a change."
:type '(list (float :tag "Subscript")
(float :tag "Superscript"))
:group 'adoc)
@@ -752,10 +754,16 @@ value."
(and found (not prevented))))
(defun adoc-facespec-subscript ()
- `(face adoc-subscript display (raise ,(nth 0 adoc-script-raise))))
+ (list 'quote
+ (append '(face markup-subscript-face)
+ (when (not (= 0 (car adoc-script-raise)))
+ `(display (raise ,(car adoc-script-raise)))))))
(defun adoc-facespec-superscript ()
- `(face adoc-superscript display (raise ,(nth 1 adoc-script-raise))))
+ (list 'quote
+ (append '(face markup-superscript-face)
+ (when (not (= 0 (car adoc-script-raise)))
+ `(display (raise ,(cadr adoc-script-raise)))))))
;; adoc-lexxer will set these faces when it finds a match. The numbers are the
;; regexp group numbers of the match.
@@ -1007,9 +1015,26 @@ When LITERAL-P is non-nil, the contained text is literal
text."
'(1 '(face adoc-replacement adoc-reserved t) t))))
(defun adoc-unfontify-region-function (beg end)
+ ;;
+ (font-lock-default-unfontify-region beg end)
+
+ ;; remove overlays. Currently only used by AsciiDoc replacements
+ ;; todo: this is an extremly brute force solution and interacts very badly
+ ;; with many (minor) modes using overlays such as flyspell or ediff
(when adoc-insert-replacement
(remove-overlays beg end))
- (font-lock-default-unfontify-region beg end))
+
+ ;; text properties. Currently only display raise used for sub/superscripts.
+ ;; code snipped copied from tex-mode
+ (when (not (and (= 0 (car adoc-script-raise)) (= 0 (cadr
adoc-script-raise))))
+ (while (< beg end)
+ (let ((next (next-single-property-change beg 'display nil end))
+ (prop (get-text-property beg 'display)))
+ (if (and (eq (car-safe prop) 'raise)
+ (member (car-safe (cdr prop)) adoc-script-raise)
+ (null (cddr prop)))
+ (put-text-property beg next 'display nil))
+ (setq beg next)))))
(defun adoc-font-lock-mark-block-function ()
(mark-paragraph 2)
@@ -1801,7 +1826,7 @@ Turning on Adoc mode runs the normal hook
`adoc-mode-hook'."
(font-lock-multiline . t)
(font-lock-mark-block-function . adoc-font-lock-mark-block-function)))
(make-local-variable 'font-lock-extra-managed-props)
- (setq font-lock-extra-managed-props (list 'display 'adoc-reserved))
+ (setq font-lock-extra-managed-props '(adoc-reserved))
(make-local-variable 'font-lock-unfontify-region-function)
(setq font-lock-unfontify-region-function 'adoc-unfontify-region-function)
- [nongnu] branch elpa/adoc-mode created (now 809fb47a26), ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode c5fec9c015 001/199: initial commit, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 56cfbecca2 002/199: added adoc-enable-two-line-title, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 46c99fbd51 006/199: bugfix in font lock regexp for comments, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode e144653832 005/199: refactored title constructs, initiated testing adoc-mode, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 625388ac44 010/199: improved superscript/subsctipt unfontify,
ELPA Syncer <=
- [nongnu] elpa/adoc-mode 9d4bb33fca 016/199: reworked lists items and adoc-align prefix, incl. tests,, ELPA Syncer, 2023/09/03
- [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