emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: why does org-goto call org-latex-preview?
@ 2020-05-27  2:59 Vladimir Nikishkin
  2020-05-27  3:45 ` Kyle Meyer
  0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Nikishkin @ 2020-05-27  2:59 UTC (permalink / raw)
  To: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug: why does org-goto call org-latex-preview?
  2020-05-27  2:59 Bug: why does org-goto call org-latex-preview? Vladimir Nikishkin
@ 2020-05-27  3:45 ` Kyle Meyer
  2020-05-27  3:49   ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Kyle Meyer @ 2020-05-27  3:45 UTC (permalink / raw)
  To: Vladimir Nikishkin, emacs-orgmode

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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug: why does org-goto call org-latex-preview?
  2020-05-27  3:45 ` Kyle Meyer
@ 2020-05-27  3:49   ` Ihor Radchenko
  2020-05-27  4:20     ` Kyle Meyer
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2020-05-27  3:49 UTC (permalink / raw)
  To: Kyle Meyer, Vladimir Nikishkin, emacs-orgmode

> 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug: why does org-goto call org-latex-preview?
  2020-05-27  3:49   ` Ihor Radchenko
@ 2020-05-27  4:20     ` Kyle Meyer
  2020-05-28  4:26       ` [PATCH] goto: Avoid invoking org-mode for outline navigation Kyle Meyer
  0 siblings, 1 reply; 6+ messages in thread
From: Kyle Meyer @ 2020-05-27  4:20 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Vladimir Nikishkin, emacs-orgmode

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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] goto: Avoid invoking org-mode for outline navigation
  2020-05-27  4:20     ` Kyle Meyer
@ 2020-05-28  4:26       ` Kyle Meyer
  2020-09-05  7:42         ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Kyle Meyer @ 2020-05-28  4:26 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Vladimir Nikishkin, emacs-orgmode

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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] goto: Avoid invoking org-mode for outline navigation
  2020-05-28  4:26       ` [PATCH] goto: Avoid invoking org-mode for outline navigation Kyle Meyer
@ 2020-09-05  7:42         ` Bastien
  0 siblings, 0 replies; 6+ messages in thread
From: Bastien @ 2020-09-05  7:42 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: Vladimir Nikishkin, emacs-orgmode, Ihor Radchenko

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-05  7:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-27  2:59 Bug: why does org-goto call org-latex-preview? Vladimir Nikishkin
2020-05-27  3:45 ` Kyle Meyer
2020-05-27  3:49   ` Ihor Radchenko
2020-05-27  4:20     ` Kyle Meyer
2020-05-28  4:26       ` [PATCH] goto: Avoid invoking org-mode for outline navigation Kyle Meyer
2020-09-05  7:42         ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).