emacs-helm / emacs-helm/helm-org

How to use (helm-org-capture-templates) within other persistent actions?

Open
#7 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Emacs Lisp
Stars
58
Forks
9
PR merge metrics
No merged PRs in 30d

Description

``` emacs-lisp
(require 'helm)
(require 'helm-org)

;; [...]

(defun my-helm-extension/org-capture (cand)
;; [some code to add my own `org-capture' templates...]
(helm-org-capture-templates))

(defvar my-helm-extension/helm-source
(helm-build-sync-source " My extension"
:candidates #'my-extension/compute-candidates
:action (helm-make-actions
"Org capture" #'my-helm-extension/org-capture)))

;;;###autoload
(defun my-helm-extension ()
"My Helm extension"
(interactive)
(helm :sources my-helm-extension/helm-source
:buffer "*my-helm-extension*"))
```

I've written a `helm` extension that is structured like this. The normal action `my-helm-extension/org-capture` works fine, but when I try to call the persistent version of this action with `C-j`, then `helm-alive-p` is `t`, `(helm--alive-p)` is `nil`, and I abort the `helm` session entirely at `helm-keyboard-quit`:

https://github.com/emacs-helm/helm/blob/c00b5826c1d5797debe92ed235d50b068a348c14/helm.el#L2455.

This is not what I expect; I want to perform the `org-capture` and subsequently return to the `my-helm-extension` `helm` session. Is it wrong of me to use `helm-org-capture-templates` in this manner?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the example action my-helm-extension/org-capture and helm-org-capture-templates, then trace the persistent-action path around helm.el line 2455 and helm-keyboard-quit. Reproduce the C-j behavior with the provided Helm extension and compare it with the normal action; done means org-capture runs and the original Helm session remains available afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
emacs-lisp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.