summaryrefslogtreecommitdiff
path: root/helm-org.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2016-09-12 06:58:24 +0200
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2016-09-12 06:58:24 +0200
commit7fcf4f8b62fb7cd136f3eb08b6316a8f022a6031 (patch)
tree2b32938c031bff9e0557c244c81cce35849a88e3 /helm-org.el
parent20475c72b05a010a8dfcf289723583dcd5cbd822 (diff)
Preselect current heading in helm-org-in-buffer (#1601).
* helm-org.el (helm-org-in-buffer-preselect): New. (helm-org-in-buffer-headings): Use it.
Diffstat (limited to 'helm-org.el')
-rw-r--r--helm-org.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/helm-org.el b/helm-org.el
index d18a21e0..29d602c2 100644
--- a/helm-org.el
+++ b/helm-org.el
@@ -236,6 +236,13 @@ Note this have no effect in `helm-org-in-buffer-headings'."
(org-end-of-subtree t t)
(org-paste-subtree (+ target-level 1)))))
+(defun helm-org-in-buffer-preselect ()
+ (if (org-on-heading-p)
+ (buffer-substring-no-properties (point-at-bol) (point-at-eol))
+ (save-excursion
+ (org-previous-visible-heading 1)
+ (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))
+
(defun helm-org-run-heading-refile ()
(interactive)
(with-helm-alive-p
@@ -255,10 +262,11 @@ Note this have no effect in `helm-org-in-buffer-headings'."
(defun helm-org-in-buffer-headings ()
"Preconfigured helm for org buffer headings."
(interactive)
- (let ((helm-org-show-filename nil))
+ (let (helm-org-show-filename helm-org-format-outline-path)
(helm :sources (helm-source-org-headings-for-files
(list (current-buffer)))
:candidate-number-limit 99999
+ :preselect (helm-org-in-buffer-preselect)
:truncate-lines helm-org-truncate-lines
:buffer "*helm org inbuffer*")))