branch: externals/valign
commit 994a4dc0d6c0460066a66c32d3e36814fc757bc2
Author: Yuan Fu <[email protected]>
Commit: Yuan Fu <[email protected]>
Advice outline
* valign.el (valign--org-flag-region-advice): Support outline.
(valign-mode): Advice outline.
---
valign.el | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/valign.el b/valign.el
index cdfe627..15ba961 100644
--- a/valign.el
+++ b/valign.el
@@ -638,7 +638,7 @@ When they are fontified next time."
;; part of it’s text, so we need to re-align. This function
;; runs before the region is flagged. When the text
;; is shown, jit-lock will make valign realign the text.
-(defun valign--org-flag-region-advice (beg end flag _)
+(defun valign--org-flag-region-advice (beg end flag &optional _)
"Valign hook, realign table between BEG and END."
(when (and (not flag)
(text-property-any beg end 'invisible 'org-link))
@@ -688,7 +688,10 @@ When they are fontified next time."
(advice-add 'markdown-toggle-inline-images
:after #'valign--force-align-buffer)
(advice-add 'markdown-table-align :after #'valign-table)
- (advice-add 'org-flag-region :before #'valign--org-flag-region-advice)
+ (advice-add 'org-flag-region
+ :before #'valign--org-flag-region-advice)
+ (advice-add 'outline-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,
@@ -718,6 +721,7 @@ When they are fontified next time."
(advice-remove 'org-table-align #'valign-table)
(advice-remove 'markdown-table-align #'valign-table)
(advice-remove 'org-flag-region #'valign--org-flag-region-advice)
+ (advice-remove 'outline-flag-region #'valign--org-flag-region-advice)
(advice-remove 'markdown-reload-extensions
#'valign--realign-on-refontification)
(advice-remove 'markdown-toggle-inline-images