diff options
author | Jonathan Gregory <jgrg@autistici.org> | 2019-07-17 21:47:51 -0300 |
---|---|---|
committer | Jonathan Gregory <jgrg@autistici.org> | 2019-07-17 21:47:51 -0300 |
commit | 6f3011995d0cdca6ab4d810b065d5f563a42517d (patch) | |
tree | 83f5b68e114b5d00dbe3d8129a7085a360a51d7d | |
parent | 8c3189f0d3c227fc235c59a8267ddb15b043a978 (diff) |
Fix bug when preselecting headings
* helm-org.el (helm-org-in-buffer-preselect): Do it.
This happens if the heading contains brackets: [#A] etc. I'm also
moving the point to the closest heading.
-rw-r--r-- | helm-org.el | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/helm-org.el b/helm-org.el index cd338366..5dadcd8d 100644 --- a/helm-org.el +++ b/helm-org.el @@ -307,11 +307,14 @@ will be refiled." (org-refile nil nil rfloc)))))) (defun helm-org-in-buffer-preselect () - (if (org-on-heading-p) - (buffer-substring-no-properties (point-at-bol) (point-at-eol)) - (save-excursion - (outline-previous-visible-heading 1) - (buffer-substring-no-properties (point-at-bol) (point-at-eol))))) + "Return the current or closest visible heading as a regexp string." + (save-excursion + (cond ((org-at-heading-p) (forward-line 0)) + ((org-before-first-heading-p) + (outline-next-visible-heading 1)) + (t (outline-previous-visible-heading 1))) + (regexp-quote (buffer-substring-no-properties (point-at-bol) + (point-at-eol))))) (defun helm-org-run-refile-heading-to () (interactive) |