seagle0128 / .emacs.d

Centaur Emacs - A Fancy and Fast Emacs Configuration
https://seagle0128.github.io/.emacs.d/
GNU General Public License v3.0
1.99k stars 270 forks source link

company config in org-mode throwing an error when writing header arguments in code blocks #317

Closed CsBigDataHub closed 3 years ago

CsBigDataHub commented 3 years ago

error - Company: backend (company-capf :with company-yasnippet) error "Args out of range: "ge", 0, 3" with args (candidates get)

company version - 0.9.13 Org mode version 9.4.6 (9.4.6-12-gdcc3a8-elpaplus @ /Users/home/.emacs.d/elpa/org-plus-contrib-20210809/) emacs version - 28.0.50

seagle0128 commented 3 years ago

It seems an issue of company, but I couldn't reproduce. I am afraid not able to address this issue without details and backtrace.

CsBigDataHub commented 3 years ago

example

#+name: get-env
#+begin_src sh 
echo "test"
#+end_src

#+begin_src emacs-lisp :var env=get-env()
(print env)
#+end_src

when typing :var header env=get-env() I get this error, right after ( is typed.

here is the backtrace

Debugger entered--Lisp error: (args-out-of-range "env=get-env" 0 12)
  completion-pcm--find-all-completions("env=get-env" #f(compiled-function (string pred action) #<bytecode -0x1a2f1a3fe800e9fb>) #f(compiled-function (f) #<bytecode 0x14e3217146877462>) 11 identity)
  completion-pcm--find-all-completions("env=get-env(" #f(compiled-function (string pred action) #<bytecode -0x1a2f1a3fe800e9fb>) #f(compiled-function (f) #<bytecode 0x14e3217146877462>) 12)
  completion-pcm-all-completions("env=get-env(" #f(compiled-function (string pred action) #<bytecode -0x1a2f1a3fe800e9fb>) #f(compiled-function (f) #<bytecode 0x14e3217146877462>) 12)
  #f(compiled-function (style) #<bytecode -0xcfa65a2ae150c4e>)(partial-completion)
  completion--some(#f(compiled-function (style) #<bytecode -0xcfa65a2ae150c4e>) (basic partial-completion emacs22))
  completion--nth-completion(2 "env=get-env(" #f(compiled-function (string pred action) #<bytecode 0x148fdaaf918da834>) #f(compiled-function (f) #<bytecode 0x14e3217146877462>) 12 (metadata (completion--unquote-requote . t)))
  completion-all-completions("env=get-env(" #f(compiled-function (string pred action) #<bytecode 0x148fdaaf918da834>) #f(compiled-function (f) #<bytecode 0x14e3217146877462>) 12 (metadata (completion--unquote-requote . t)))
  company-capf--candidates("env=get-env(")
  company-capf(candidates "env=get-env(")
  company--multi-backend-adapter-candidates((company-capf company-yasnippet) "env=get-env(" nil)
  company--multi-backend-adapter((company-capf :with company-yasnippet) candidates "env=get-env(")
  apply(company--multi-backend-adapter (company-capf :with company-yasnippet) (candidates "env=get-env("))
  company-call-backend-raw(candidates "env=get-env(")
  company--fetch-candidates("env=get-env(")
  company-calculate-candidates("env=get-env(" nil)
  company--begin-new()
  company--perform()
  company-auto-begin()
  company-idle-begin(#<buffer schema.org> #<window 121 on schema.org> 231018 4650)
  apply(company-idle-begin (#<buffer schema.org> #<window 121 on schema.org> 231018 4650))
  timer-event-handler([t 24856 35284 637079 nil company-idle-begin (#<buffer schema.org> #<window 121 on schema.org> 231018 4650) nil 0])
seagle0128 commented 3 years ago

Thanks! I can reproduce this issue with emacs -Q. It's an issue of company-capf. Please double check and file an issue for company.

CsBigDataHub commented 3 years ago

thanks, created a error in company repo - https://github.com/company-mode/company-mode/issues/1169

dgutov commented 3 years ago

@seagle0128 Next time please consider that a problem in some major mode can be a bug in that major mode.

seagle0128 commented 3 years ago

@dgutov Thanks for clarification! There was only company functions according to the backtrace which was provided by @CsBigDataHub . I am not sure if it's the root cause. Definitely will consider more cases.

seagle0128 commented 3 years ago

It's an issue of org-mode. Closing it.

dgutov commented 3 years ago

@seagle0128 Well, the backtrace ends up in completion-pcm--find-all-completions, which is outside of company.

I'll appreciate your help triaging, if next time you see a bug with backtrace which mentions company-capf, you suggest the user tries to reproduce the error without company first.