* company-mode help
@ 2009-04-19 0:52 Richard Riley
2009-04-19 2:15 ` Andy Stewart
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Richard Riley @ 2009-04-19 0:52 UTC (permalink / raw)
To: help-gnu-emacs
Could someone help me with company-mode please. I cant find much
documentation on how to use it and am not sure if "(company-mode)" is
sufficient. I understand I can call "company-mode" at any time, but is
there no "global-company-mode" type thing or utility function to turn it
on for common programme language types? In addition, (I emailed Nikolaj
too), but do I have to do something special for it to complete structure
members in C/C++? it seems a wonderful addition when interfaced with
cedet combined with its own built in completion filtering and context
help.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: company-mode help
2009-04-19 0:52 company-mode help Richard Riley
@ 2009-04-19 2:15 ` Andy Stewart
[not found] ` <mailman.5664.1240110508.31690.help-gnu-emacs@gnu.org>
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Andy Stewart @ 2009-04-19 2:15 UTC (permalink / raw)
To: help-gnu-emacs
Richard Riley <rileyrgdev@googlemail.com> writes:
> Could someone help me with company-mode please. I cant find much
> documentation on how to use it and am not sure if "(company-mode)" is
> sufficient. I understand I can call "company-mode" at any time, but is
> there no "global-company-mode" type thing or utility function to turn it
> on for common programme language types? In addition, (I emailed Nikolaj
> too), but do I have to do something special for it to complete structure
> members in C/C++? it seems a wonderful addition when interfaced with
> cedet combined with its own built in completion filtering and context
> help.
(dolist (hook (list
'emacs-lisp-mode-hook
'lisp-mode-hook
'lisp-interaction-mode-hook
'scheme-mode-hook
'c-mode-hook
'c++-mode-hook
'java-mode-hook
'haskell-mode-hook
'asm-mode-hook
'emms-tag-editor-mode-hook
'sh-mode-hook
))
(add-hook hook 'company-mode))
How about this? :)
-- Andy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: company-mode help
[not found] ` <mailman.5664.1240110508.31690.help-gnu-emacs@gnu.org>
@ 2009-04-19 9:18 ` Richard Riley
0 siblings, 0 replies; 6+ messages in thread
From: Richard Riley @ 2009-04-19 9:18 UTC (permalink / raw)
To: help-gnu-emacs
Andy Stewart <lazycat.manatee@gmail.com> writes:
> Richard Riley <rileyrgdev@googlemail.com> writes:
>
>> Could someone help me with company-mode please. I cant find much
>> documentation on how to use it and am not sure if "(company-mode)" is
>> sufficient. I understand I can call "company-mode" at any time, but is
>> there no "global-company-mode" type thing or utility function to turn it
>> on for common programme language types? In addition, (I emailed Nikolaj
>> too), but do I have to do something special for it to complete structure
>> members in C/C++? it seems a wonderful addition when interfaced with
>> cedet combined with its own built in completion filtering and context
>> help.
> (dolist (hook (list
> 'emacs-lisp-mode-hook
> 'lisp-mode-hook
> 'lisp-interaction-mode-hook
> 'scheme-mode-hook
> 'c-mode-hook
> 'c++-mode-hook
> 'java-mode-hook
> 'haskell-mode-hook
> 'asm-mode-hook
> 'emms-tag-editor-mode-hook
> 'sh-mode-hook
> ))
> (add-hook hook 'company-mode))
>
> How about this? :)
>
> -- Andy
>
>
>
Yes, that would be the brute force way, but I thought it would be
included in the package some how if there are already semantic backends
etc.
How's your new IDE coming along?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: company-mode help
2009-04-19 0:52 company-mode help Richard Riley
2009-04-19 2:15 ` Andy Stewart
[not found] ` <mailman.5664.1240110508.31690.help-gnu-emacs@gnu.org>
@ 2009-04-19 12:07 ` Nikolaj Schumacher
2009-04-20 21:38 ` Alan Mackenzie
[not found] ` <mailman.5677.1240142832.31690.help-gnu-emacs@gnu.org>
3 siblings, 1 reply; 6+ messages in thread
From: Nikolaj Schumacher @ 2009-04-19 12:07 UTC (permalink / raw)
To: Richard Riley; +Cc: help-gnu-emacs
Richard Riley <rileyrgdev@googlemail.com> wrote:
> Could someone help me with company-mode please. I cant find much
> documentation on how to use it and am not sure if "(company-mode)" is
> sufficient. I understand I can call "company-mode" at any time, but is
> there no "global-company-mode" type thing or utility function to turn it
> on for common programme language types?
I've added a global-company-mode in 0.4.1.
> too), but do I have to do something special for it to complete structure
> members in C/C++?
The reason for this is that the structure member (after the -> or .) is
considered a new symbol by Emacs, making it shorter than `company-minimum-prefix-length'.
For 0.4.1, a workaround could be an electric command:
(defun company-electric-dot ()
"Insert a dot and start completion, unless in a string or comment."
(interactive)
(insert-char ?. 1)
(unless (company-in-string-or-comment)
(company-auto-begin)))
(defun company-electric-greater-than ()
"Insert a dot and start completion, unless in a string or comment."
(interactive)
(insert-char ?> 1)
(and (eq (char-before (1- (point))) ?-)
(not (company-in-string-or-comment))
(company-auto-begin)))
(define-key c-mode-base-map "." 'company-electric-dot)
(define-key c-mode-base-map ">" 'company-electric-greater-than)
(define-key c++-mode-map ">" 'company-electric-greater-than)
I'll figure out a more universal solution.
regards,
Nikolaj Schumacher
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: company-mode help
[not found] ` <mailman.5677.1240142832.31690.help-gnu-emacs@gnu.org>
@ 2009-04-19 13:09 ` Richard Riley
0 siblings, 0 replies; 6+ messages in thread
From: Richard Riley @ 2009-04-19 13:09 UTC (permalink / raw)
To: help-gnu-emacs
Nikolaj Schumacher <me@nschum.de> writes:
> Richard Riley <rileyrgdev@googlemail.com> wrote:
>
>> Could someone help me with company-mode please. I cant find much
>> documentation on how to use it and am not sure if "(company-mode)" is
>> sufficient. I understand I can call "company-mode" at any time, but is
>> there no "global-company-mode" type thing or utility function to turn it
>> on for common programme language types?
>
> I've added a global-company-mode in 0.4.1.
>
>> too), but do I have to do something special for it to complete structure
>> members in C/C++?
>
> The reason for this is that the structure member (after the -> or .) is
> considered a new symbol by Emacs, making it shorter than `company-minimum-prefix-length'.
>
>
> For 0.4.1, a workaround could be an electric command:
>
> (defun company-electric-dot ()
> "Insert a dot and start completion, unless in a string or comment."
> (interactive)
> (insert-char ?. 1)
> (unless (company-in-string-or-comment)
> (company-auto-begin)))
>
> (defun company-electric-greater-than ()
> "Insert a dot and start completion, unless in a string or comment."
> (interactive)
> (insert-char ?> 1)
> (and (eq (char-before (1- (point))) ?-)
> (not (company-in-string-or-comment))
> (company-auto-begin)))
>
> (define-key c-mode-base-map "." 'company-electric-dot)
> (define-key c-mode-base-map ">" 'company-electric-greater-than)
> (define-key c++-mode-map ">" 'company-electric-greater-than)
>
>
> I'll figure out a more universal solution.
>
> regards,
> Nikolaj Schumacher
>
>
Wonderful, thanks.
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: company-mode help
2009-04-19 12:07 ` Nikolaj Schumacher
@ 2009-04-20 21:38 ` Alan Mackenzie
0 siblings, 0 replies; 6+ messages in thread
From: Alan Mackenzie @ 2009-04-20 21:38 UTC (permalink / raw)
To: Nikolaj Schumacher; +Cc: help-gnu-emacs, Richard Riley
'ten Abend, Nikolaj!
On Sun, Apr 19, 2009 at 02:07:05PM +0200, Nikolaj Schumacher wrote:
> Richard Riley <rileyrgdev@googlemail.com> wrote:
> > Could someone help me with company-mode please. I cant find much
> > documentation on how to use it and am not sure if "(company-mode)"
> > is sufficient. I understand I can call "company-mode" at any time,
> > but is there no "global-company-mode" type thing or utility function
> > to turn it on for common programme language types?
> I've added a global-company-mode in 0.4.1.
> > too), but do I have to do something special for it to complete
> > structure members in C/C++?
> The reason for this is that the structure member (after the -> or .)
> is considered a new symbol by Emacs, making it shorter than
> `company-minimum-prefix-length'.
> For 0.4.1, a workaround could be an electric command:
Please note, WORKAROUND!!!
> (defun company-electric-dot ()
> "Insert a dot and start completion, unless in a string or comment."
> (interactive)
> (insert-char ?. 1)
> (unless (company-in-string-or-comment)
> (company-auto-begin)))
> (defun company-electric-greater-than ()
> "Insert a dot and start completion, unless in a string or comment."
> (interactive)
> (insert-char ?> 1)
> (and (eq (char-before (1- (point))) ?-)
> (not (company-in-string-or-comment))
> (company-auto-begin)))
> (define-key c-mode-base-map "." 'company-electric-dot)
> (define-key c-mode-base-map ">" 'company-electric-greater-than)
> (define-key c++-mode-map ">" 'company-electric-greater-than)
Please don't put this last into C or (especially) C++ mode. > is bound
to `c-electric-lt-gt', and as well as triggering electric indentation,
does essential things wrt C++ templates. It would probably cause
screw-ups, particularly as < would still be bound to `c-electric-lt-gt'.
OK, I know it's only meant as a temporary thing. But couldn't you do it
as a defadvice around `c-electric-lt-gt'?
>
> I'll figure out a more universal solution.
;-)
> regards,
> Nikolaj Schumacher
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-04-20 21:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-19 0:52 company-mode help Richard Riley
2009-04-19 2:15 ` Andy Stewart
[not found] ` <mailman.5664.1240110508.31690.help-gnu-emacs@gnu.org>
2009-04-19 9:18 ` Richard Riley
2009-04-19 12:07 ` Nikolaj Schumacher
2009-04-20 21:38 ` Alan Mackenzie
[not found] ` <mailman.5677.1240142832.31690.help-gnu-emacs@gnu.org>
2009-04-19 13:09 ` Richard Riley
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).