tab to spaces + indent - continued

tab to spaces + indent - continued

Post by Gali Diaman » Thu, 05 Mar 1998 04:00:00



Thanks to everyone who bothered to answer my questions. I still have a
few, though...

I edit my c code in cc-mode.

I managed, using (c-set-offset 'substatement-open 0), to indent the for,
if, etc. statements. I still have a problem when indenting lines like this:

Try
    {
        ....
    }

Where "Try" is a c macro.
How do I tell emacs to keep the braces in the same column as the "Try"?

The second question is about saving tabs as spaces. I'd like to have tabs
when editing the files, but have them saved as spaces. I bound c-mode to
"tabify" and write-file to "untabify", so it was almost solved. I still
have a problem, since this removes all tabs even in not-c files, and
is problematic (especially with makefiles). Can I bind tabify/untabify to
opening/writing files in c-mode only? How?

A more general question - when I tried configuring the offsets, I easily
found the list of parameters I can assign values to. But how do I know
which parameter controls what behavior? Is there a list anywhere? apropos
and info did not help much. Can you learn this, or will it take years
until I finally know what to do :)

Thanks,
Gali

**Please email me off-list if possible, thanks.

-----------------------------------------------------------------------

"This universe is way too fun to have been random..."   -- Jim

 
 
 

tab to spaces + indent - continued

Post by Kai Grossjohan » Thu, 05 Mar 1998 04:00:00


Quote:>>>>> On Wed, 4 Mar 1998, Gali Diamant said:

  Gali> How do I tell emacs to keep the braces in the same column as
  Gali> the "Try"?

Go to the line with the `{' and type C-c C-o, then follow the prompts.

  Gali> The second question is about saving tabs as spaces. I'd like
  Gali> to have tabs when editing the files, but have them saved as
  Gali> spaces. I bound c-mode to "tabify" and write-file to
  Gali> "untabify", so it was almost solved. I still have a problem,
  Gali> since this removes all tabs even in not-c files, and is
  Gali> problematic (especially with makefiles). Can I bind
  Gali> tabify/untabify to opening/writing files in c-mode only? How?

See the variable local-write-file-hooks.

  Gali> A more general question - when I tried configuring the
  Gali> offsets, I easily found the list of parameters I can assign
  Gali> values to. But how do I know which parameter controls what
  Gali> behavior? Is there a list anywhere? apropos and info did not
  Gali> help much. Can you learn this, or will it take years until I
  Gali> finally know what to do :)

C-c C-o is described in the CC mode info file.

kai
--
Every country gets the pop music it deserves. -- Guildo Horn

 
 
 

tab to spaces + indent - continued

Post by Tim Christia » Thu, 05 Mar 1998 04:00:00



> The second question is about saving tabs as spaces. I'd like to have tabs
> when editing the files, but have them saved as spaces.

Do you *really* want tab chars in your buffer, or do you just want to
be able to hit tab and have it move over that many spaces? Maybe I'm
missing something in your question, but the statement below added to
~/.emacs seemed to solve the problem for me without adding hooks.  I
can hit tab, and the point gets bumped over that many spaces (but no
tab char is actually entered). From what I read, setq-default makes
that the default for all modes, so you may want to do it locally,
instead?

; Don't insert tabs when indenting
(setq-default indent-tabs-mode nil)

Hope that helps,
Tim.

--
http://www.cas.unt.edu/~tim

 
 
 

1. indent with tab instead of spaces

hi newsgroup,

today my colleagues decided to use tabs instead of spaces to indent. i'm
the only one who uses xemacs and do not want to change.

so my question: how do i tell my xemacs [version 21.4; April 2001] to
use one tab-char instead of two spaces to indent in php-mode (i think
that this mode is a kind of c-mode)

thanks in advance,
--
mac

real email-adress: mac clondiag com

2. BACK FILL ::: SQL Developer/Admin !! Corning, NY !! 1+ year.

3. Space insted of Tab indent

4. extracting files from .EXE resource...

5. how to make emacs indent using tab instead of spaces

6. HOWTO: Uploading new DJGPP stuff

7. Use tab instead of space in indent

8. AD error

9. Spaces to Tabs for Indenting?

10. tab to spaces + indent questions

11. Tabs to spaces and regular expression searching for tabs

12. c-indent-continue-inside-parentheses?

13. Need help with either indent-tabs-mode and tab stop list