unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* help correcting web-mode configuration
@ 2017-03-12  7:07 Krishnakant
  2017-03-12  8:39 ` Danny YUE
  0 siblings, 1 reply; 12+ messages in thread
From: Krishnakant @ 2017-03-12  7:07 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Hello all,

I previously posted on this list regarding a similar issue.

But I guess my explanation may be a bit confusing.

So I will explain it again.

Basically I have decided to use web-mode for my html and javascript work.

I took the decision because I also use Python based tenplating languages 
like jinja.


Here is my configuration part in context.



(require 'web-mode)
(require 'company)
(require 'company-web-html)                          ; load company mode 
html backend


(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.js\\'" . web-mode))

(add-hook 'web-mode-hook           '(lambda ()              ;; 
Company-mode              (set (make-local-variable 'company-backends) 
(append company-backends '((company-web-html company-yasnippet))))

No matter what I do, the auto complete using company just does not work 
in web-mode.

Also I am not able to get the auto tag completion working.

Can some one help?

Happy hacking.

Krishnakant.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: help correcting web-mode configuration
  2017-03-12  7:07 help correcting web-mode configuration Krishnakant
@ 2017-03-12  8:39 ` Danny YUE
  2017-03-12 10:17   ` Krishnakant
  2017-03-12 10:27   ` Krishnakant
  0 siblings, 2 replies; 12+ messages in thread
From: Danny YUE @ 2017-03-12  8:39 UTC (permalink / raw)
  To: Krishnakant; +Cc: help-gnu-emacs@gnu.org

Hi,

I barely use web-mode because I seldom write HTML etc, but I use
company-mode a lot and find it sometimes tricky to setup.

I noticed that you set company-backends locally, but you have to make
sure it's actually being called.

You can tackle it down by 2 steps:
1. Try command 'company-web-html' or something provided by your company
web-mode package. If it's giving you the completions, this step is
passed. Otherwise, you have problem setting up the package itself.


2. Try command 'company-diag' to see what back-end it's using currently,
and if the back-end it's using is not what you want, maybe you have to
set the company-backends without append. For example:

(defun web-mode-setup-company ()
  (make-local-variable 'company-backends)
  (setq company-backends '(company-web-html)))
(add-hook 'web-mode-hook 'web-mode-setup-company)


Danny


On 2017-03-12 07:07, Krishnakant <krmane@openmailbox.org> wrote:
> Hello all,
>
> I previously posted on this list regarding a similar issue.
>
> But I guess my explanation may be a bit confusing.
>
> So I will explain it again.
>
> Basically I have decided to use web-mode for my html and javascript work.
>
> I took the decision because I also use Python based tenplating languages
> like jinja.
>
>
> Here is my configuration part in context.
>
>
>
> (require 'web-mode)
> (require 'company)
> (require 'company-web-html)                          ; load company mode
> html backend
>
>
> (add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
> (add-to-list 'auto-mode-alist '("\\.js\\'" . web-mode))
>
> (add-hook 'web-mode-hook           '(lambda ()              ;;
> Company-mode              (set (make-local-variable 'company-backends)
> (append company-backends '((company-web-html company-yasnippet))))
>
> No matter what I do, the auto complete using company just does not work
> in web-mode.
>
> Also I am not able to get the auto tag completion working.
>
> Can some one help?
>
> Happy hacking.
>
> Krishnakant.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: help correcting web-mode configuration
  2017-03-12  8:39 ` Danny YUE
@ 2017-03-12 10:17   ` Krishnakant
  2017-03-12 10:27   ` Krishnakant
  1 sibling, 0 replies; 12+ messages in thread
From: Krishnakant @ 2017-03-12 10:17 UTC (permalink / raw)
  To: Danny YUE; +Cc: help-gnu-emacs@gnu.org




On Sunday 12 March 2017 02:09 PM, Danny YUE wrote:
> Hi,
>
> I barely use web-mode because I seldom write HTML etc, but I use
> company-mode a lot and find it sometimes tricky to setup.
>
> I noticed that you set company-backends locally, but you have to make
> sure it's actually being called.
>
> You can tackle it down by 2 steps:
> 1. Try command 'company-web-html' or something provided by your company
> web-mode package. If it's giving you the completions, this step is
> passed. Otherwise, you have problem setting up the package itself.
Step one pass because I end up doing this manually and it does give me 
completions.
>
> 2. Try command 'company-diag' to see what back-end it's using currently,
> and if the back-end it's using is not what you want, maybe you have to
> set the company-backends without append. For example:
>
> (defun web-mode-setup-company ()
>    (make-local-variable 'company-backends)
>    (setq company-backends '(company-web-html)))
> (add-hook 'web-mode-hook 'web-mode-setup-company)
>
>
I will try this in an hour on my laptop with Emacs.
Thanks a lot.
Krishnakant.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: help correcting web-mode configuration
  2017-03-12  8:39 ` Danny YUE
  2017-03-12 10:17   ` Krishnakant
@ 2017-03-12 10:27   ` Krishnakant
  2017-03-12 12:27     ` Danny YUE
  1 sibling, 1 reply; 12+ messages in thread
From: Krishnakant @ 2017-03-12 10:27 UTC (permalink / raw)
  To: Danny YUE; +Cc: help-gnu-emacs@gnu.org

Hi Danny



On Sunday 12 March 2017 02:09 PM, Danny YUE wrote:
> Hi,
>
> I barely use web-mode because I seldom write HTML etc, but I use
> company-mode a lot and find it sometimes tricky to setup.
>
> I noticed that you set company-backends locally, but you have to make
> sure it's actually being called.
>
> You can tackle it down by 2 steps:
> 1. Try command 'company-web-html' or something provided by your company
> web-mode package. If it's giving you the completions, this step is
> passed. Otherwise, you have problem setting up the package itself.
>
>
> 2. Try command 'company-diag' to see what back-end it's using currently,
> and if the back-end it's using is not what you want, maybe you have to
> set the company-backends without append. For example:
>
> (defun web-mode-setup-company ()
>    (make-local-variable 'company-backends)
>    (setq company-backends '(company-web-html)))
> (add-hook 'web-mode-hook 'web-mode-setup-company)
>

This is the output from company-diag

Used backend: company-web-html
Prefix: nil
Completions: none
I get same result of company-diag even after adding your code to init.el
Happy hacking.
Krishnakant.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: help correcting web-mode configuration
  2017-03-12 10:27   ` Krishnakant
@ 2017-03-12 12:27     ` Danny YUE
  2017-03-12 12:43       ` Krishnakant
  0 siblings, 1 reply; 12+ messages in thread
From: Danny YUE @ 2017-03-12 12:27 UTC (permalink / raw)
  To: Krishnakant; +Cc: help-gnu-emacs@gnu.org, Danny YUE

This is really strange...

You see, if 'company-diag' says that your back-end gives no completion,
which is actually wrong because 'company-web-something' does work as you
said...

Wait, why the "Prefix" is nil? It should be a string storing the
characters you have typed when invoking the command.

In Emacs Lisp mode if I type "(add" then invoke 'company-diag, I get:
Prefix: "add"
which is correct...

By the way are you using this pacakge?
https://github.com/osv/company-web

Danny

On 2017-03-12 10:27, Krishnakant <krmane@openmailbox.org> wrote:
> Hi Danny
>
>
>
> On Sunday 12 March 2017 02:09 PM, Danny YUE wrote:
>> Hi,
>>
>> I barely use web-mode because I seldom write HTML etc, but I use
>> company-mode a lot and find it sometimes tricky to setup.
>>
>> I noticed that you set company-backends locally, but you have to make
>> sure it's actually being called.
>>
>> You can tackle it down by 2 steps:
>> 1. Try command 'company-web-html' or something provided by your company
>> web-mode package. If it's giving you the completions, this step is
>> passed. Otherwise, you have problem setting up the package itself.
>>
>>
>> 2. Try command 'company-diag' to see what back-end it's using currently,
>> and if the back-end it's using is not what you want, maybe you have to
>> set the company-backends without append. For example:
>>
>> (defun web-mode-setup-company ()
>>    (make-local-variable 'company-backends)
>>    (setq company-backends '(company-web-html)))
>> (add-hook 'web-mode-hook 'web-mode-setup-company)
>>
>
> This is the output from company-diag
>
> Used backend: company-web-html
> Prefix: nil
> Completions: none
> I get same result of company-diag even after adding your code to init.el
> Happy hacking.
> Krishnakant.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: help correcting web-mode configuration
  2017-03-12 12:27     ` Danny YUE
@ 2017-03-12 12:43       ` Krishnakant
  2017-03-12 13:26         ` Danny YUE
  0 siblings, 1 reply; 12+ messages in thread
From: Krishnakant @ 2017-03-12 12:43 UTC (permalink / raw)
  To: Danny YUE; +Cc: help-gnu-emacs@gnu.org

Sorry my stupidity,

I hadn't started typing when I did company-diag.

here is the output when I try to start <html tag.


Used backend: company-web-html
Prefix: "htm"
Completions:
   #("html" 0 4 (annotation "html")) " -> html"


I guess the completions are not correct.

Happy hacking.

Krishnakant.


On Sunday 12 March 2017 05:57 PM, Danny YUE wrote:
> This is really strange...
>
> You see, if 'company-diag' says that your back-end gives no completion,
> which is actually wrong because 'company-web-something' does work as you
> said...
>
> Wait, why the "Prefix" is nil? It should be a string storing the
> characters you have typed when invoking the command.
>
> In Emacs Lisp mode if I type "(add" then invoke 'company-diag, I get:
> Prefix: "add"
> which is correct...
>
> By the way are you using this pacakge?
> https://github.com/osv/company-web
>
> Danny
>
> On 2017-03-12 10:27, Krishnakant <krmane@openmailbox.org> wrote:
>> Hi Danny
>>
>>
>>
>> On Sunday 12 March 2017 02:09 PM, Danny YUE wrote:
>>> Hi,
>>>
>>> I barely use web-mode because I seldom write HTML etc, but I use
>>> company-mode a lot and find it sometimes tricky to setup.
>>>
>>> I noticed that you set company-backends locally, but you have to make
>>> sure it's actually being called.
>>>
>>> You can tackle it down by 2 steps:
>>> 1. Try command 'company-web-html' or something provided by your company
>>> web-mode package. If it's giving you the completions, this step is
>>> passed. Otherwise, you have problem setting up the package itself.
>>>
>>>
>>> 2. Try command 'company-diag' to see what back-end it's using currently,
>>> and if the back-end it's using is not what you want, maybe you have to
>>> set the company-backends without append. For example:
>>>
>>> (defun web-mode-setup-company ()
>>>     (make-local-variable 'company-backends)
>>>     (setq company-backends '(company-web-html)))
>>> (add-hook 'web-mode-hook 'web-mode-setup-company)
>>>
>> This is the output from company-diag
>>
>> Used backend: company-web-html
>> Prefix: nil
>> Completions: none
>> I get same result of company-diag even after adding your code to init.el
>> Happy hacking.
>> Krishnakant.
>




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: help correcting web-mode configuration
  2017-03-12 12:43       ` Krishnakant
@ 2017-03-12 13:26         ` Danny YUE
  2017-03-12 15:10           ` Krishnakant
  0 siblings, 1 reply; 12+ messages in thread
From: Danny YUE @ 2017-03-12 13:26 UTC (permalink / raw)
  To: Krishnakant; +Cc: help-gnu-emacs@gnu.org, Danny YUE

But it seems to be correct, isn't it?

Because anyway the company-mode returns something that seems
reasonable. What's exactly your problem now?

The completion does not start automatically or something?


Danny


On 2017-03-12 12:43, Krishnakant <krmane@openmailbox.org> wrote:
> Sorry my stupidity,
>
> I hadn't started typing when I did company-diag.
>
> here is the output when I try to start <html tag.
>
>
> Used backend: company-web-html
> Prefix: "htm"
> Completions:
>    #("html" 0 4 (annotation "html")) " -> html"
>
>
> I guess the completions are not correct.
>
> Happy hacking.
>
> Krishnakant.
>
>
> On Sunday 12 March 2017 05:57 PM, Danny YUE wrote:
>> This is really strange...
>>
>> You see, if 'company-diag' says that your back-end gives no completion,
>> which is actually wrong because 'company-web-something' does work as you
>> said...
>>
>> Wait, why the "Prefix" is nil? It should be a string storing the
>> characters you have typed when invoking the command.
>>
>> In Emacs Lisp mode if I type "(add" then invoke 'company-diag, I get:
>> Prefix: "add"
>> which is correct...
>>
>> By the way are you using this pacakge?
>> https://github.com/osv/company-web
>>
>> Danny
>>
>> On 2017-03-12 10:27, Krishnakant <krmane@openmailbox.org> wrote:
>>> Hi Danny
>>>
>>>
>>>
>>> On Sunday 12 March 2017 02:09 PM, Danny YUE wrote:
>>>> Hi,
>>>>
>>>> I barely use web-mode because I seldom write HTML etc, but I use
>>>> company-mode a lot and find it sometimes tricky to setup.
>>>>
>>>> I noticed that you set company-backends locally, but you have to make
>>>> sure it's actually being called.
>>>>
>>>> You can tackle it down by 2 steps:
>>>> 1. Try command 'company-web-html' or something provided by your company
>>>> web-mode package. If it's giving you the completions, this step is
>>>> passed. Otherwise, you have problem setting up the package itself.
>>>>
>>>>
>>>> 2. Try command 'company-diag' to see what back-end it's using currently,
>>>> and if the back-end it's using is not what you want, maybe you have to
>>>> set the company-backends without append. For example:
>>>>
>>>> (defun web-mode-setup-company ()
>>>>     (make-local-variable 'company-backends)
>>>>     (setq company-backends '(company-web-html)))
>>>> (add-hook 'web-mode-hook 'web-mode-setup-company)
>>>>
>>> This is the output from company-diag
>>>
>>> Used backend: company-web-html
>>> Prefix: nil
>>> Completions: none
>>> I get same result of company-diag even after adding your code to init.el
>>> Happy hacking.
>>> Krishnakant.
>>




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: help correcting web-mode configuration
  2017-03-12 13:26         ` Danny YUE
@ 2017-03-12 15:10           ` Krishnakant
  2017-03-12 15:18             ` Danny YUE
  0 siblings, 1 reply; 12+ messages in thread
From: Krishnakant @ 2017-03-12 15:10 UTC (permalink / raw)
  To: Danny YUE; +Cc: help-gnu-emacs@gnu.org



On Sunday 12 March 2017 06:56 PM, Danny YUE wrote:
> But it seems to be correct, isn't it?
>
> Because anyway the company-mode returns something that seems
> reasonable. What's exactly your problem now?
>
> The completion does not start automatically or something?
>
>
Yes completion does not start automatically.
I can do M-x and type company-web-html to get completion done.
I can also set it to a keyboard shortcut, but I expected that my 
completion starts after I type 4 characters (that's what I have set for 
completion ).

So this is precisely the problem.
Happy hacking.
Krishnakant.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: help correcting web-mode configuration
  2017-03-12 15:10           ` Krishnakant
@ 2017-03-12 15:18             ` Danny YUE
  2017-03-12 18:23               ` Krishnakant
  0 siblings, 1 reply; 12+ messages in thread
From: Danny YUE @ 2017-03-12 15:18 UTC (permalink / raw)
  To: Krishnakant; +Cc: help-gnu-emacs@gnu.org, Danny YUE

Seriously, have you checked the manual? ;-)

There are 2 variables that may be related to this:
`company-minimum-prefix-length' controls how many characters you have to
type before company-complete is invoked.

`company-idle-delay' controls the delay you will wait before auto
completion.

Please check the value of these 2 variables and modify them to some
valid number, e.g. 2 characters with 0.5 second delay.


Danny


On 2017-03-12 15:10, Krishnakant <krmane@openmailbox.org> wrote:
> On Sunday 12 March 2017 06:56 PM, Danny YUE wrote:
>> But it seems to be correct, isn't it?
>>
>> Because anyway the company-mode returns something that seems
>> reasonable. What's exactly your problem now?
>>
>> The completion does not start automatically or something?
>>
>>
> Yes completion does not start automatically.
> I can do M-x and type company-web-html to get completion done.
> I can also set it to a keyboard shortcut, but I expected that my
> completion starts after I type 4 characters (that's what I have set for
> completion ).
>
> So this is precisely the problem.
> Happy hacking.
> Krishnakant.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: help correcting web-mode configuration
  2017-03-12 15:18             ` Danny YUE
@ 2017-03-12 18:23               ` Krishnakant
  2017-03-13  3:17                 ` Danny YUE
  0 siblings, 1 reply; 12+ messages in thread
From: Krishnakant @ 2017-03-12 18:23 UTC (permalink / raw)
  To: Danny YUE; +Cc: help-gnu-emacs@gnu.org



On Sunday 12 March 2017 08:48 PM, Danny YUE wrote:
> Seriously, have you checked the manual? ;-)
>
> There are 2 variables that may be related to this:
> `company-minimum-prefix-length' controls how many characters you have to
> type before company-complete is invoked.
It is set to 4 and I did it myself.
It works perfectly with python-elpy with company-mode.
> `company-idle-delay' controls the delay you will wait before auto
> completion.
That is set to 1 second.
It works perfectly in Python.

> Please check the value of these 2 variables and modify them to some
> valid number, e.g. 2 characters with 0.5 second delay.
>
I even tryed your suggestion, although there was no point doing so.
Still no change.

That's why I say this is a challenge.
Should I Send you complete init-el file?
Happy hacking.
Krishnakant.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: help correcting web-mode configuration
  2017-03-12 18:23               ` Krishnakant
@ 2017-03-13  3:17                 ` Danny YUE
  2017-03-18  7:04                   ` Krishnakant
  0 siblings, 1 reply; 12+ messages in thread
From: Danny YUE @ 2017-03-13  3:17 UTC (permalink / raw)
  To: Krishnakant; +Cc: help-gnu-emacs@gnu.org, Danny YUE

Well, please.

I will take some time trying to set up web-mode on my machine and try to
get it work.
But it will be later today...


On 2017-03-12 18:23, Krishnakant <krmane@openmailbox.org> wrote:
> On Sunday 12 March 2017 08:48 PM, Danny YUE wrote:
>> Seriously, have you checked the manual? ;-)
>>
>> There are 2 variables that may be related to this:
>> `company-minimum-prefix-length' controls how many characters you have to
>> type before company-complete is invoked.
> It is set to 4 and I did it myself.
> It works perfectly with python-elpy with company-mode.
>> `company-idle-delay' controls the delay you will wait before auto
>> completion.
> That is set to 1 second.
> It works perfectly in Python.
>
>> Please check the value of these 2 variables and modify them to some
>> valid number, e.g. 2 characters with 0.5 second delay.
>>
> I even tryed your suggestion, although there was no point doing so.
> Still no change.
>
> That's why I say this is a challenge.
> Should I Send you complete init-el file?
> Happy hacking.
> Krishnakant.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: help correcting web-mode configuration
  2017-03-13  3:17                 ` Danny YUE
@ 2017-03-18  7:04                   ` Krishnakant
  0 siblings, 0 replies; 12+ messages in thread
From: Krishnakant @ 2017-03-18  7:04 UTC (permalink / raw)
  To: Danny YUE; +Cc: help-gnu-emacs@gnu.org

Hi Danny,

Sorry to disturb you again, but I tryed a lot of things based on my 
modest knowledge about emacs configurations and company-mode.

But I have still not got over my problem.

Did you get some time to check the problem?

happy hacking.

Krishnakant.


On Monday 13 March 2017 08:47 AM, Danny YUE wrote:
> Well, please.
>
> I will take some time trying to set up web-mode on my machine and try to
> get it work.
> But it will be later today...
>
>
> On 2017-03-12 18:23, Krishnakant <krmane@openmailbox.org> wrote:
>> On Sunday 12 March 2017 08:48 PM, Danny YUE wrote:
>>> Seriously, have you checked the manual? ;-)
>>>
>>> There are 2 variables that may be related to this:
>>> `company-minimum-prefix-length' controls how many characters you have to
>>> type before company-complete is invoked.
>> It is set to 4 and I did it myself.
>> It works perfectly with python-elpy with company-mode.
>>> `company-idle-delay' controls the delay you will wait before auto
>>> completion.
>> That is set to 1 second.
>> It works perfectly in Python.
>>
>>> Please check the value of these 2 variables and modify them to some
>>> valid number, e.g. 2 characters with 0.5 second delay.
>>>
>> I even tryed your suggestion, although there was no point doing so.
>> Still no change.
>>
>> That's why I say this is a challenge.
>> Should I Send you complete init-el file?
>> Happy hacking.
>> Krishnakant.




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-03-18  7:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-12  7:07 help correcting web-mode configuration Krishnakant
2017-03-12  8:39 ` Danny YUE
2017-03-12 10:17   ` Krishnakant
2017-03-12 10:27   ` Krishnakant
2017-03-12 12:27     ` Danny YUE
2017-03-12 12:43       ` Krishnakant
2017-03-12 13:26         ` Danny YUE
2017-03-12 15:10           ` Krishnakant
2017-03-12 15:18             ` Danny YUE
2017-03-12 18:23               ` Krishnakant
2017-03-13  3:17                 ` Danny YUE
2017-03-18  7:04                   ` Krishnakant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).