From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mathias Dahl Newsgroups: gmane.emacs.help Subject: Re: Add "Local Variables" automatically Date: Thu, 25 Jan 2007 08:59:00 +0100 Message-ID: References: <1169653323.897309.208150@j27g2000cwj.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1169714468 25206 80.91.229.12 (25 Jan 2007 08:41:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 25 Jan 2007 08:41:08 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 25 09:41:07 2007 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 1HA0AM-0000cn-KO for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Jan 2007 09:41:06 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HA0AM-0006zX-5b for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Jan 2007 03:41:06 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 39 Original-X-Trace: individual.net sXtdmTa5EzJsKUZP+ArRDAEwunY03y6agy+yyBaU/20ZX2Ug64 User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (windows-nt) Cancel-Lock: sha1:XFFtSIpgXZdn2CVBJ/1S+9Ju+OE= Original-Xref: shelby.stanford.edu gnu.emacs.help:145026 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:40630 Archived-At: "Fred" writes: > Hi, > Is there a way of adding automatically (with a keybinding) this text > // Local Variables: > // mode:c++ > // tab-width:3 > // c-basic-offset:3 > // indent-tabs-mode:nil > // End: > at the end of a buffer if not already present and then pass to > c++-mode. I'm sure it is possible but I don't know elisp? Can someone > help me? You could use an abbrev for that: M-x define-global-abbrev RET my_local_var_text RET Paste or type the text you want here. To enter a newline, type C-q first. End with RET. To use it you have to enable abbrev-mode. You can use M-x customize-option RET abbrev-mode RET to do that. Or, simply define a command: (defun insert-my-local-var-text () (interactive) (insert "// Local Variables: // mode:c++ // tab-width:3 // c-basic-offset:3 // indent-tabs-mode:nil // End: ")) Save that in your .emacs file. /Mathias