Måns Rullgård <[email protected]> writes: > > Harming emacs users is bad enough. It is not the Unix way to force > things on people.
The things that I suggested to force are anyway forced in the project, using 4 spaces for indentation and k&r style doesn't seem something that everyone should have freedom about. If it breakes something to someone we can see how to make the users settings override the default settings, it's not that hard. But as it is this patch I really don't see what problems it might cause. I also added something for asm, the asm-mode by default is pretty stupid and this is the workaround to indent by 4, gas-mode or asm86 are probably more powerful...
>From 4df190257d3d2c0e33e1724376cbbb69e9dbba16 Mon Sep 17 00:00:00 2001 From: Andrea Crotti <[email protected]> Date: Mon, 25 Apr 2011 16:58:30 +0200 Subject: [PATCH] Set style for c and asm indentation --- .dir-locals.el | 22 ++++++++++++++++++++++ .elisp.el | 31 +++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 0 deletions(-) create mode 100644 .dir-locals.el create mode 100644 .elisp.el diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000..0a2a893 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,22 @@ +((nil . + ((eval . (when (not (fboundp 'libav-pre-cleanup-buffer)) + (load-file ".elisp.el"))) + (eval . + (when (file-exists-p ".custom.el") + (load-file ".custom.el"))))) + (c-mode . + ((compile-command . (concat "make -k " (getenv "MAKEOPTS"))) + (c-basic-offset . 4) + (indent-tabs-mode . nil) + ;; sentinel variable + (libav-c-mode . t) + (c-indentation-style . "k&r"))) + + (asm-mode . + ((tab-width . 4) + (tab-stop-list . '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80)) + (indent-tabs-mode . nil)))) + +;; evaluate this line or add it to your .emacs to recompile the whole +;; project with only one key +;; (global-set-key [f5] 'recompile) diff --git a/.elisp.el b/.elisp.el new file mode 100644 index 0000000..fa31e1a --- /dev/null +++ b/.elisp.el @@ -0,0 +1,31 @@ +(setq libav-c-mode nil) + +(defun libav-untabify-buffer () + "Remove tabs from the buffer" + (interactive) + (untabify (point-min) (point-max))) + +(defun libav-indent-buffer () + "Reindent the whole buffer" + (interactive) + (indent-region (point-min) (point-max))) + +(defun libav-cleanup-buffer () + "Clean whitespace status" + (interactive) + (when libav-c-mode + (message "Cleaning up whitespaces") + (libav-indent-buffer) + (libav-untabify-buffer) + (delete-trailing-whitespace))) + +(defun libav-pre-cleanup-buffer () + "Clean the whitespaces and set it to read-only if the buffer was changed" + (libav-cleanup-buffer) + (when (buffer-modified-p) + (message "File modified, setting it to read-only, change it back to read-write after committing the white-space changes") + (toggle-read-only))) + +;; uncomment this to enable automatic space cleanup when visiting and before saving +;; (add-hook 'find-file-hook 'libav-pre-cleanup-buffer) +;; (add-hook 'before-save-hook 'libav-cleanup-buffer) -- 1.7.1
_______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
