all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mathias Dahl <brakjoller@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Add "Local Variables" automatically
Date: Thu, 25 Jan 2007 08:59:00 +0100	[thread overview]
Message-ID: <uk5zbwn97.fsf@gmail.com> (raw)
In-Reply-To: 1169653323.897309.208150@j27g2000cwj.googlegroups.com

"Fred" <fred@mayot.net> 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

      reply	other threads:[~2007-01-25  7:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-24 15:42 Add "Local Variables" automatically Fred
2007-01-25  7:59 ` Mathias Dahl [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=uk5zbwn97.fsf@gmail.com \
    --to=brakjoller@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.