Re: Code Formatting

From: Tomas Frydrych (tomas@frydrych.uklinux.net)
Date: Thu Jun 06 2002 - 05:56:21 EDT

  • Next message: Hubert Figuiere: "Re: commit HEAD: fix bug 3351"

    > Joaquin wrote:
    > (more than 1 year after
    > almost everybody still uses default emacs
    > indentation),

    I don't :-). The attached file contains an extract from my .emacs
    file, it matches the AW style fairly closely.

    Tomas


    ; the Emacs defaults associate *.h files with C-mode,
    ; I want it to be C++ mode
    (setcdr (assoc "\\.h\\'" auto-mode-alist) 'c++-mode)

    (defun my-c-mode-common-hook ()
    (define-key c-mode-base-map "\C-m" 'c-context-line-break)
    (set-variable 'c-basic-offset 4)
    (setq c-cleanup-list '(defun-close-semi))
    (c-set-offset 'case-label '+)
    (c-set-offset 'substatement '+)
    (c-set-offset 'statement-block-intro '+)
    (c-set-offset 'statement-case-intro '+)
    (c-set-offset 'defun-block-intro '+)
    (c-set-offset 'substatement-open 0)
    (c-set-offset 'cpp-macro [0])
    (c-set-offset 'member-init-intro '+)
    (c-set-offset 'member-init-cont '+)
    )

    (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

    ; this is my special version of save, which trims trailing whitespace
    ; later on it will get bound to C-xs (normally save with prompt, which is
    ; quite useless)
    (defun my-save-without-trailing ()
    (interactive)
    (delete-trailing-whitespace)
    (basic-save-buffer))

    (setq default-tab-width 4)

    (global-set-key "\C-xs" 'my-save-without-trailing)



    This archive was generated by hypermail 2.1.4 : Thu Jun 06 2002 - 05:58:13 EDT