emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: Vladimir Nikishkin <lockywolf@gmail.com>,
	emacs-orgmode <emacs-orgmode@gnu.org>
Subject: [PATCH] goto: Avoid invoking org-mode for outline navigation
Date: Thu, 28 May 2020 04:26:07 +0000	[thread overview]
Message-ID: <87d06owuqo.fsf@kyleam.com> (raw)
In-Reply-To: <87r1v6vwis.fsf@kyleam.com>

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



  reply	other threads:[~2020-05-28  4:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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       ` Kyle Meyer [this message]
2020-09-05  7:42         ` [PATCH] goto: Avoid invoking org-mode for outline navigation Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d06owuqo.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=lockywolf@gmail.com \
    --cc=yantar92@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).