From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nikolaj Schumacher Newsgroups: gmane.emacs.help Subject: Re: company-mode help Date: Sun, 19 Apr 2009 14:07:05 +0200 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 1240142861 11852 80.91.229.12 (19 Apr 2009 12:07:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 19 Apr 2009 12:07:41 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Richard Riley Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Apr 19 14:09:00 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 1LvVpT-0007lC-1a for geh-help-gnu-emacs@m.gmane.org; Sun, 19 Apr 2009 14:08:59 +0200 Original-Received: from localhost ([127.0.0.1]:34023 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LvVo3-0003uF-NG for geh-help-gnu-emacs@m.gmane.org; Sun, 19 Apr 2009 08:07:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LvVni-0003tw-Hq for help-gnu-emacs@gnu.org; Sun, 19 Apr 2009 08:07:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LvVng-0003sI-AB for help-gnu-emacs@gnu.org; Sun, 19 Apr 2009 08:07:09 -0400 Original-Received: from [199.232.76.173] (port=43844 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LvVng-0003sA-4t for help-gnu-emacs@gnu.org; Sun, 19 Apr 2009 08:07:08 -0400 Original-Received: from dd18200.kasserver.com ([85.13.138.168]:55544) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LvVnf-0001ey-LS for help-gnu-emacs@gnu.org; Sun, 19 Apr 2009 08:07:07 -0400 Original-Received: from thursday (g226195122.adsl.alicedsl.de [92.226.195.122]) by dd18200.kasserver.com (Postfix) with ESMTP id 03FAF180D9D79; Sun, 19 Apr 2009 14:07:08 +0200 (CEST) In-Reply-To: (Richard Riley's message of "Sun, 19 Apr 2009 02:52:14 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (darwin) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:63866 Archived-At: 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