From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id MEkFMeC9d2EP1AAAgWs5BA (envelope-from ) for ; Tue, 26 Oct 2021 10:35:44 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id KFGRLOC9d2E4QgAAbx9fmQ (envelope-from ) for ; Tue, 26 Oct 2021 08:35:44 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1DFB711456 for ; Tue, 26 Oct 2021 10:35:44 +0200 (CEST) Received: from localhost ([::1]:35194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mfHvr-0008V5-A0 for larch@yhetil.org; Tue, 26 Oct 2021 04:35:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfHhI-0004Y0-BO for emacs-orgmode@gnu.org; Tue, 26 Oct 2021 04:20:40 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:37382) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfHhC-0001kv-RT for emacs-orgmode@gnu.org; Tue, 26 Oct 2021 04:20:39 -0400 Received: by mail-pf1-x430.google.com with SMTP id v193so6913459pfc.4 for ; Tue, 26 Oct 2021 01:20:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=7LriYAqvTKhqQaz326Eb4y6Qp56cinZ7QJO5yQv9cl0=; b=dTVmx4N4dq3JP+v3XKdiYoZppVxjqzpFg5q/RVd4ZzNlb/2erhZDSnF9neH9Eza+Dx x1UlmEZV9bXmD6hVPzoDVgOguwCEyUk6uSyx8dx+UsEHJsRpC6cA8/jlLOs+dVVz45La ZgZQYjY7fIHdS+1Ixz74jgg+O0BzCjf2jD0SDbLSKmNehufxDwjPuTMYZrVbyiuaUH04 PhqVJkwAUJvLXp+JzqAdHxNSURifsSEVEnTptR/bsnB10LZcWGOZqTQXHQYLo9zLPuH0 URWC0HI2vacjeCTHy/9cBThaXDppHSOEwzoaNWkM/OsnKz0dnE9DYHks7NG+Uf4vRWAi 58wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=7LriYAqvTKhqQaz326Eb4y6Qp56cinZ7QJO5yQv9cl0=; b=0PN1nAGWv1qwhcQfSx4VQ3oGzN1T63OY2gT6dWbGpcO3FdvsUaa65tZTpF1paJmvcl xkXQgQrQJicpVDWlnMH88IDk2wC5soJ1O7OCs5HavjLkTFZFQXd8PiO0MbCUCE6+oBgm XJZm/JG94OkcAYQDdPX6lvvcg+DOUp6RyQ0HrxZXG9zzx1dBwXHDstHmnVFzyhnQR8sX 2KUQgfdVhdFotG2BA1n68p4spp1vS2qtetAPUTsPaG51piMjmZsrUhMXDlKGBN1o+q/G c7jWPL6gR7zCeYdjwg1dC+laYiltwZLkjHyWEdEI4J42QoWhGxbCaPgKp7lTvgUlWYTm 1u9g== X-Gm-Message-State: AOAM531QMrE8EwPOsbhXowdVG0ytzpfyduDtodWxhdFWiDDjTeDm0EDs Jc8A/X3I4UaF+TwYb0BAXf+6hsrYzOh5og== X-Google-Smtp-Source: ABdhPJxpLQV7QauCGmivYLX7KGQX5NjDMJG4HK/LaIVZhalA3doeWhaBSLYg+u60i71ig3V5MxJjoA== X-Received: by 2002:a62:e707:0:b0:47b:e32f:8538 with SMTP id s7-20020a62e707000000b0047be32f8538mr15879318pfh.69.1635236432960; Tue, 26 Oct 2021 01:20:32 -0700 (PDT) Received: from localhost ([103.125.234.161]) by smtp.gmail.com with ESMTPSA id c85sm6557526pfc.146.2021.10.26.01.20.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Oct 2021 01:20:32 -0700 (PDT) From: Ihor Radchenko To: numbchild@gmail.com Subject: Re: [ISSUE] org-mode fill paragraph is slow and suspend often In-Reply-To: References: Date: Tue, 26 Oct 2021 16:21:57 +0800 Message-ID: <87cznsnql6.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=yantar92@gmail.com; helo=mail-pf1-x430.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Org Mode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1635237344; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=7LriYAqvTKhqQaz326Eb4y6Qp56cinZ7QJO5yQv9cl0=; b=IEwD2fR9J0DQA4I0AHws0UayiOB1E3brcXqZi8/D9Lah6axcyOF7ZsZCFBRUYuDY8SJa5I gwEP2Bya7YIB3khRuY/1LAMhmAq9hL5t2TBD3N8bGtQGwW0XYthVo8f59D5TKNc6xGfrWz aHw1xZxn/gce52+QTTQOVj6N8MfrSIsNcZmRgJhNqf3tau8nCq5XgODiq+8fJx/6k+RqPK B4qWUtWXbFA/5Z9aa6Et8rUGNL3hoGou41lEcsZFUYYYO+hkukYAGOmFBociBbHDeD/BLT ni765LQWy2l86VqS85EAQQJ+il+OZxVoIJYhDfN1rugMaw+EwaHAt3TIGH5B4g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635237344; a=rsa-sha256; cv=none; b=kZW1sZ9yqUKQMaBrO/Gy6hQUGg7eQX9plBAbQTRNPBY9+ydgSO02NmLVRZkgE1wwfjP9jr AC4VJR/kDt3ySjKzMZvmD0SvXijA6IGto4aqSmmjDXhHRZnHmIvyalRN0DwScjnYN3rwH7 Lv/LjqyIJoIzlqg/ryaR9I8GAdJknqiXJRrmFrC/Zd0TM2WGBioaOZ7K1rvWq0VZXJan/w Ii6P49p2F5okD74z4nBOkK4xee5ZHhSBfTgooSUPocb1BdouzicvrtVQrTwFH5aqvk+g+o QKWKfOqWJNQQjmLsgFf9FrWzUaK3TO7hhUFHAkH3FRSUO+lw9OAVWNdF26xPrw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=dTVmx4N4; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.63 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=dTVmx4N4; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 1DFB711456 X-Spam-Score: -2.63 X-Migadu-Scanner: scn0.migadu.com X-TUID: 2eo3WHrfUDOF --=-=-= Content-Type: text/plain "Christopher M. Miles" writes: > Emacs often suspend for a long time. > ... > 1467 26% - org-element--cache-sync > ... > 1334 23% - catch > 1332 23% - and > 1332 23% - org-indent-add-properties Thanks for reporting! It looks like competing catch..throw. Both org-indent and org-element are using `interrupt' signals. Can you try the attached patch and report back? Best, Ihor --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-element-cache-Rename-interrupt-org-element-cache.patch >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 --=-=-=--