* Add "Local Variables" automatically
@ 2007-01-24 15:42 Fred
2007-01-25 7:59 ` Mathias Dahl
0 siblings, 1 reply; 2+ messages in thread
From: Fred @ 2007-01-24 15:42 UTC (permalink / raw)
To: help-gnu-emacs
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?
Thanks a lot,
Fred
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Add "Local Variables" automatically
2007-01-24 15:42 Add "Local Variables" automatically Fred
@ 2007-01-25 7:59 ` Mathias Dahl
0 siblings, 0 replies; 2+ messages in thread
From: Mathias Dahl @ 2007-01-25 7:59 UTC (permalink / raw)
To: help-gnu-emacs
"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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-01-25 7:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-24 15:42 Add "Local Variables" automatically Fred
2007-01-25 7:59 ` Mathias Dahl
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.