emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org-modern 34ccd3acbf 1/2: Simplify table scaling


From: ELPA Syncer
Subject: [elpa] externals/org-modern 34ccd3acbf 1/2: Simplify table scaling
Date: Wed, 14 Sep 2022 10:58:01 -0400 (EDT)

branch: externals/org-modern
commit 34ccd3acbf3d4dc4c815eeafe9d464b420ab7835
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Simplify table scaling
---
 org-modern.el | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/org-modern.el b/org-modern.el
index eb7ecea147..cb66db6124 100644
--- a/org-modern.el
+++ b/org-modern.el
@@ -291,7 +291,9 @@ the font.")
 (defvar-local org-modern--star-cache nil)
 (defvar-local org-modern--checkbox-cache nil)
 (defvar-local org-modern--progress-cache nil)
-(defvar-local org-modern--sp-width (list nil))
+(defvar-local org-modern--table-sp-width 0)
+(defconst org-modern--table-sp '((space :width (org-modern--table-sp-width))
+                                 (space :width (org-modern--table-sp-width))))
 
 (defun org-modern--checkbox ()
   "Prettify checkboxes according to `org-modern-checkbox'."
@@ -420,9 +422,6 @@ the font.")
            (end (match-end 0))
            (tbeg (match-beginning 1))
            (tend (match-end 1))
-           ;; Unique space objects
-           (sp1 (list 'space :width org-modern--sp-width))
-           (sp2 (list 'space :width org-modern--sp-width))
            (color (face-attribute 'org-table :foreground nil t))
            (inner (progn
                     (goto-char beg)
@@ -453,10 +452,9 @@ the font.")
         (while (re-search-forward "[^|+]+" tend 'noerror)
           (let ((a (match-beginning 0))
                 (b (match-end 0)))
-            ;; TODO Text scaling breaks the table formatting since the space 
is not scaled accordingly
             (cl-loop for i from a below b do
                      (put-text-property i (1+ i) 'display
-                                        (if (= 0 (mod i 2)) sp1 sp2)))))))))
+                                        (nth (mod i 2) 
org-modern--table-sp)))))))))
 
 (defun org-modern--block-name ()
   "Prettify block according to `org-modern-block-name'."
@@ -519,7 +517,7 @@ the font.")
 
 (defun org-modern--pre-redisplay (_)
   "Compute font width before redisplay."
-  (setcar org-modern--sp-width (default-font-width)))
+  (setq org-modern--table-sp-width (default-font-width)))
 
 (defun org-modern--update-label-face ()
   "Update border of the `org-modern-label' face."
@@ -675,7 +673,6 @@ the font.")
   (cond
    (org-modern-mode
     (setq
-     org-modern--sp-width (list nil)
      org-modern--star-cache
      (vconcat (mapcar
                (lambda (x) (propertize x 'face 'org-modern-symbol))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]