cp-org-capture: fix when used as switch-project action
Make sure `counsel-org-capture' is called from the initial buffer (the one from which we called `counsel-projectile-switch-project') rather than the switch-project buffer.
This commit is contained in:
parent
5aa8a0bc8e
commit
162f99881a
1 changed files with 6 additions and 3 deletions
|
|
@ -904,7 +904,7 @@ The format is the same as in `org-capture-templates-contexts'."
|
||||||
:group 'counsel-projectile)
|
:group 'counsel-projectile)
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun counsel-projectile-org-capture ()
|
(defun counsel-projectile-org-capture (&optional from-buffer)
|
||||||
"Org-capture into the current project.
|
"Org-capture into the current project.
|
||||||
|
|
||||||
The capture templates are read from the variables
|
The capture templates are read from the variables
|
||||||
|
|
@ -940,7 +940,8 @@ The capture templates are read from the variables
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(ivy-add-prompt-count
|
(ivy-add-prompt-count
|
||||||
(projectile-prepend-project-name (ivy-state-prompt ivy-last)))))
|
(projectile-prepend-project-name (ivy-state-prompt ivy-last)))))
|
||||||
(counsel-org-capture)))
|
(with-current-buffer (or from-buffer (current-buffer))
|
||||||
|
(counsel-org-capture))))
|
||||||
|
|
||||||
;;;; counsel-projectile-switch-project
|
;;;; counsel-projectile-switch-project
|
||||||
|
|
||||||
|
|
@ -1138,7 +1139,9 @@ action."
|
||||||
|
|
||||||
(defun counsel-projectile-switch-project-action-org-capture (project)
|
(defun counsel-projectile-switch-project-action-org-capture (project)
|
||||||
"Org-capture into PROJECT."
|
"Org-capture into PROJECT."
|
||||||
(let ((projectile-switch-project-action 'counsel-projectile-org-capture))
|
(let* ((from-buffer (ivy-state-buffer ivy-last))
|
||||||
|
(projectile-switch-project-action `(lambda ()
|
||||||
|
(counsel-projectile-org-capture ,from-buffer))))
|
||||||
(counsel-projectile-switch-project-by-name project)))
|
(counsel-projectile-switch-project-by-name project)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue