emacs-orgmode
[Top][All Lists]
Advanced

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

[PATCH] goto: Avoid invoking org-mode for outline navigation


From: Kyle Meyer
Subject: [PATCH] goto: Avoid invoking org-mode for outline navigation
Date: Thu, 28 May 2020 04:26:07 +0000

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 via email to

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