List:Internals« Previous MessageNext Message »
From:Tor Didriksen Date:June 17 2009 12:40pm
Subject:Emacs settings for the MySql coding style.
View as plain text  
The emacs settings suggested in
http://forge.mysql.com/wiki/MySQL_Internals_Coding_Guidelines
don't follow the indentation guidelines.
"For indentation use space; do not use the tab (\t) character."
however: the elisp code explicitly sets tabs, and tab width.

Here's a new suggestion from me.
I think we should add this as mysql-style.el somewhere in the source tree:
================
(c-add-style "MY"
  '("K&R"
      (c-basic-offset . 2)
      (c-comment-only-line-offset . 0)
      (c-offsets-alist . ((statement-block-intro . +)
                          (knr-argdecl-intro . 0)
                          (substatement-open . 0)
                          (label . -)
                          (statement-cont . +)
                          (arglist-intro .  
c-lineup-arglist-intro-after-paren)
                          (arglist-close . c-lineup-arglist)
                          (innamespace . 0)
                          (inline-open . 0)
                          ))
      ))

(defun mysql-c-mode-hook ()
   (interactive)
   (require 'cc-mode)
   (c-set-style "MY")
   (setq indent-tabs-mode nil)
   (setq comment-column 48))

(add-hook 'c-mode-common-hook 'mysql-c-mode-hook)
(provide 'mysql-style)
================

Note that I have added (inline-open . 0) which seems to be the current  
style.

Note that I have also added (innamespace . 0), that's a new suggestion  
 from me.

I also use add-hook rather than setq in case the user has his own hooks.

I removed the font-lock stuff, since that is really a user preference,
and can be quite a nuisance for people who have problems seeing colors.

As usual: comments are welcome.

-- didrik
Thread
Emacs settings for the MySql coding style.Tor Didriksen17 Jun
  • Re: Emacs settings for the MySql coding style.Konstantin Osipov17 Jun
    • Re: Emacs settings for the MySql coding style.Tor Didriksen17 Jun
      • Re: Emacs settings for the MySql coding style.Paul DuBois17 Jun
  • Re: Emacs settings for the MySql coding style.Vladimir Shebordaev17 Jun
Re: Emacs settings for the MySql coding style.Konstantin Osipov17 Jun
  • Re: Emacs settings for the MySql coding style.Tor Didriksen17 Jun
    • Re: Emacs settings for the MySql coding style.Michael Widenius19 Jun