emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] org-agenda-list takes 4m compared to 27 that took 15 seconds [


From: Ihor Radchenko
Subject: Re: [BUG] org-agenda-list takes 4m compared to 27 that took 15 seconds [9.5.2 (release_9.5.2-25-gaf6f12 @ /usr/share/emacs/28.1/lisp/org/)]
Date: Tue, 13 Sep 2022 12:45:36 +0800

andrés ramírez <rrandresf@hotmail.com> writes:

> Hi. Ihor.
>
>>>>>> "Ihor" == Ihor Radchenko <yantar92@gmail.com> writes:
>
> [...]
>
>     Ihor> Can you then execute (setq org-element--cache-self-verify nil)
>     Ihor> and repeat the steps?
>
> Done.
>
> The produced file.

Thanks!

Now, can you execute the following and let me know if the performance is
back to satisfactory?

(setq org-element--cache-self-verify nil)
(defun org-back-to-heading (&optional invisible-ok)
  "Go back to beginning of heading."
  (beginning-of-line)
  (or (org-at-heading-p (not invisible-ok))
      (if (org-element--cache-active-p)
          (let ((heading (org-element-lineage (org-element-at-point)
                                           '(headline inlinetask)
                                           'include-self)))
            (when heading
              (goto-char (org-element-property :begin heading)))
            (while (and (not invisible-ok)
                        heading
                        (org-fold-folded-p))
              (goto-char (org-fold-core-previous-visibility-change))
              (setq heading (org-element-lineage (org-element-at-point)
                                              '(headline inlinetask)
                                              'include-self))
              (when heading
                (goto-char (org-element-property :begin heading))))
            (unless heading
              (user-error "Before first headline at position %d in buffer %s"
                          (point) (current-buffer)))
            (point))
        (let (found)
          (save-excursion
            ;; At inlinetask end.  Move to bol, so that the following
            ;; search goes to the beginning of the inlinetask.
            (when (and (featurep 'org-inlinetask)
                       (fboundp 'org-inlinetask-end-p)
                       (org-inlinetask-end-p))
              (goto-char (line-beginning-position)))
            (while (not found)
              (or (re-search-backward (concat "^\\(?:" outline-regexp "\\)")
                                      nil t)
                  (user-error "Before first headline at position %d in buffer 
%s"
                              (point) (current-buffer)))
              ;; Skip inlinetask end.
              (if (and (featurep 'org-inlinetask)
                       (fboundp 'org-inlinetask-end-p)
                       (org-inlinetask-end-p))
                  (org-inlinetask-goto-beginning)
                (setq found (and (or invisible-ok (not (org-fold-folded-p)))
                                 (point))))))
          (goto-char found)
          found))))

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92



reply via email to

[Prev in Thread] Current Thread [Next in Thread]