[mythtv-users] Emacs mode for myth coding std?

Daniel Kristjansson danielk at cuymedia.net
Mon Jul 7 18:36:53 UTC 2008


On Mon, 2008-07-07 at 14:06 -0400, manu wrote:
> 	Hi all,
> sorry for the dumb question but I have messed around different modes in 
> emacs to get one that does mimic the coding standards of mythtv with no 
> luck so far.
> I need to generate relatively large diffs so I dont want indent 
> problems to get also in the way.
> Could someone point me in the right direction.
> Thx
> Bye
> Manu

If you can improve on the stuff below, please share :)

(setq inhibit-splash-screen t)

(defconst myth-c-style
  '((c-basic-offset . 4)
    (tab-width . 20)
    (indent-tabs-mode . nil)
    (c-comment-only-line-offset . 0)
    (c-hanging-braces-alist     . ((substatement-open before after)))
    (c-offsets-alist . ((topmost-intro        . 0)
			(substatement         . +)
			(substatement-open    . 0)
			(case-label           . +)
			(access-label         . -)
			(inclass              . ++)
			(inline-open          . 0)
			))
  )
)

(c-add-style "myth" myth-c-style nil)

(add-hook 'c-mode-common-hook
	  (function
	   (lambda ()
	     (c-set-style "myth")
	     )
	   )
)
(add-hook 'cc-mode-common-hook
	  (function
	   (lambda ()
	     (c-set-style "myth")
	     )
	   )
)
(add-hook 'c++-mode-common-hook
	  (function
	   (lambda ()
	     (c-set-style "myth")
	     )
	   )
)

(defun mythstyle () "doc string" (interactive) (c-set-style "myth"))

(global-set-key "\M-m" 'mythstyle)
(line-number-mode t)
(column-number-mode t)
(global-font-lock-mode t)




More information about the mythtv-users mailing list