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

What's the difference between in-buffer-source and sync-source? #1789

Closed
xuchunyang opened this issue Jun 12, 2017 · 4 comments
Closed

What's the difference between in-buffer-source and sync-source? #1789

xuchunyang opened this issue Jun 12, 2017 · 4 comments

Comments

@xuchunyang
Copy link
Member

https://github.com/emacs-helm/helm/wiki/Developing#creating-a-source says:

  • helm-source-sync, which puts candidates in a list.
  • helm-source-in-buffer, which puts candidates in a buffer.

what does it mean for someone who is going to make a new command with helm? what's the advantage that in-buffer source can provide and how to make use of it?

The helm wiki provides two example uses for them, they are achieving the same purpose, so it doesn't help me understand the difference:

(helm-build-sync-source "test"
  :candidates '(a b c d e))

(helm-build-in-buffer-source "test1"
  :data '(a b c d e))
@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented Jun 12, 2017 via email

@xuchunyang
Copy link
Member Author

  • Allow modifying list of candidates dynamically while user type in
    pattern.

you meant with :volatile t? for example,

(helm :sources
      (helm-build-sync-source "test1"
        :volatile t
        :candidates
        (lambda ()
          (list 1 2 helm-pattern))))

So If I don't need to update the candidate list once it's created, I should use in-buffer source because it is faster, otherwise, I should use sync source.

@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented Jun 12, 2017 via email

@xuchunyang
Copy link
Member Author

Thanks for your explanation, it is helpful.

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