This function selects one of the items in projectile's project list, but when I cancel the select using Ctrl-G an item is still returned. Whatever candidate the selection is on is returned even if the dialog is cancelled.

Is there some setting to override this behaviour?

  (defun vh-select-project()
    (let ( (projectlist
                     ;;(insert "(progn\n")
                     (insert-file-contents-literally (expand-file-name "projectile-bookmarks.eld" user-emacs-directory))
                     (goto-char (point-max))
                     ;;(insert "\n)")
                     (read (buffer-string)))))

           (input (progn
                    (helm :sources
                          (list (helm-build-sync-source "Select project:"
                                  :candidates projectlist)))
      (when project
        (insert (car project) ""))

1 Answer 1


You're missing the action slot (see the last line):

(helm :sources (helm-build-sync-source "Select project:"
                 :candidates projectile-known-projects
                 :action 'insert))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.