From: Kai Grossjohann <kai@emptydomain.de>
Subject: Re: Tab problem
Date: Mon, 06 Sep 2004 14:16:44 +0200 [thread overview]
Message-ID: <86r7pfsic3.fsf@ketchup.de.uu.net> (raw)
In-Reply-To: 413c4a08$0$22753$db0fefd9@news.zen.co.uk
Nick Chorley <nick@nospam.xyphias.com> writes:
> It was mainly so I could put comments in without simply entering a
> load of spaces.
Try to hit M-; when you want to enter a comment. Also see the
variable comment-column.
> Apart from that, well, I don't like the way it indents things
> like switch statements (ie. the case x: bits go right underneath the
> word switch, instead of being indented a bit, if you see what I mean).
That is easy to configure. First of all, there are different
indentation styles. You can choose among them with C-c . I believe.
Perhaps one of them suits your coding style.
If not, then choose the one that's closest, then go to the first line
with wrong indentation, use C-c C-o to customize its indentation, then
reindent the line to see if it was right.
If you find an indentation style that's basically right except that
its indentation level is wrong (say it indents 5 inside curlies but
you want 3), then you can simply set c-basic-offset, using M-x
set-variable RET c-basic-offset RET 42 RET.
You can make those changes permanent by writing some small amount of
Lisp:
(defun nick-c-mode-setup ()
(c-set-style "bla")
(setq c-basic-offset 42)
(c-set-offset 'frumple 'foo))
(add-hook 'c-mode-hook 'nick-c-mode-setup)
Similar for other modes, such as c++ or java, instead of c.
The "bla" comes from the C-c . key.
The frumple and foo come from C-c C-o. You can find the right
c-set-offset statement by typing C-x ESC ESC and then navigating the
history with M-p/M-n.
The CC mode info file explains how to customize indentation much
better than I can.
In any case, imagine how wonderful it would be if you could go to any
unreadable bit of source code, merely hit C-x h C-M-\, and then it
would be indented the way you like!
Kai
prev parent reply other threads:[~2004-09-06 12:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-04 13:45 Tab problem Nick Chorley
2004-09-05 2:09 ` Michael Slass
2004-09-07 13:53 ` kgold
2004-09-05 8:26 ` Juraj Kubelka
[not found] ` <mailman.1551.1094373130.1998.help-gnu-emacs@gnu.org>
2004-09-05 16:42 ` Nick Chorley
2004-09-06 9:58 ` Kai Grossjohann
[not found] ` <mailman.1642.1094465086.1998.help-gnu-emacs@gnu.org>
2004-09-06 11:29 ` Nick Chorley
2004-09-06 12:16 ` Kai Grossjohann [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=86r7pfsic3.fsf@ketchup.de.uu.net \
--to=kai@emptydomain.de \
/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.