From b556ed8995f375e57496f3482aef4b0def565de8 Mon Sep 17 00:00:00 2001 From: Eric Danan Date: Fri, 14 Feb 2020 14:50:43 +0000 Subject: [PATCH] cp-org-capture: Allow placing project templates after general ones A new variable `counsel-projectile-org-capture-templates-first-p` is created. Fixes #146 --- counsel-projectile.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/counsel-projectile.el b/counsel-projectile.el index cf121fc..2b95713 100644 --- a/counsel-projectile.el +++ b/counsel-projectile.el @@ -1059,6 +1059,11 @@ The format is the same as in `org-capture-templates-contexts'." (string :tag " name"))) :group 'counsel-projectile) +(defcustom counsel-projectile-org-capture-templates-first-p t + "Non-nil if `counsel-projectile-org-capture' should display templates from `counsel-projectile-org-capture-templates' before those from `org-capture-templates'." + :type 'boolean + :group 'counsel-projectile) + (defvar counsel-projectile--org-capture-templates-backup nil "Stores a backup of `org-capture-templates'.") @@ -1094,6 +1099,8 @@ capture." org-capture-templates-contexts)) (org-capture-templates (append + (unless counsel-projectile-org-capture-templates-first-p + org-capture-templates) (when root (cl-loop with replace-fun = `(lambda (string) @@ -1118,7 +1125,8 @@ capture." collect x) else collect item))) - org-capture-templates))) + (when counsel-projectile-org-capture-templates-first-p + org-capture-templates)))) (ivy-add-actions 'counsel-org-capture counsel-projectile-org-capture-extra-actions)