Skip to content

Commit

Permalink
worf.el (worf--rfloc): Re-use zo-goto-heading
Browse files Browse the repository at this point in the history
  • Loading branch information
abo-abo committed Aug 26, 2021
1 parent c82d41f commit aab516c
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions worf.el
Original file line number Diff line number Diff line change
Expand Up @@ -1221,20 +1221,10 @@ This is accomplished by putting it at the start of `org-refile-history'."
(with-selected-window target-window
(save-buffer))))

(defun worf--goto-heading (heading)
"Goto a top-level HEADING and set the match data.
Insert HEADING if it doesn't exist."
(let ((regex (concat "^\\* " heading)))
(goto-char (point-min))
(unless (re-search-forward regex nil t)
(goto-char (point-max))
(insert "* " heading)
(looking-back regex (line-beginning-position)))))

(defun worf--rfloc (fname heading)
(with-current-buffer (find-file-noselect fname)
(save-excursion
(worf--goto-heading heading)
(zo-goto-heading heading)
(list (save-match-data (org-get-heading))
(buffer-file-name)
org-heading-regexp
Expand Down

0 comments on commit aab516c

Please sign in to comment.