Hello, everyone! Below is an excerpt of the profiler report after typing C-c C-j: - command-execute 2385 76% - call-interactively 2385 76% - funcall-interactively 1928 61% - org-goto 1878 60% - org-goto-location 1867 59% - org-mode 1861 59% - org-latex-preview 1590 51% - org--latex-preview-region 1590 51% - org-format-latex 1588 50% Why is it that org-goto enforces the regeneration of previews in a buffer? In my case, the buffer has a huge number of latex formulae, and in total is 65000 lines long, so I can't really wait till the regeneration finishes, just takes too much time. -- Yours sincerely, Vladimir Nikishkin
Vladimir Nikishkin writes:
> Why is it that org-goto enforces the regeneration of previews in a buffer?
It looks like an oversight to me. I think
org-startup-with-latex-preview should be let-bound to nil around
org-goto-location's call to org-mode. Likewise, I'd say that
org-startup-with-inline-images and org-startup-shrink-all-tables should
be let-bound to nil.
Assuming nobody chimes in to explain why that's a bad idea, I'll plan to
make those changes tomorrow night.
> It looks like an oversight to me. I think > org-startup-with-latex-preview should be let-bound to nil around > org-goto-location's call to org-mode. Likewise, I'd say that > org-startup-with-inline-images and org-startup-shrink-all-tables should > be let-bound to nil. Is there even a need to call the whole (org-mode). The new buffer is an indirect buffer. It should already have org-mode activated (at least, we can check for it and not call (org-mode) unnecessarily). If we just want to reset initial visibility, (org-overview) is already doing the job of (org-set-startup-visibility) from (org-mode). Best, Ihor Kyle Meyer <kyle@kyleam.com> writes: > Vladimir Nikishkin writes: > >> Why is it that org-goto enforces the regeneration of previews in a buffer? > > It looks like an oversight to me. I think > org-startup-with-latex-preview should be let-bound to nil around > org-goto-location's call to org-mode. Likewise, I'd say that > org-startup-with-inline-images and org-startup-shrink-all-tables should > be let-bound to nil. > > Assuming nobody chimes in to explain why that's a bad idea, I'll plan to > make those changes tomorrow night. > -- Ihor Radchenko, PhD, Center for Advancing Materials Performance from the Nanoscale (CAMP-nano) State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong University, Xi'an, China Email: yantar92@gmail.com, ihor_radchenko@alumni.sutd.edu.sg
Ihor Radchenko writes:
>> It looks like an oversight to me. I think
>> org-startup-with-latex-preview should be let-bound to nil around
>> org-goto-location's call to org-mode. Likewise, I'd say that
>> org-startup-with-inline-images and org-startup-shrink-all-tables should
>> be let-bound to nil.
>
> Is there even a need to call the whole (org-mode). The new buffer is
> an indirect buffer. It should already have org-mode activated (at least,
> we can check for it and not call (org-mode) unnecessarily). If we just
> want to reset initial visibility, (org-overview) is already doing the
> job of (org-set-startup-visibility) from (org-mode).
Hmm, thanks for taking a step back. It does seem like the org-mode call
should be unnecessary. (I haven't tried yet.) I wonder whether calling
org-mode could be a leftover from all the way back in 70b6cc5da (Release
5.10a, 2008-01-31), where there was a switch from using a normal buffer
to an indirect one.
Kyle Meyer writes: > Ihor Radchenko writes: > >> Is there even a need to call the whole (org-mode). The new buffer is >> an indirect buffer. It should already have org-mode activated (at least, >> we can check for it and not call (org-mode) unnecessarily). If we just >> want to reset initial visibility, (org-overview) is already doing the >> job of (org-set-startup-visibility) from (org-mode). > > Hmm, thanks for taking a step back. It does seem like the org-mode call > should be unnecessary. (I haven't tried yet.) Based on light testing, dropping the org-mode call doesn't seem to break anything. I don't use the outline interface to org-goto, so it'd be appreciated if anyone who does could try it out and see if anything feels off. -- >8 -- Subject: [PATCH] goto: Avoid invoking org-mode for outline navigation * lisp/org-goto.el (org-goto-location): Call make-indirect-buffer with a non-nil CLONE to preserve the base buffer's state, avoiding a more expensive call to org-mode. Reported-by: Vladimir Nikishkin <lockywolf@gmail.com> Suggested-by: Ihor Radchenko <yantar92@gmail.com> --- lisp/org-goto.el | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lisp/org-goto.el b/lisp/org-goto.el index 6d4c0cbf2..56786696e 100644 --- a/lisp/org-goto.el +++ b/lisp/org-goto.el @@ -234,20 +234,15 @@ (defun org-goto-location (&optional _buf help) (and (get-buffer "*org-goto*") (kill-buffer "*org-goto*")) (pop-to-buffer-same-window (condition-case nil - (make-indirect-buffer (current-buffer) "*org-goto*") - (error (make-indirect-buffer (current-buffer) "*org-goto*")))) + (make-indirect-buffer (current-buffer) "*org-goto*" t) + (error (make-indirect-buffer (current-buffer) "*org-goto*" t)))) (let (temp-buffer-show-function temp-buffer-show-hook) (with-output-to-temp-buffer "*Org Help*" (princ (format help (if org-goto-auto-isearch " Just type for auto-isearch." " n/p/f/b/u to navigate, q to quit."))))) (org-fit-window-to-buffer (get-buffer-window "*Org Help*")) - (setq buffer-read-only nil) - (let ((org-startup-truncated t) - (org-startup-folded nil) - (org-startup-align-all-tables nil)) - (org-mode) - (org-overview)) + (org-overview) (setq buffer-read-only t) (if (and (boundp 'org-goto-start-pos) (integer-or-marker-p org-goto-start-pos)) base-commit: 516c038e5f65911c32de1054925ce9e848c3f2d7 -- 2.26.2
Hi Kyle,
Kyle Meyer <kyle@kyleam.com> writes:
> Kyle Meyer writes:
>
>> Ihor Radchenko writes:
>>
>>> Is there even a need to call the whole (org-mode). The new buffer is
>>> an indirect buffer. It should already have org-mode activated (at least,
>>> we can check for it and not call (org-mode) unnecessarily). If we just
>>> want to reset initial visibility, (org-overview) is already doing the
>>> job of (org-set-startup-visibility) from (org-mode).
>>
>> Hmm, thanks for taking a step back. It does seem like the org-mode call
>> should be unnecessary. (I haven't tried yet.)
>
> Based on light testing, dropping the org-mode call doesn't seem to break
> anything. I don't use the outline interface to org-goto, so it'd be
> appreciated if anyone who does could try it out and see if anything
> feels off.
I tested the patch and M-x org-goto RET and things run fine here.
I applied your patch against maint.
Thanks!
--
Bastien