emacs question

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Postgres Hackers List <hackers(at)postgresql(dot)org>
Subject: emacs question
Date: 1999-12-03 16:54:21
Message-ID: 3847F5BD.EF522D7E@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sorry for the (slightly) off-topic question, but it *does* relate to
being able to use emacs for editing Postgres source files:

I'm trying to use emacs for more editing than I have previously (which
was restricted to Makefiles, lisp, and sgml). And I've got at least
two projects which have differing formatting requirements which also
differ from the emacs defaults.

I'm running into trouble trying to get the tab vs space stuff right.
For Postgres, I want to set the tabbing to 4 columns, and to preserve
tabs in the input and output. I think I can do that, with

(setq tab-width 4)
(setq standard-indent 4)

though I'm not sure that standard-indent needs to be adjusted at all.

For my other project, I need 2-column indents always space filled, so
no tabs allowed. It happens to be C++, so I can differentiate between
the C code for Postgres.

Anyway, the first complication was working through the fact that emacs
(20.4, if it matters) claims to have loaded "cc-mode" on startup, when
in fact the major mode is actually called "c++-mode" internally. So I
had a devil of a time setting the hooks.

But I'm also having trouble getting things to space-fill when
indenting. I've tried

(setq c++-mode-hook 'rtc-cc-mode)

(defun rtc-cc-mode ()
(setq tab-width 2)
(setq standard-indent 2)
(setq indent-tab-mode nil))

which gave me two-column tabs, but I had hoped that nil-ing
indent-tab-mode would space fill. untabify gets rid of the tabs in a
selected region, but the tabs come back if I hit the tab key. I've
tried nil-ing the other values and setting them to zero, but that
seems to revert the behavior to 8 column tabs.

My emacs book got me this far, but the behavior seems to be a bit at
odds with their description and they don't give a specific example
covering this. Any hints would be *greatly* appreciated.

TIA

- Thomas

--
Thomas Lockhart lockhart(at)alumni(dot)caltech(dot)edu
South Pasadena, California

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 1999-12-03 16:56:19 Re: [Fwd: postgresql-6.5.3. RPMs (Well Done!)]
Previous Message Lamar Owen 1999-12-03 16:51:59 Re: [HACKERS] postmaster.pid