kawabata / helm-chrome

Helm interface for Chrome bookmarks
21 stars 4 forks source link

Initialize the source of helm-chrome? #7

Closed ReneFroger closed 8 years ago

ReneFroger commented 8 years ago

Hi Kawabata,

Thanks for sharing this package! It's really appreciated. However, I would like to add the source of helm-chrome to my list of helm-for-files in order to do this, I added helm-chrome-source to helm-for-files-preferred-list:

(setq helm-for-files-preferred-list '(helm-source-buffers-list
                                      helm-source-projectile-files-list
                                      helm-source-recentf
                                      helm-source-files-in-current-dir
                                      helm-source-bookmarks
                                      helm-source-projectile-projects 
                                      helm-source-locate
                                      helm-chrome-source
                                      )))

When I call M-x helm-chrome-bookmarks, closing it and then call helm-for-files, I see the list of my Chrome bookmarks is added in helm-for-files.

But when I restart Emacs, and then call helm-for-files, I cannot open it because the source helm-chrome-source is unknown for Helm. I can only solve this when I manually call helm-chrome-bookmarks. After that, I'm able to open helm-for-files again. So I suspect the source of helm-chrome-bookmarks is being autoloaded, as it seems in your code But my Lisp knowledge is not sufficient enough.

So do you have some suggestion in order to solve the initialization issue? Thanks in advance for your reply.

kawabata commented 8 years ago

As far as I know, the best way to realize it is to use 'with-eval-after-load'.

As 'helm-for-files-preferred-list' is defined in 'helm-files',

(with-eval-after-load 'helm-files
  (require 'helm-chrome)
  (setq helm-for-files-preferred-list ...))

would be sufficient. If you are using `use-package' macro, then,

(use-package helm-chrome :defer t
  :init
  (with-eval-after-load 'helm-files...
  (set-variable 'helm-for-files-preferred-list
                       .....)))

might be O.K., too. (In that case, init part will not be executed at init time if helm-chrome is not installed.)

Regards,

On Wed, Dec 2, 2015 at 4:29 AM, ReneFroger notifications@github.com wrote:

Hi Kawabata,

Thanks for sharing this package! It's really appreciated. However, I would like to add the source of helm-chrome to my list of helm-for-files in order to do this, I added helm-chrome-source to helm-for-files-preferred-list:

(setq helm-for-files-preferred-list '(helm-source-buffers-list helm-source-projectile-files-list helm-source-recentf helm-source-files-in-current-dir helm-source-bookmarks helm-source-projectile-projects helm-source-locate helm-chrome-source )))

When I call M-x helm-chrome-bookmarks, closing it and then call helm-for-files, I see the list of my Chrome bookmarks is added in helm-for-files.

But when I restart Emacs, and then call helm-for-files, I cannot open it because the source helm-chrome-source is unknown for Helm. I can only solve this when I manually call helm-chrome-bookmarks. After that, I'm able to open helm-for-files again. So I suspect the source of helm-chrome-bookmarks is being autoloaded, as it seems in your code https://github.com/kawabata/helm-chrome/blob/master/helm-chrome.el#L95 But my Lisp knowledge is not sufficient enough.

So do you have some suggestion in order to solve the initialization issue? Thanks in advance for your reply.

— Reply to this email directly or view it on GitHub https://github.com/kawabata/helm-chrome/issues/7.


川幡 太一 (KAWABATA, Taichi) E-mail: kawabata.taichi@gmail.com

ReneFroger commented 8 years ago

Sorry for my belated response. Thanks for your excellent reply, it solved my problem and I really appreciate it!