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

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

[elpa] externals/valign cf4f9c9 059/198: * valign.el (valign-initial-ali


From: Stefan Monnier
Subject: [elpa] externals/valign cf4f9c9 059/198: * valign.el (valign-initial-alignment): Check buffer visibility.
Date: Tue, 1 Dec 2020 18:19:16 -0500 (EST)

branch: externals/valign
commit cf4f9c966211936ac1ccb432c6ccabc4efcdac70
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>

    * valign.el (valign-initial-alignment): Check buffer visibility.
---
 valign.el | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/valign.el b/valign.el
index 643d852..d3a9a96 100644
--- a/valign.el
+++ b/valign.el
@@ -375,15 +375,19 @@ white space stretching to XPOS, a pixel x position."
   "Perform initial alignment for tables between BEG and END.
 Supposed to be called from jit-lock.
 Force align if FORCE non-nil."
-  (if (or force (text-property-any beg end 'valign-init nil))
-      (save-excursion
-        (goto-char beg)
-        (while (and (search-forward "|" nil t)
-                    (< (point) end))
-          (valign-table)
-          (valign--end-of-table))
-        (with-silent-modifications
-          (put-text-property beg (point) 'valign-init t))))
+  ;; Technically we don’t need to check if the current buffer
+  ;; is visible, but third-party packages refontify buffers
+  ;; before they are visible, like org-superstart.
+  (when ((get-buffer-window (current-buffer))
+         (or force (text-property-any beg end 'valign-init nil)))
+    (save-excursion
+      (goto-char beg)
+      (while (and (search-forward "|" nil t)
+                  (< (point) end))
+        (valign-table)
+        (valign--end-of-table))
+      (with-silent-modifications
+        (put-text-property beg (point) 'valign-init t))))
   (cons 'jit-lock-bounds (cons beg end)))
 
 (defun valign-always-align (beg end)



reply via email to

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