Skip to content

Commit fa8f525

Browse files
Merge pull request #19 from TheBB/master
Miscellaneous
2 parents 035a53d + 1d944fe commit fa8f525

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

org-projectile.el

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ location of the filepath cache."
255255
(switch-to-buffer (find-file-noselect filename))
256256
(funcall org-projectile:project-name-to-location project-name)))
257257

258-
(defun org-projectile:target-subheading-and-return-marker ()
258+
(defun org-projectile:target-subheading-and-return-marker (&optional for-insert)
259259
(org-end-of-line)
260260
(org-projectile:end-of-properties)
261261
;; It sucks that this has to be done, but we have to insert a
@@ -348,8 +348,11 @@ location of the filepath cache."
348348

349349
(defvar dired-buffers)
350350

351-
(defun org-projectile:capture-for-project (project-name &optional capture-template)
352-
(org-capture-set-plist (org-projectile:project-todo-entry nil capture-template))
351+
(defun org-projectile:capture-for-project
352+
(project-name &optional capture-template &rest additional-options)
353+
(org-capture-set-plist
354+
(apply #'org-projectile:project-todo-entry
355+
nil capture-template nil additional-options))
353356
;; TODO: super gross that this had to be copied from org-capture,
354357
;; Unfortunately, it does not seem to be possible to call into org-capture
355358
;; because it makes assumptions that make it impossible to set things up
@@ -431,7 +434,9 @@ location of the filepath cache."
431434
(progn
432435
(goto-char (point-max))
433436
(or (bolp) (insert "\n"))
434-
(insert "* " linked-heading)
437+
(let ((org-insert-heading-respect-content t))
438+
(org-insert-heading nil nil t))
439+
(insert linked-heading)
435440
(when org-projectile:counts-in-heading (insert " [/]"))))
436441
(nth 4 (org-heading-components))))
437442

@@ -520,25 +525,29 @@ as the capture template."
520525
(user-error "%s" "This command is only available to helm users. Install helm and try again.")))
521526

522527
;;;###autoload
523-
(defun org-projectile:project-todo-completing-read (&optional capture-template)
528+
(defun org-projectile:project-todo-completing-read
529+
(&optional capture-template &rest additional-options)
524530
"Select a project using a `projectile-completing-read' and record a TODO.
525531
526532
If CAPTURE-TEMPLATE is provided use it as the capture template for the TODO."
527533
(interactive)
528-
(org-projectile:capture-for-project
534+
(apply
535+
#'org-projectile:capture-for-project
529536
(projectile-completing-read "Record TODO for project: "
530537
(org-projectile:known-projects))
531-
capture-template))
538+
capture-template additional-options))
532539

533540
;;;###autoload
534-
(defun org-projectile:capture-for-current-project (&optional capture-template)
541+
(defun org-projectile:capture-for-current-project
542+
(&optional capture-template &rest additional-options)
535543
"Capture a TODO for the current active projectile project.
536544
537545
If CAPTURE-TEMPLATE is provided use it as the capture template for the TODO."
538546
(interactive)
539547
(let ((project-name (projectile-project-name)))
540548
(if (projectile-project-p)
541-
(org-projectile:capture-for-project project-name capture-template)
549+
(apply #'org-projectile:capture-for-project
550+
project-name capture-template additional-options)
542551
(error (format "%s is not a recognized projectile project." project-name)))))
543552

544553
(provide 'org-projectile)

0 commit comments

Comments
 (0)