[Ffmpeg-devel] Re: [PATCH] fix DV encoder VLC bit accounting

Måns Rullgård mru
Wed Feb 22 22:10:54 CET 2006


Diego Biurrun <diego at biurrun.de> writes:

> On Wed, Feb 22, 2006 at 02:19:36PM -0500, Dan Maas wrote:
>> 
>> > also note that the patch is full of tabs and cosmetical changes ...
>> 
>> Can you send me the emacs settings to produce clean code? (I remember
>> seeing a coding standards document somewhere, but I can't find it atm).
>> I am working on some more substantial patches so I'd like to get this
>> right!
>
> Here's (part of) what I have in .emacs:
>
> (custom-set-variables '(show-trailing-whitespace t))
> (setq-default indent-tabs-mode nil)

If you don't want to use those setting globally (other projects have
other standards), you can do this:

(defun match-alist (str list)
  (let ((head (car list)))
    (while (and (equal (string-match (car head) str) nil)
		(setq list (cdr list))
		(setq head (car list))))
    (and list (cdr head))))

(c-add-style "ffmpeg" '("k&r" (c-basic-offset . 4) (indent-tabs-mode . nil)))
(c-add-style "linux" '("k&r" (c-basic-offset . 8) (indent-tabs-mode . t)))

(setq c-file-style-alist '(("/linux.*/" . "linux")
			   ("/ffmpeg/" . "notabs")))

(defun fixup-c-style ()
  (let (file style)
    (and (setq file (buffer-file-name))
	 (setq style (match-alist file c-file-style-alist))
	 (c-set-style style t))))

(add-hook 'c-mode-hook 'fixup-c-style)

This switch to the proper settings whenever you open a file with
"ffmpeg" or "linux" anywhere in the pathname.

If any Lisp gurus on this list know a better way of doing this, give a
shout.

-- 
M?ns Rullg?rd
mru at inprovide.com





More information about the ffmpeg-devel mailing list