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

Initialize helm-source-ls-git #47

Open
kanbouchou opened this issue Jul 15, 2017 · 6 comments
Open

Initialize helm-source-ls-git #47

kanbouchou opened this issue Jul 15, 2017 · 6 comments

Comments

@kanbouchou
Copy link

Hi

I'd like to first thank you for the great package, this is one of my favorite helm packages.

The way I'm using helm-ls-git is adding helm-source-ls-git to helm-for-files-preferred-list, and invoking helm-for-files.
The problem is that helm-source-ls-git is initially nil, and helm-for-files doesn't show git files.
Invoking helm-ls-git-ls once, helm-source-ls-git is initialized and helm-for-files shows git files as expected.
I am getting around this by doing this in my init.el.

(setq helm-source-ls-git-status
      (and (memq 'helm-source-ls-git-status helm-ls-git-default-sources)
           (helm-make-source "Git status" 'helm-ls-git-status-source
             :fuzzy-match helm-ls-git-fuzzy-match))
      helm-source-ls-git
      (and (memq 'helm-source-ls-git helm-ls-git-default-sources)
           (helm-make-source "Git files" 'helm-ls-git-source
             :fuzzy-match helm-ls-git-fuzzy-match))
      helm-source-ls-git-buffers
      (and (memq 'helm-source-ls-git-buffers helm-ls-git-default-sources)
           (helm-make-source "Buffers in git project" 'helm-source-buffers
             :header-name #'helm-ls-git-header-name
             :buffer-list (lambda () (helm-browse-project-get-buffers
                                      (helm-ls-git-root-dir)))
             :keymap helm-ls-git-buffer-map)))

I suppose this should happen on helm-ls-git side.

@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented Jul 16, 2017 via email

@kanbouchou
Copy link
Author

okay, it is designed to be that way. I can configure it in my init.el, no problem.

However, I know a few people like me who is using helm-ls-git and were wondering why it doesn't show up in helm-for-files until helm-ls-git-ls is invoked once. And maybe most of the users just want it configured by default.

So providing a function like what I am doing on the package side, or at least some note in readme about how to configure it initially would be nice.

thierryvolpiatto pushed a commit that referenced this issue Jul 16, 2017
* helm-ls-git.el (helm-source-ls-git-status): Docstring.
(helm-source-ls-git):                         Docstring.
(helm-source-ls-git-buffers):                 Docstring.
(helm-ls-git-build-git-status-source): New.
(helm-ls-git-build-ls-git-source):     New.
(helm-ls-git-build-buffers-source):    New.
(helm-ls-git-ls): Use them to build sources.
* README.md: Update.
@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented Jul 16, 2017 via email

@kanbouchou
Copy link
Author

I tried your change (47981a8), and I get this error and don't see files under git when I invoke helm-ls-git-ls

Debugger entered--Lisp error: (invalid-slot-name "#<helm-ls-git-status-source Git status>" :group)
  signal(invalid-slot-name ("#<helm-ls-git-status-source Git status>" :group))
  #[(object slot-name operation &optional new-value) "\302\303\304�!	D\"\207" [object slot-name signal invalid-slot-name eieio-object-name] 4 "Method invoked when an attempt to access a slot in OBJECT fails.\nSLOT-NAME is the name of the failed slot, OPERATION is the type of access\nthat was requested, and optional NEW-VALUE is the value that was desired\nto be set.\n\nThis method is called from `oref', `oset', and other functions which\ndirectly reference slots in EIEIO objects."]([object helm-ls-git-status-source "Git status" nil helm-ls-git-header-name (lambda nil (helm-init-candidates-in-buffer (quote global) (helm-ls-git-status))) helm-candidates-in-buffer nil nil helm-ls-git-map (("Find file" . helm-find-many-files) ("Git status" lambda (_candidate) (funcall helm-ls-git-status-command (helm-default-directory)))) helm-ls-git-diff "Diff" nil nil nil nil helm-ls-git-status-transformer nil nil nil helm-ls-git-status-action-transformer nil nil t (identity) nil identity nil nil nil nil nil nil nil nil nil nil t nil nil nil nil nil nil buffer-substring-no-properties (helm-candidates-in-buffer-search-default-fn) nil] :group oset helm-ls-git)
  apply(#[(object slot-name operation &optional new-value) "\302\303\304�!	D\"\207" [object slot-name signal invalid-slot-name eieio-object-name] 4 "Method invoked when an attempt to access a slot in OBJECT fails.\nSLOT-NAME is the name of the failed slot, OPERATION is the type of access\nthat was requested, and optional NEW-VALUE is the value that was desired\nto be set.\n\nThis method is called from `oref', `oset', and other functions which\ndirectly reference slots in EIEIO objects."] ([object helm-ls-git-status-source "Git status" nil helm-ls-git-header-name (lambda nil (helm-init-candidates-in-buffer (quote global) (helm-ls-git-status))) helm-candidates-in-buffer nil nil helm-ls-git-map (("Find file" . helm-find-many-files) ("Git status" lambda (_candidate) (funcall helm-ls-git-status-command (helm-default-directory)))) helm-ls-git-diff "Diff" nil nil nil nil helm-ls-git-status-transformer nil nil nil helm-ls-git-status-action-transformer nil nil t (identity) nil identity nil nil nil nil nil nil nil nil nil nil t nil nil nil nil nil nil buffer-substring-no-properties (helm-candidates-in-buffer-search-default-fn) nil] :group oset helm-ls-git))
  slot-missing([object helm-ls-git-status-source "Git status" nil helm-ls-git-header-name (lambda nil (helm-init-candidates-in-buffer (quote global) (helm-ls-git-status))) helm-candidates-in-buffer nil nil helm-ls-git-map (("Find file" . helm-find-many-files) ("Git status" lambda (_candidate) (funcall helm-ls-git-status-command (helm-default-directory)))) helm-ls-git-diff "Diff" nil nil nil nil helm-ls-git-status-transformer nil nil nil helm-ls-git-status-action-transformer nil nil t (identity) nil identity nil nil nil nil nil nil nil nil nil nil t nil nil nil nil nil nil buffer-substring-no-properties (helm-candidates-in-buffer-search-default-fn) nil] :group oset helm-ls-git)
  #[(obj slots) "\304\216�\305H	B�\n\2057�\306�\305H\n@\"\211�\204%�\307�\n@\310\nA@$\210\202-�\311��\nA@#\210)\nAA\211�\204\f�\312)\207" [obj eieio--scoped-class-stack slots rn ((byte-code "�\210�A�\301\207" [eieio--scoped-class-stack nil] 1)) 1 eieio-initarg-to-attribute slot-missing oset eieio-oset nil] 6 "Set slots of OBJ with SLOTS which is a list of name/value pairs.\nCalled from the constructor routine."]([object helm-ls-git-status-source "Git status" nil helm-ls-git-header-name (lambda nil (helm-init-candidates-in-buffer (quote global) (helm-ls-git-status))) helm-candidates-in-buffer nil nil helm-ls-git-map (("Find file" . helm-find-many-files) ("Git status" lambda (_candidate) (funcall helm-ls-git-status-command (helm-default-directory)))) helm-ls-git-diff "Diff" nil nil nil nil helm-ls-git-status-transformer nil nil nil helm-ls-git-status-action-transformer nil nil t (identity) nil identity nil nil nil nil nil nil nil nil nil nil t nil nil nil nil nil nil buffer-substring-no-properties (helm-candidates-in-buffer-search-default-fn) nil] (:fuzzy-match nil :group helm-ls-git))
  apply(#[(obj slots) "\304\216�\305H	B�\n\2057�\306�\305H\n@\"\211�\204%�\307�\n@\310\nA@$\210\202-�\311��\nA@#\210)\nAA\211�\204\f�\312)\207" [obj eieio--scoped-class-stack slots rn ((byte-code "�\210�A�\301\207" [eieio--scoped-class-stack nil] 1)) 1 eieio-initarg-to-attribute slot-missing oset eieio-oset nil] 6 "Set slots of OBJ with SLOTS which is a list of name/value pairs.\nCalled from the constructor routine."] ([object helm-ls-git-status-source "Git status" nil helm-ls-git-header-name (lambda nil (helm-init-candidates-in-buffer (quote global) (helm-ls-git-status))) helm-candidates-in-buffer nil nil helm-ls-git-map (("Find file" . helm-find-many-files) ("Git status" lambda (_candidate) (funcall helm-ls-git-status-command (helm-default-directory)))) helm-ls-git-diff "Diff" nil nil nil nil helm-ls-git-status-transformer nil nil nil helm-ls-git-status-action-transformer nil nil t (identity) nil identity nil nil nil nil nil nil nil nil nil nil t nil nil nil nil nil nil buffer-substring-no-properties (helm-candidates-in-buffer-search-default-fn) nil] (:fuzzy-match nil :group helm-ls-git)))
  shared-initialize([object helm-ls-git-status-source "Git status" nil helm-ls-git-header-name (lambda nil (helm-init-candidates-in-buffer (quote global) (helm-ls-git-status))) helm-candidates-in-buffer nil nil helm-ls-git-map (("Find file" . helm-find-many-files) ("Git status" lambda (_candidate) (funcall helm-ls-git-status-command (helm-default-directory)))) helm-ls-git-diff "Diff" nil nil nil nil helm-ls-git-status-transformer nil nil nil helm-ls-git-status-action-transformer nil nil t (identity) nil identity nil nil nil nil nil nil nil nil nil nil t nil nil nil nil nil nil buffer-substring-no-properties (helm-candidates-in-buffer-search-default-fn) nil] (:fuzzy-match nil :group helm-ls-git))
  #[(this &optional slots) "�\306H\307N\211�\310H�	\311H�\n\203/�\312�@!\211��@=\204%�\313�\n@\f#\210)\nA��A�\202��+\314�
\"\207" [this this-class slot defaults dflt slots 1 eieio-class-definition 5 6 eieio-default-eval-maybe eieio-oset shared-initialize] 5 "Construct the new object THIS based on SLOTS.\nSLOTS is a tagged list where odd numbered elements are tags, and\neven numbered elements are the values to store in the tagged slot.\nIf you overload the `initialize-instance', there you will need to\ncall `shared-initialize' yourself, or you can call `call-next-method'\nto have this constructor called automatically.  If these steps are\nnot taken, then new objects of your class will not have their values\ndynamically set from SLOTS."]([object helm-ls-git-status-source "Git status" nil helm-ls-git-header-name (lambda nil (helm-init-candidates-in-buffer (quote global) (helm-ls-git-status))) helm-candidates-in-buffer nil nil helm-ls-git-map (("Find file" . helm-find-many-files) ("Git status" lambda (_candidate) (funcall helm-ls-git-status-command (helm-default-directory)))) helm-ls-git-diff "Diff" nil nil nil nil helm-ls-git-status-transformer nil nil nil helm-ls-git-status-action-transformer nil nil t (identity) nil identity nil nil nil nil nil nil nil nil nil nil t nil nil nil nil nil nil buffer-substring-no-properties (helm-candidates-in-buffer-search-default-fn) nil] (:fuzzy-match nil :group helm-ls-git))
  apply(#[(this &optional slots) "�\306H\307N\211�\310H�	\311H�\n\203/�\312�@!\211��@=\204%�\313�\n@\f#\210)\nA��A�\202��+\314�
\"\207" [this this-class slot defaults dflt slots 1 eieio-class-definition 5 6 eieio-default-eval-maybe eieio-oset shared-initialize] 5 "Construct the new object THIS based on SLOTS.\nSLOTS is a tagged list where odd numbered elements are tags, and\neven numbered elements are the values to store in the tagged slot.\nIf you overload the `initialize-instance', there you will need to\ncall `shared-initialize' yourself, or you can call `call-next-method'\nto have this constructor called automatically.  If these steps are\nnot taken, then new objects of your class will not have their values\ndynamically set from SLOTS."] ([object helm-ls-git-status-source "Git status" nil helm-ls-git-header-name (lambda nil (helm-init-candidates-in-buffer (quote global) (helm-ls-git-status))) helm-candidates-in-buffer nil nil helm-ls-git-map (("Find file" . helm-find-many-files) ("Git status" lambda (_candidate) (funcall helm-ls-git-status-command (helm-default-directory)))) helm-ls-git-diff "Diff" nil nil nil nil helm-ls-git-status-transformer nil nil nil helm-ls-git-status-action-transformer nil nil t (identity) nil identity nil nil nil nil nil nil nil nil nil nil t nil nil nil nil nil nil buffer-substring-no-properties (helm-candidates-in-buffer-search-default-fn) nil] (:fuzzy-match nil :group helm-ls-git)))
  initialize-instance([object helm-ls-git-status-source "Git status" nil helm-ls-git-header-name (lambda nil (helm-init-candidates-in-buffer (quote global) (helm-ls-git-status))) helm-candidates-in-buffer nil nil helm-ls-git-map (("Find file" . helm-find-many-files) ("Git status" lambda (_candidate) (funcall helm-ls-git-status-command (helm-default-directory)))) helm-ls-git-diff "Diff" nil nil nil nil helm-ls-git-status-transformer nil nil nil helm-ls-git-status-action-transformer nil nil t (identity) nil identity nil nil nil nil nil nil nil nil nil nil t nil nil nil nil nil nil buffer-substring-no-properties (helm-candidates-in-buffer-search-default-fn) nil] (:fuzzy-match nil :group helm-ls-git))
  eieio-default-superclass(helm-ls-git-status-source "Git status" :fuzzy-match nil :group helm-ls-git)
  apply(eieio-default-superclass (helm-ls-git-status-source "Git status" :fuzzy-match nil :group helm-ls-git))
  eieio-generic-call(constructor (helm-ls-git-status-source "Git status" :fuzzy-match nil :group helm-ls-git))
  constructor(helm-ls-git-status-source "Git status" :fuzzy-match nil :group helm-ls-git)
  apply(constructor helm-ls-git-status-source "Git status" (:fuzzy-match nil :group helm-ls-git))
  helm-ls-git-status-source("Git status" :fuzzy-match nil :group helm-ls-git)
  apply(helm-ls-git-status-source ("Git status" :fuzzy-match nil :group helm-ls-git))
  make-instance(helm-ls-git-status-source "Git status" :fuzzy-match nil :group helm-ls-git)
  apply(make-instance helm-ls-git-status-source "Git status" (:fuzzy-match nil :group helm-ls-git))
  helm-make-source("Git status" helm-ls-git-status-source :fuzzy-match nil :group helm-ls-git)
  (and (memq (quote helm-source-ls-git-status) helm-ls-git-default-sources) (helm-make-source "Git status" (quote helm-ls-git-status-source) :fuzzy-match helm-ls-git-fuzzy-match :group (quote helm-ls-git)))
  helm-ls-git-build-git-status-source()
  (setq helm-source-ls-git-status (helm-ls-git-build-git-status-source) helm-source-ls-git (helm-ls-git-build-ls-git-source) helm-source-ls-git-buffers (helm-ls-git-build-buffers-source))
  (if (let* ((--cl-var-- helm-ls-git-default-sources) (s nil) (--cl-flag-- t)) (while (and (consp --cl-var--) (progn (setq s (car --cl-var--)) (setq --cl-flag-- (symbol-value s)))) (setq --cl-var-- (cdr --cl-var--))) (if --cl-flag-- (progn t) nil)) nil (setq helm-source-ls-git-status (helm-ls-git-build-git-status-source) helm-source-ls-git (helm-ls-git-build-ls-git-source) helm-source-ls-git-buffers (helm-ls-git-build-buffers-source)))
  helm-ls-git-ls(1)
  call-interactively(helm-ls-git-ls record nil)
  command-execute(helm-ls-git-ls record)
  execute-extended-command(nil "helm-ls-git-ls")
  smex-read-and-run(("helm-ls-git-ls" "describe-variable" "toggle-debug-on-error" "eval-buffer" "magit-pull" "magit-run-gitk-all" "el-get-update" "ag" "vc-annotate" "open-junk-file" "helm-yas-complete" "comment-region" "magit-fetch-all" "make-frame" "global-git-gutter-mode" "uncomment-region" "beginning-of-buffer" "qml-mode" "google-this" "magit-log" "align-regexp" "magit-checkout" "global-auto-complete-mode" "flyspell-buffer" "git-messenger:popup-message" "helm-man-woman" "git-gutter:update-all-windows" "end-of-buffer" "python-mode" "yas-global-mode" "describe-key" "c++-mode" "makefile-mode" "compilation-mode" "helm-migemo-mode" "rainbow-delimiters-mode" "anzu-query-replace-regexp" "ag-regexp" "revert-buffer" "which-function-mode" "eval-region" "magit-run-gitk" "auto-revert-mode" "jedi:goto-definition" "jedi-mode" "delete-frame" "describe-mode" "global-company-mode" "highlight-symbol-mode" "eshell" ...))
  smex()
  call-interactively(smex nil nil)
  command-execute(smex)

Does it work for you?

@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented Jul 17, 2017 via email

@kanbouchou
Copy link
Author

okay, using latest helm-source fixed the problem for me.
Thank you!

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