[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

auto-indenting C++ files upon saving

From: Art Werschulz
Subject: auto-indenting C++ files upon saving
Date: Fri, 19 Feb 2010 11:23:42 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)


I am trying to teach my students that they should auto-indent their C++
files before saving, by issuing the commands
  C-x h M-C-\
However, they haven't trained their "muscle memory" to do this, i.e., to
automatically type the sequence 
  C-x M-C-\ C-x C-s
How can this be automated, so that a file gets auto-indented whenever
it's saved?

I thinking of something along the lines of
(setq auto-save-hook
but this didn't seem to work.

Actually, I'd only want this to work in some situations, e.g., a file
whose name matches a certain pattern.  Said pattern would be stored in
some variable.

My emacs-lisp is very weak.  Suggestions?  Thanks!

Art Werschulz (8-{)}   "Metaphors be with you."  -- bumper sticker
GCS/M (GAT): d? -p+ c++ l++ u+ P++ e--- m* s n+ h f g+ w+ t+ r- 
Net: address@hidden
Phone:   Fordham U. (212) 636-6325, Columbia U. (646) 775-6035

reply via email to

[Prev in Thread] Current Thread [Next in Thread]