Thread

  1. RE: [HACKERS] Source code format votes

    Peter Mount <petermount@it.maidstone.gov.uk> — 1999-12-24T08:56:08Z

    I'd prefer 8-space tabs, mainly because I have to set emacs to 4-space
    every time I enter a source file :-)
    
    Peter
    
    -- 
    Peter Mount
    Enterprise Support
    Maidstone Borough Council
    Any views stated are my own, and not those of Maidstone Borough Council.
    
    
    
    -----Original Message-----
    From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
    Sent: Thursday, December 23, 1999 9:41 PM
    To: PostgreSQL-development
    Subject: [HACKERS] Source code format votes
    
    
    OK I have:
    	
    	8-space tabs:	Tom Lane, Peter, Vince, Massimo
    	4-space tabs:   Bruce, Andreas
    	
    	open bracket on if () line -
    	yes:	Massimo, Peter
    	no:	Bruce
    
    
    More votes?
    
    -- 
      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
    
    ************
    
    
  2. Re: [HACKERS] Source code format votes

    Tom Lane <tgl@sss.pgh.pa.us> — 1999-12-24T15:06:36Z

    Peter Mount <petermount@it.maidstone.gov.uk> writes:
    > I'd prefer 8-space tabs, mainly because I have to set emacs to 4-space
    > every time I enter a source file :-)
    
    Not if you know how to configure Emacs properly ;-)
    
    You need to put two things in your ~/.emacs.  First you need a
    suitable mode-setting command, for which I use
    
    ; Cmd to set tab stops &etc for working with PostgreSQL code
    (defun pgsql-c-mode ()
      "Set PostgreSQL C indenting conventions in current buffer."
      (interactive)
      (c-mode)				; make sure major mode is right
      (setq tab-width 4)			; adjust to nonstandard tab width
      (c-set-style "bsd")			; indent conventions are BSD
      (c-set-offset 'case-label '+)		; except we indent case labels
    )
    
    Now the above can be invoked by hand, but Peter E. showed me the
    following trick for having it called automatically: add entries to your
    auto-mode-alist that match both the start and end of the pathname,
    so that pgsql-c-mode is automatically called for C files living in a
    particular region of your filesystem.  Mine looks like
    
    (setq auto-mode-alist
          (cons '("\\`/home/postgres/.*\\.[chyl]\\'" . pgsql-c-mode)
    	    (cons '("\\`/home/tgl/pgsql/.*\\.[chyl]\\'" . pgsql-c-mode)
    		  auto-mode-alist)))
    
    This has the effect of setting Pgsql mode automatically for any .c, .h,
    .y, or .l file underneath either /home/postgres/ or /home/tgl/pgsql/.
    Adjust to taste and never think about tabs again.
    
    BTW, Bruce suggested adding Local-variables settings to all the source
    files to push Emacs into making the right settings, but I much prefer
    doing it as above.  Local-variables is an insecure feature if you ask
    me; I keep it disabled.
    
    			regards, tom lane
    
    
  3. Re: [HACKERS] Source code format votes

    Bruce Momjian <pgman@candle.pha.pa.us> — 1999-12-24T16:24:06Z

    Current vote totals:
    
    (7)	8-space tabs:   Tom Lane, Peter E., Massimo, Jan, Hiroshi, Peter M.,
    			Michael
    (5)	4-space tabs:   Bruce, Andreas, Vince, Vadim, D'Arcy
    
          
    	open bracket on if () line -
    (5)	yes:    Massimo, Peter, Vince, Tom Lane, Peter M.
    (6)	no:     Bruce, Vadim, D'Arcy, Jan, Hiroshi, Michael M.
    
    
    -- 
      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
    
    
  4. Re: [HACKERS] Source code format votes

    Bruce Momjian <pgman@candle.pha.pa.us> — 1999-12-24T16:43:19Z

    > Peter Mount <petermount@it.maidstone.gov.uk> writes:
    > > I'd prefer 8-space tabs, mainly because I have to set emacs to 4-space
    > > every time I enter a source file :-)
    > 
    > Not if you know how to configure Emacs properly ;-)
    > 
    > You need to put two things in your ~/.emacs.  First you need a
    > suitable mode-setting command, for which I use
    > 
    > ; Cmd to set tab stops &etc for working with PostgreSQL code
    > (defun pgsql-c-mode ()
    >   "Set PostgreSQL C indenting conventions in current buffer."
    >   (interactive)
    >   (c-mode)				; make sure major mode is right
    >   (setq tab-width 4)			; adjust to nonstandard tab width
    >   (c-set-style "bsd")			; indent conventions are BSD
    >   (c-set-offset 'case-label '+)		; except we indent case labels
    > )
    > 
    > Now the above can be invoked by hand, but Peter E. showed me the
    > following trick for having it called automatically: add entries to your
    > auto-mode-alist that match both the start and end of the pathname,
    > so that pgsql-c-mode is automatically called for C files living in a
    > particular region of your filesystem.  Mine looks like
    > 
    > (setq auto-mode-alist
    >       (cons '("\\`/home/postgres/.*\\.[chyl]\\'" . pgsql-c-mode)
    > 	    (cons '("\\`/home/tgl/pgsql/.*\\.[chyl]\\'" . pgsql-c-mode)
    > 		  auto-mode-alist)))
    > 
    
    Developers FAQ updated with this macro.
    
    > This has the effect of setting Pgsql mode automatically for any .c, .h,
    > .y, or .l file underneath either /home/postgres/ or /home/tgl/pgsql/.
    > Adjust to taste and never think about tabs again.
    > 
    > BTW, Bruce suggested adding Local-variables settings to all the source
    > files to push Emacs into making the right settings, but I much prefer
    > doing it as above.  Local-variables is an insecure feature if you ask
    > me; I keep it disabled.
    
    OK.  I just know some developers added them on their own, so it
    certainly is an issue for them.
    
    Also, is there a way to add a dot-file in a directory to control default
    formatting, but still allow the main .emacs to be read?  .exrc is used
    for vi and it controls formatting for all files edited in that
    directory.
    
    -- 
      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
    
    
  5. Re: [HACKERS] Source code format votes

    Oleg Broytmann <phd@phd.russ.ru> — 1999-12-24T16:56:03Z

    D'Arcy,
    
       your signature fits here very well, I think...
    
    On Fri, 24 Dec 1999, Bruce Momjian wrote:
    > Current vote totals:
    > 
    > (7)	8-space tabs:   Tom Lane, Peter E., Massimo, Jan, Hiroshi, Peter M.,
    > 			Michael
    > (5)	4-space tabs:   Bruce, Andreas, Vince, Vadim, D'Arcy
    > 
    >       
    > 	open bracket on if () line -
    > (5)	yes:    Massimo, Peter, Vince, Tom Lane, Peter M.
    > (6)	no:     Bruce, Vadim, D'Arcy, Jan, Hiroshi, Michael M.
    
    Oleg.
    ---- 
        Oleg Broytmann     http://members.xoom.com/phd2/     phd2@earthling.net
               Programmers don't die, they just GOSUB without RETURN.
    
    
    
  6. Re: [HACKERS] Source code format votes

    Tom Lane <tgl@sss.pgh.pa.us> — 1999-12-24T17:21:30Z

    Bruce Momjian <pgman@candle.pha.pa.us> writes:
    >> BTW, Bruce suggested adding Local-variables settings to all the source
    >> files to push Emacs into making the right settings, but I much prefer
    >> doing it as above.  Local-variables is an insecure feature if you ask
    >> me; I keep it disabled.
    
    > OK.  I just know some developers added them on their own, so it
    > certainly is an issue for them.
    
    Yes, I notice Thomas has all of the .sgml files set up with
    Local-variables settings.  I think that adding a pgsql-sgml-mode
    along the same lines as I just illustrated would be a much better
    way of handling it.
    
    > Also, is there a way to add a dot-file in a directory to control default
    > formatting, but still allow the main .emacs to be read?
    
    I don't think so.  If there were, it'd have the same kinds of security
    risks as Local-variables has (visit someone else's file, auto-execute
    someone else's code ... not cool).
    
    			regards, tom lane
    
    
  7. Re: [HACKERS] Source code format votes

    Vince Vielhaber <vev@michvhf.com> — 1999-12-24T17:52:17Z

    On 24-Dec-99 Tom Lane wrote:
    > Bruce Momjian <pgman@candle.pha.pa.us> writes:
    >>> BTW, Bruce suggested adding Local-variables settings to all the source
    >>> files to push Emacs into making the right settings, but I much prefer
    >>> doing it as above.  Local-variables is an insecure feature if you ask
    >>> me; I keep it disabled.
    > 
    >> OK.  I just know some developers added them on their own, so it
    >> certainly is an issue for them.
    > 
    > Yes, I notice Thomas has all of the .sgml files set up with
    > Local-variables settings.  I think that adding a pgsql-sgml-mode
    > along the same lines as I just illustrated would be a much better
    > way of handling it.
    
    Umm..  That might've been me.  I reformatted all the sgml files last
    year and added the missing close tags.  I seem to recall having some
    problems with saving files and my preferences - too new to xemacs at
    the time.
    
    Vince.
    -- 
    ==========================================================================
    Vince Vielhaber -- KA8CSH    email: vev@michvhf.com    http://www.pop4.net
       128K ISDN: $24.95/mo or less - 56K Dialup: $17.95/mo or less at Pop4
            Online Campground Directory    http://www.camping-usa.com
           Online Giftshop Superstore    http://www.cloudninegifts.com
    ==========================================================================
    
    
    
    
  8. Re: [HACKERS] Source code format votes

    Thomas Lockhart <lockhart@alumni.caltech.edu> — 1999-12-24T19:05:46Z

    > >> OK.  I just know some developers added them on their own, so it
    > >> certainly is an issue for them.
    > > Yes, I notice Thomas has all of the .sgml files set up with
    > > Local-variables settings.  I think that adding a pgsql-sgml-mode
    > > along the same lines as I just illustrated would be a much better
    > > way of handling it.
    
    Yeah, probably. So far it hasn't been a problem for the large number
    of sgml doc writers (note heavy sarcasm ;)
    
    > Umm..  That might've been me.  I reformatted all the sgml files last
    > year and added the missing close tags.  I seem to recall having some
    > problems with saving files and my preferences - too new to xemacs at
    > the time.
    
    Nope, they've been there from the beginning...
    
                      - Thomas
    
    -- 
    Thomas Lockhart				lockhart@alumni.caltech.edu
    South Pasadena, California
    
    
  9. Re: [HACKERS] Source code format votes

    Marc G. Fournier <scrappy@hub.org> — 1999-12-25T02:15:12Z

    I'm indifferent on the tabs, but like seeing the open bracket on the if
    and else lines ...
    
    if {
    } else {
    }
    
    
    Marc G. Fournier                               scrappy@hub.org
    Systems Administrator @ hub.org                    
    scrappy@{postgresql|isc}.org                       ICQ#7615664
    
    On Fri, 24 Dec 1999, Bruce Momjian wrote:
    
    > Current vote totals:
    > 
    > (7)	8-space tabs:   Tom Lane, Peter E., Massimo, Jan, Hiroshi, Peter M.,
    > 			Michael
    > (5)	4-space tabs:   Bruce, Andreas, Vince, Vadim, D'Arcy
    > 
    >       
    > 	open bracket on if () line -
    > (5)	yes:    Massimo, Peter, Vince, Tom Lane, Peter M.
    > (6)	no:     Bruce, Vadim, D'Arcy, Jan, Hiroshi, Michael M.
    > 
    > 
    > -- 
    >   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
    > 
    > ************
    > 
    >