Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add a custom action to a helm-source? #2078

Closed
student-sx opened this issue Aug 15, 2018 · 4 comments
Closed

How to add a custom action to a helm-source? #2078

student-sx opened this issue Aug 15, 2018 · 4 comments

Comments

@student-sx
Copy link

student-sx commented Aug 15, 2018

How can I add a custom action to an existing helm-source? In particular I want to add an action to a recoll source. Here is what I tried and as comment, what doesn't work:

;; Define custom action:

(defun test-action (candidate)
(message (format "Filename: %s" (helm-get-selection)))
)

(helm-recoll-create-source "main" "~/.recoll")

;; 1. approach:

(helm-add-action-to-source "Test 1" 'test-action helm-source-recoll-main 0)

;; Action doesn't show up with first approach

;; 2. approach


;; (defmethod helm-setup-user-source ((source helm-source-recoll-main))
;;   (let ((actions (slot-value source 'action)))
;;     (set-slot-value source 'action
;; 		    ("Test 2" . 'test-action))))

;; Error Unknown specializer helm-source-recoll-main with second method


;; Test:
(helm :sources 'helm-source-recoll-main)


;; Test action with custom source works:

;; (defvar helm-source-test
;;   (helm-build-async-source "helm-source-test"
;;     :candidates-process
;;     (lambda ()
;;       (start-process "echo" nil "recoll" "-q" "-t" helm-pattern))
;;     :action '( 
;; 	      ("test" . test-action)
;; 	      )
;;     )
;;   )

;; (helm :sources 'helm-source-test)

My versions: helm-core: 20180712.837, helm-recoll: 20160731.921

@thierryvolpiatto
Copy link
Member

Please report to helm-recoll directly, thanks.

@student-sx
Copy link
Author

So you would say that my code should work in principle and that it is just a helm-recoll bug?

@student-sx
Copy link
Author

Moved it to: emacs-helm/helm-recoll#15

@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented Aug 16, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants