summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gregory <jgrg@autistici.org>2019-07-03 09:34:46 -0300
committerJonathan Gregory <jgrg@autistici.org>2019-07-03 09:34:46 -0300
commit2c00c5c9cb964e0243096aa07679c3e9dadfb1cb (patch)
tree215d471fa770003baa513cee6a40a653588fdb04
parentcdb68a269fcfa2545ef296d3f8b1e1ebc41a97e8 (diff)
Refactor helm-org--open-heading-in-indirect-buffer
* helm-org.el (helm-org--open-heading-in-indirect-buffer): Do it. The only change here is that the indirect buffer is shown without the actual file, so if helm-org-agenda-files-headings is called and the heading does not belong to the current buffer the file to which the heading belongs is not shown.
-rw-r--r--helm-org.el17
1 files changed, 8 insertions, 9 deletions
diff --git a/helm-org.el b/helm-org.el
index 373c0d48..8b2e845d 100644
--- a/helm-org.el
+++ b/helm-org.el
@@ -301,20 +301,19 @@ This command is set with the variable `org-archive-default-command'."
(defun helm-org--open-heading-in-indirect-buffer (marker)
"Go to MARKER and create an indirect buffer of the current subtree."
- (switch-to-buffer (marker-buffer marker))
- (goto-char (marker-position marker))
- (org-show-context)
- (org-tree-to-indirect-buffer)
- ;; Put the non-indirect buffer at the bottom of the prev-buffers
- ;; list so it won't be selected when the indirect buffer is killed
- (set-window-prev-buffers nil (append (cdr (window-prev-buffers))
- (car (window-prev-buffers)))))
+ (save-excursion
+ (helm-org-execute marker
+ (org-tree-to-indirect-buffer)
+ ;; Put the non-indirect buffer at the bottom of the prev-buffers
+ ;; list so it won't be selected when the indirect buffer is killed
+ (set-window-prev-buffers nil (append (cdr (window-prev-buffers))
+ (car (window-prev-buffers)))))))
(defun helm-org-run-open-heading-in-indirect-buffer ()
"Open selected subtree in an indirect buffer."
(interactive)
(with-helm-alive-p
- (helm-exit-and-execute-action #'helm-org--open-heading-in-indirect-buffer)))
+ (helm-exit-and-execute-action 'helm-org--open-heading-in-indirect-buffer)))
(put 'helm-org-run-open-heading-in-indirect-buffer 'helm-only t)
(defun helm-org-insert-link-to-heading-at-marker (marker)