all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Perry Smith <pedz@easesoftware.com>
Cc: Help-gnu-emacs@gnu.org
Subject: Re: Formatting code text
Date: Sat, 18 Nov 2006 07:37:14 -0600	[thread overview]
Message-ID: <DBA98950-455C-4907-84BC-14EE4544602E@easesoftware.com> (raw)
In-Reply-To: <7416552.post@talk.nabble.com>


[-- Attachment #1.1: Type: text/plain, Size: 1721 bytes --]

On Nov 18, 2006, at 3:42 AM, une wrote:

>
> When writing code in C++ or Java I notice that I can get the code  
> all nicley
> aligned and indented correctly by simply adding a comment at the  
> end of each
> line of code. As you enter the //, the line of code moves to its  
> correct
> alignment. What I have been doing is writing my code and periodically
> tidying it up by adding // at the end of every line of code. My  
> question is,
> can I speed this aligning and indenting process up by formatting  
> the entire
> file using one command? Emacs obviously knows how much each line  
> should be
> indented, but doing it one line at a time by adding // is laborious.
>
> PS - I did not mean to cross post, my first post was in the Gnu  
> Emacs forum.
> Not sure how this website works yet. Sorry.
> -- 

Sounds like you are talking about Meta-Control-Q (in C++ mode but  
probably in Java mode as well).

Use it when you are sitting on top of, for example, an open curly  
brace for a function.  Emacs will then reformat the whole function.

I would also suggest doing "apropos" (usually hooked to Control-H a)  
c-indent

There is a whole bunch of ways to do it.  I find some of them work  
better than others (at least in older emacs versions)

Just in case you don't know... If you find a function that you like  
and want to see if it is connected to a key, do C-h, w.  You will be  
prompted for the function in the mini-buffer.  When you complete it  
and hit return, it will tell you all the places you can get to that  
function.

HTH,
Perry Smith ( pedz@easesoftware.com )
Ease Software, Inc. ( http://www.easesoftware.com )

Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems



[-- Attachment #1.2: Type: text/html, Size: 6932 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

  reply	other threads:[~2006-11-18 13:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-18  9:42 Formatting code text une
2006-11-18 13:37 ` Perry Smith [this message]
     [not found] <mailman.786.1163845620.2155.help-gnu-emacs@gnu.org>
2006-11-19 19:34 ` Stefan Monnier

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=DBA98950-455C-4907-84BC-14EE4544602E@easesoftware.com \
    --to=pedz@easesoftware.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.