[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-modern b826d840c6 073/105: Merge branch 'org-buffer
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-modern b826d840c6 073/105: Merge branch 'org-buffer-init-hook' |
Date: |
Tue, 15 Apr 2025 13:01:05 -0400 (EDT) |
branch: externals/org-modern
commit b826d840c66ba81f40a2c5028a4c893eeee602e6
Merge: a4d242994d 8afea0fec4
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>
Merge branch 'org-buffer-init-hook'
Adds support for `org-indent-post-buffer-init-functions', set to
appear in Org v9.7.
---
org-modern-indent.el | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/org-modern-indent.el b/org-modern-indent.el
index 57a04cc5b1..a70aa77cdb 100644
--- a/org-modern-indent.el
+++ b/org-modern-indent.el
@@ -163,13 +163,11 @@ returned."
(defvar-local org-modern-indent--init nil)
(defun org-modern-indent--wait-and-refresh (buf)
"Wait for org-indent to finish initializing BUF, then refresh."
- (when (buffer-live-p buf)
- (if (or (not (bound-and-true-p org-indent-agentized-buffers))
- (not (memq buf org-indent-agentized-buffers)))
- (with-current-buffer buf
- (font-lock-add-keywords nil org-modern-indent--font-lock-keywords t)
- (font-lock-flush))
- ;; still waiting
+ (if (or (not (bound-and-true-p org-indent-agentized-buffers))
+ (not (memq buf org-indent-agentized-buffers)))
+ (org-modern-indent--add-keywords buf)
+ ;; still waiting
+ (when (buffer-live-p buf)
(with-current-buffer buf
(if org-modern-indent--init
(let ((cnt (cl-incf (cadr org-modern-indent--init))))
@@ -185,6 +183,14 @@ returned."
(list (run-at-time 0.1 nil #'org-modern-indent--wait-and-refresh buf)
1)))))))
+(defun org-modern-indent--add-keywords (buf)
+ "Add keywords to buffer BUF and refresh.
+To be added to `org-indent-post-buffer-init-functions'."
+ (when (buffer-live-p buf) ; org-capture buffers vanish fast
+ (with-current-buffer buf
+ (font-lock-add-keywords nil org-modern-indent--font-lock-keywords t)
+ (font-lock-flush))))
+
(defun org-modern-indent--refresh ()
"Unfontify entire buffer and refresh line prefix."
(with-silent-modifications
@@ -232,20 +238,28 @@ END, and R are its arguments."
"Org-modern-like block brackets within org-indent."
:global nil
:group 'org-modern-indent
-
(if org-modern-indent-mode
(progn
(advice-add 'org-indent-refresh-maybe :around
#'org-modern-indent--refresh-watch)
(advice-add 'org-indent-add-properties :filter-args
#'org-modern-indent--store-refresh-args)
- (org-modern-indent--wait-and-refresh (current-buffer)))
+ (if (boundp 'org-indent-post-buffer-init-functions)
+ (add-hook 'org-indent-post-buffer-init-functions
+ #'org-modern-indent--add-keywords)
+ ;; No hook available, use the less reliable method
+ (org-modern-indent--wait-and-refresh (current-buffer))))
;; Disabling
(advice-remove 'org-indent-refresh-maybe
#'org-modern-indent--refresh-watch)
(advice-remove 'org-indent-add-properties
#'org-modern-indent--store-refresh-args)
(font-lock-remove-keywords nil org-modern-indent--font-lock-keywords)
+ (if (boundp 'org-indent-post-buffer-init-functions)
+ (remove-hook 'org-indent-post-buffer-init-functions
+ #'org-modern-indent--add-keywords)
+ (cancel-timer (car org-modern-indent--init))
+ (setq org-modern-indent--init nil))
(org-modern-indent--refresh)))
(provide 'org-modern-indent)
- [elpa] externals/org-modern c8671f2af0 067/105: Update README.md, (continued)
- [elpa] externals/org-modern c8671f2af0 067/105: Update README.md, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern 3793964555 078/105: Update README.md, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern 24ce7f35f7 076/105: Make `org-indent` requirement more prominent, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern ca440cd414 084/105: major rewrite using org-element + before/after-change-functions, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern fcd4368476 085/105: after-change: ensure beg/end fully span lines, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern fdeede3484 094/105: Merge 'org-modern-indent/main' into org-modern-indent, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern a3ac3e2f12 096/105: org-modern-indent: update header information as new extension, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern 6457c3d0a6 069/105: Add org-indent face to wrap-prefix for indented blocks, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern 8cad2c3d83 105/105: Merge pull request #281 from minad/org-modern-indent, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern e118f7edf0 019/105: Update README.md, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern b826d840c6 073/105: Merge branch 'org-buffer-init-hook',
ELPA Syncer <=
- [elpa] externals/org-modern e02b7d109f 016/105: Add package description and omit org-modern from requires, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern a7b22acf5e 024/105: Define face for org-modern-indent, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern b722c64062 045/105: Update README.md, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern 952abf3a54 041/105: Update README.md, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern 1abf8c7ba4 001/105: Initial commit, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern bc77d6129f 003/105: Do not extend end block styling beyond end line., ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern 9874203365 013/105: Add autoload, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern edbab4a407 018/105: Update README.md, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern 022400a0f6 030/105: Initial implementation of font-lock-only in-text and prefix brackets, ELPA Syncer, 2025/04/15
- [elpa] externals/org-modern 747fa7ef2b 046/105: Update README.md, ELPA Syncer, 2025/04/15