From cb0a73d58d429b62576822a98235a6bd3ff85809 Mon Sep 17 00:00:00 2001 Message-Id: From: Ihor Radchenko Date: Tue, 26 Oct 2021 16:14:40 +0800 Subject: [PATCH] org-element-cache: Rename `interrupt' `org-element--cache-interrupt' * lisp/org-element.el (org-element--cache-sync, org-element--cache-process-request, org-element--parse-to): Some other code (at least, `org-indent-mode') is using `interrupt' signal in `after-change-functions'. Rename `interrupt' signal used in org-element-cache to unique `org-element--cache-interrupt'. Reported in https://list.orgmode.org/PAXPR08MB66400699DACEB31F4F0650F1A3849@PAXPR08MB6640.eurprd08.prod.outlook.com/T/#u --- lisp/org-element.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index acc6c56c2..33c7a4051 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -5818,7 +5818,7 @@ (defun org-element--cache-sync (buffer &optional threshold future-change) (when org-element--cache-sync-timer (cancel-timer org-element--cache-sync-timer)) (let ((time-limit (time-add nil org-element-cache-sync-duration))) - (catch 'interrupt + (catch 'org-element--cache-interrupt (when org-element--cache-sync-requests (org-element--cache-log-message "Syncing down to %S-%S" (or future-change threshold) threshold)) (while org-element--cache-sync-requests @@ -5877,8 +5877,8 @@ (defun org-element--cache-process-request not registered yet in the cache are going to happen. See `org-element--cache-submit-request' for more information. -Throw `interrupt' if the process stops before completing the -request." +Throw `org-element--cache-interrupt' if the process stops before +completing the request." (org-element--cache-log-message "org-element-cache: Processing request %s up to %S-%S, next: %S" (let ((print-length 10) (print-level 3)) (prin1-to-string request)) future-change @@ -5899,7 +5899,7 @@ (defun org-element--cache-process-request (while t (when (org-element--cache-interrupt-p time-limit) (org-element--cache-log-message "Interrupt: time limit") - (throw 'interrupt nil)) + (throw 'org-element--cache-interrupt nil)) (let ((request-key (org-element--request-key request)) (end (org-element--request-end request)) (node (org-element--cache-root)) @@ -6012,7 +6012,7 @@ (defun org-element--cache-process-request (let ((limit (+ (org-element--request-beg request) (org-element--request-offset request)))) (cond ((and threshold (> limit threshold)) (org-element--cache-log-message "Interrupt: position %d after threshold %d" limit threshold) - (throw 'interrupt nil)) + (throw 'org-element--cache-interrupt nil)) ((and future-change (>= limit future-change)) ;; Changes happened around this element and they will ;; trigger another phase 1 request. Skip re-parenting @@ -6086,7 +6086,7 @@ (defun org-element--cache-process-request (org-element--cache-log-message "Interrupt: %s" (if exit-flag "threshold" "time limit")) (setf (org-element--request-key request) key) (setf (org-element--request-parent request) parent) - (throw 'interrupt nil)) + (throw 'org-element--cache-interrupt nil)) ;; Shift element. (unless (zerop offset) (when (>= org-element--cache-diagnostics-level 3) @@ -6207,8 +6207,9 @@ (defun org-element--parse-to (pos &optional syncp time-limit) When optional argument SYNCP is non-nil, return the parent of the element containing POS instead. In that case, it is also possible to provide TIME-LIMIT, which is a time value specifying -when the parsing should stop. The function throws `interrupt' if -the process stopped before finding the expected result." +when the parsing should stop. The function throws +`org-element--cache-interrupt' if the process stopped before finding +the expected result." (catch 'exit (save-match-data (org-with-wide-buffer @@ -6280,7 +6281,7 @@ (defun org-element--parse-to (pos &optional syncp time-limit) (parent (org-element-property :parent element))) (while t (when (org-element--cache-interrupt-p time-limit) - (throw 'interrupt nil)) + (throw 'org-element--cache-interrupt nil)) (when (and inhibit-quit org-element--cache-interrupt-C-g quit-flag) (when quit-flag (cl-incf org-element--cache-interrupt-C-g-count) -- 2.32.0