From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Riley Newsgroups: gmane.emacs.help Subject: Re: company-mode help Date: Sun, 19 Apr 2009 15:09:21 +0200 Organization: aich tea tea pea dicky riley dot net Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1240148457 25488 80.91.229.12 (19 Apr 2009 13:40:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 19 Apr 2009 13:40:57 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Apr 19 15:42:16 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LvXHf-0007wI-M0 for geh-help-gnu-emacs@m.gmane.org; Sun, 19 Apr 2009 15:42:11 +0200 Original-Received: from localhost ([127.0.0.1]:45392 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LvXGG-0000ce-Ud for geh-help-gnu-emacs@m.gmane.org; Sun, 19 Apr 2009 09:40:44 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!feeder.erje.net!newsfeed.straub-nv.de!feeder.motzarella.org!news.motzarella.org!motzarella.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 52 Original-X-Trace: news.eternal-september.org U2FsdGVkX19TM3+HkYo62dy8Y/buY8STOl1e1KOMzzrFRiGn+f/7cUxx3KVbcYmc836CjLpXrCAnF9LLItTgyfauLEm1WTWDXSRQWEEdwwRDsp5eLOqwDWq2yjK78dTtPz94v3/26TAx9z8FMvkr3g== Original-X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers Original-NNTP-Posting-Date: Sun, 19 Apr 2009 13:09:22 +0000 (UTC) X-Auth-Sender: U2FsdGVkX1/OilnrNGC7MnxEtXzskTKF04aPADatN66j7Mao5i9dOw== Cancel-Lock: sha1:U0P4FEEr93FLvJkZEpUB1B0ngqs= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) Original-Xref: news.stanford.edu gnu.emacs.help:168596 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:63868 Archived-At: Nikolaj Schumacher writes: > Richard Riley 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. --