Thread

  1. Re: [HACKERS] Indent

    Tom Lane <tgl@sss.pgh.pa.us> — 1999-11-11T02:03:21Z

    Bernard Frankpitt <frankpit@pop.dn.net> writes:
    > I have the following lines in my .emacs file
    > ;;; Set tab-width in c-mode to 4 spaces
    > (add-hook 'c-mode-hook
    >         (function (lambda () (set tab-width 4))))
    > I think that there are some other small differences between emacs c-mode
    > formatting and the indent formatting that PostgreSQL uses, but the
    > 8-space tab is the only one that I have fixed.
    
    I think I've mentioned this before, but I have the following function
    for adapting emacs to the Postgres code-formatting conventions:
    
    ; Cmd to set tab stops &etc for working with PostgreSQL code
    (defun pgsql-mode ()
      "Set PostgreSQL C indenting conventions in current buffer."
      (interactive)
      (c-mode)				; ensure we're in electric-C mode
      (setq tab-width 4)
      (c-set-style "bsd")
      (c-set-offset 'case-label '+)
    )
    
    Currently I invoke this command by hand when looking at a Postgres file.
    I've been meaning to set up a load-time hook to invoke it automatically
    upon visiting a .c or .h file within my ~postgres directory tree, but
    haven't got round to that yet.
    
    As far as I've noticed, the only significant shortcoming of this mode
    definition is that it doesn't know that "foreach" should be treated as a
    block-beginning keyword.  This is also fixable with a little elisp
    hacking, but that hasn't got to the top of the to-do list either.  For
    now I just remember to manually unindent the "{" right below "foreach",
    and then it carries on correctly for the rest of the block.
    
    ObFlameBait: Personally I think we should switch over to standard
    8-column tabs, but Bruce is apparently still using some medieval editor
    in which physical tab widths dictate logical indent levels :-(
    
    			regards, tom lane
    
    
  2. Re: [HACKERS] Indent

    Bruce Momjian <maillist@candle.pha.pa.us> — 1999-11-11T02:30:47Z

    > ObFlameBait: Personally I think we should switch over to standard
    > 8-column tabs, but Bruce is apparently still using some medieval editor
    > in which physical tab widths dictate logical indent levels :-(
    
    Vadim is also in agreement on this.  Not many editors can handle
    cases where tab size is different from indent size.  Emacs obviously
    can, and Tom has enjoyed pointing out.  :-)
    
    I am willing to re-open the discussion if we people would prefer
    something else.
    
    -- 
      Bruce Momjian                        |  http://www.op.net/~candle
      maillist@candle.pha.pa.us            |  (610) 853-3000
      +  If your life is a hard drive,     |  830 Blythe Avenue
      +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
    
    
  3. Re: [HACKERS] Indent

    Peter Eisentraut <e99re41@docs.uu.se> — 1999-11-11T15:37:47Z

    On Wed, 10 Nov 1999, Bruce Momjian wrote:
    
    > > ObFlameBait: Personally I think we should switch over to standard
    > > 8-column tabs, but Bruce is apparently still using some medieval editor
    > > in which physical tab widths dictate logical indent levels :-(
    > 
    > Vadim is also in agreement on this.  Not many editors can handle
    > cases where tab size is different from indent size.  Emacs obviously
    > can, and Tom has enjoyed pointing out.  :-)
    > 
    > I am willing to re-open the discussion if we people would prefer
    > something else.
    
    Trying to redefine a tab to be 4 spaces is asking for trouble. How about
    making pgindent replace 8 spaces with a tab and 4 spaces with, well, 4
    spaces. This is how emacs handles bsd indent style if you don't change the
    tab sizes. And all other editors should be fine with this.
    
    Personally, I'm always in favour of using no tabs at all, because of this
    very problem, and just because they annoy me. But I tend to be alone with
    that position.
    
    -- 
    Peter Eisentraut                  Sernanders vaeg 10:115
    peter_e@gmx.net                   75262 Uppsala
    http://yi.org/peter-e/            Sweden
    
    
    
  4. Re: [HACKERS] Indent

    Theo Kramer <theo@flame.co.za> — 1999-11-11T19:53:31Z

    Peter Eisentraut wrote:
    > Personally, I'm always in favour of using no tabs at all, because of this
    > very problem, and just because they annoy me. But I tend to be alone with
    > that position.
    
    No you are not :). Twenty odd years of software development have taught me
    to remove the tab key from my keyboard. Two spaces do the trick for me and
    try to avoid at all costs lines over 80 cols. (I use emacs in vi[per] mode),
    even on win98... Oh how I wish we were back in the days of TECO.
    --------
    Regards
    Theo
    
    
  5. Re: [HACKERS] Indent

    Don Baccus <dhogaza@pacifier.com> — 1999-11-11T23:16:15Z

    At 09:53 PM 11/11/99 +0200, Theo Kramer wrote:
    >Peter Eisentraut wrote:
    >> Personally, I'm always in favour of using no tabs at all, because of this
    >> very problem, and just because they annoy me. But I tend to be alone with
    >> that position.
    >
    >No you are not :). Twenty odd years of software development have taught me
    >to remove the tab key from my keyboard. Two spaces do the trick for me and
    >try to avoid at all costs lines over 80 cols. (I use emacs in vi[per] mode),
    >even on win98... Oh how I wish we were back in the days of TECO.
    
    TECO!  If you were to dig up a copy of the original manual for
    Dec's OS/8 TECO, you'd see a reference to me on the first page.  Not
    by name, but by organization, for having done the first version.
    
    Sheesh, those where old days.
    
    Anyway, I too avoid tabs.  Life's too short to figure out how to
    make all the tools I use tab the way I want them to.
    
    
    
    - Don Baccus, Portland OR <dhogaza@pacifier.com>
      Nature photos, on-line guides, Pacific Northwest
      Rare Bird Alert Service and other goodies at
      http://donb.photo.net.