[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/valign 5b9a086 038/198: Fix edge case
From: |
Stefan Monnier |
Subject: |
[elpa] externals/valign 5b9a086 038/198: Fix edge case |
Date: |
Tue, 1 Dec 2020 18:19:12 -0500 (EST) |
branch: externals/valign
commit 5b9a0864351e0fd7c2c7a0edfa059dd78c0fddeb
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Fix edge case
When we enable valign-mode when a org buffer is in another window.
* valign.el (valign-mode): Add check for visibility.
---
valign.el | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/valign.el b/valign.el
index 09451dd..9d0faeb 100644
--- a/valign.el
+++ b/valign.el
@@ -533,13 +533,18 @@ When they are fontified next time."
(advice-add 'org-flag-region :before #'valign--org-flag-region-advice)
;; Force jit-lock to refontify (and thus realign) the buffer.
(dolist (buf (buffer-list))
+ ;; If the buffer is visible, realign immediately, if not,
+ ;; realign when it becomes visible.
(with-current-buffer buf
(when (derived-mode-p 'org-mode)
- (with-silent-modifications
- (put-text-property
- (point-min) (point-max) 'fontified nil)
- (put-text-property
- (point-min) (point-max) 'valign-init nil))))))
+ (if (get-buffer-window buf t)
+ (with-selected-window (get-buffer-window buf t)
+ (valign-initial-alignment (point-min) (point-max) t))
+ (with-silent-modifications
+ (put-text-property
+ (point-min) (point-max) 'fontified nil)
+ (put-text-property
+ (point-min) (point-max) 'valign-init nil)))))))
(remove-hook 'org-mode-hook #'valign--org-mode-hook)
(remove-hook 'org-agenda-finalize-hook #'valign--force-align-buffer)
(advice-remove 'org-toggle-inline-images #'valign--force-align-buffer)
- [elpa] externals/valign fc4c812 044/198: * valign.el (valign-mode): Advice org-table-align instead., (continued)
- [elpa] externals/valign fc4c812 044/198: * valign.el (valign-mode): Advice org-table-align instead., Stefan Monnier, 2020/12/01
- [elpa] externals/valign 1e9e16b 045/198: * valign.el (valign--align-separator-row): New implementation for gfm-mode., Stefan Monnier, 2020/12/01
- [elpa] externals/valign 03da172 011/198: Various fixes, Stefan Monnier, 2020/12/01
- [elpa] externals/valign b0cea9f 012/198: Make point appear in the middle for empty cells, Stefan Monnier, 2020/12/01
- [elpa] externals/valign eea08cc 023/198: Re add org-agenda support., Stefan Monnier, 2020/12/01
- [elpa] externals/valign 2a60a4d 025/198: Remove valign-setup, Stefan Monnier, 2020/12/01
- [elpa] externals/valign e555277 029/198: Add with-silent-modification, Stefan Monnier, 2020/12/01
- [elpa] externals/valign bdb56ce 032/198: Sync all org mode alignment state automatically, Stefan Monnier, 2020/12/01
- [elpa] externals/valign 3c70c15 034/198: * valign.el (valign-mode): Fix., Stefan Monnier, 2020/12/01
- [elpa] externals/valign 3752d53 036/198: Solve a bunch of edge cases, Stefan Monnier, 2020/12/01
- [elpa] externals/valign 5b9a086 038/198: Fix edge case,
Stefan Monnier <=
- [elpa] externals/valign 8cfe0ca 039/198: * valign.el (valign-separator-row-style): Add choice definition., Stefan Monnier, 2020/12/01
- [elpa] externals/valign 927d82d 041/198: Support indented tables, Stefan Monnier, 2020/12/01
- [elpa] externals/valign 81de913 042/198: Property support tabs, Stefan Monnier, 2020/12/01
- [elpa] externals/valign db0c4d8 043/198: Add support for markdown tables, Stefan Monnier, 2020/12/01
- [elpa] externals/valign da56833 047/198: Always realign markdown tables, Stefan Monnier, 2020/12/01
- [elpa] externals/valign e885f67 048/198: Merge branch 'markdown', Stefan Monnier, 2020/12/01
- [elpa] externals/valign cd7c17f 052/198: Fix infinite loop, Stefan Monnier, 2020/12/01
- [elpa] externals/valign 638f978 054/198: Fix infinite loop!!, Stefan Monnier, 2020/12/01
- [elpa] externals/valign 994a4dc 056/198: Advice outline, Stefan Monnier, 2020/12/01
- [elpa] externals/valign cf4f9c9 059/198: * valign.el (valign-initial-alignment): Check buffer visibility., Stefan Monnier, 2020/12/01