From a37e43cfba630cea456eb57cb8818de500f70431 Mon Sep 17 00:00:00 2001 From: Tomer Shalev Date: Thu, 18 Feb 2010 23:32:08 +0000 Subject: Move sample.emacs to utils/editors git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24762 a1c6a512-1295-4272-9138-f99709370657 --- tools/sample.emacs | 44 -------------------------------------------- utils/editors/sample.emacs | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 44 deletions(-) delete mode 100644 tools/sample.emacs create mode 100644 utils/editors/sample.emacs diff --git a/tools/sample.emacs b/tools/sample.emacs deleted file mode 100644 index decf5b94a5..0000000000 --- a/tools/sample.emacs +++ /dev/null @@ -1,44 +0,0 @@ -;; $Id$ -*- emacs-lisp -*- - -;; Here's a sample .emacs file that might help you along the way. - -;; First comes a setup that is ideal when you are only working with -;; rockbox. Just select the next few lines, paste it into your .emacs -;; and change the path to the tools folder. (If you are using more -;; than one style. Look further down the this file.) - -(load-file "/tools/rockbox-style.el") -(add-hook 'c-mode-common-hook 'rockbox-c-mode-common-hook) - -;; If you are using more than one style in maybe more than one project -;; the example below might help out. It uses a predicate hook pair to -;; select the right hook to use. - -(defvar my-style-selective-mode-hook nil - "Holds a list of predicate and hooks pairs. (list (PREDICATE . HOOK) -...) It is used by my-mode-selective-mode-hook-function for choosing -the right hook to run.") - -(defun my-style-selective-mode-hook-function () - "Run each PREDICATE in `my-style-selective-mode-hook' to see if the -HOOK in the pair should be executed. If the PREDICATE evaluate to non -nil HOOK is executed and the rest of the hooks are ignored." - (let ((h my-style-selective-mode-hook)) - (while (not (eval (caar h))) - (setq h (cdr h))) - (funcall (cdar h)))) - -;;; Example configuration. -;; Add the selective hook to the c-mode-common-hook -(add-hook 'c-mode-common-hook 'my-style-selective-mode-hook-function) - -;; Add your own hooks and predicates. The predicate should evaluate to -;; non nil if the hook in the pair is supposed to be evaluated. In the -;; example a part of the path is used to select what style to -;; use. Choose what is appropriate for you. -(add-hook 'my-style-selective-mode-hook - '((string-match "rockbox" (buffer-file-name)) . rockbox-c-mode-common-hook)) -(add-hook 'my-style-selective-mode-hook - '((string-match "other" (buffer-file-name)) . other-c-mode-common-hook)) -;; Make sure the default style is appended. -(add-hook 'my-style-selective-mode-hook '(t . my-c-mode-common-hook) t) diff --git a/utils/editors/sample.emacs b/utils/editors/sample.emacs new file mode 100644 index 0000000000..decf5b94a5 --- /dev/null +++ b/utils/editors/sample.emacs @@ -0,0 +1,44 @@ +;; $Id$ -*- emacs-lisp -*- + +;; Here's a sample .emacs file that might help you along the way. + +;; First comes a setup that is ideal when you are only working with +;; rockbox. Just select the next few lines, paste it into your .emacs +;; and change the path to the tools folder. (If you are using more +;; than one style. Look further down the this file.) + +(load-file "/tools/rockbox-style.el") +(add-hook 'c-mode-common-hook 'rockbox-c-mode-common-hook) + +;; If you are using more than one style in maybe more than one project +;; the example below might help out. It uses a predicate hook pair to +;; select the right hook to use. + +(defvar my-style-selective-mode-hook nil + "Holds a list of predicate and hooks pairs. (list (PREDICATE . HOOK) +...) It is used by my-mode-selective-mode-hook-function for choosing +the right hook to run.") + +(defun my-style-selective-mode-hook-function () + "Run each PREDICATE in `my-style-selective-mode-hook' to see if the +HOOK in the pair should be executed. If the PREDICATE evaluate to non +nil HOOK is executed and the rest of the hooks are ignored." + (let ((h my-style-selective-mode-hook)) + (while (not (eval (caar h))) + (setq h (cdr h))) + (funcall (cdar h)))) + +;;; Example configuration. +;; Add the selective hook to the c-mode-common-hook +(add-hook 'c-mode-common-hook 'my-style-selective-mode-hook-function) + +;; Add your own hooks and predicates. The predicate should evaluate to +;; non nil if the hook in the pair is supposed to be evaluated. In the +;; example a part of the path is used to select what style to +;; use. Choose what is appropriate for you. +(add-hook 'my-style-selective-mode-hook + '((string-match "rockbox" (buffer-file-name)) . rockbox-c-mode-common-hook)) +(add-hook 'my-style-selective-mode-hook + '((string-match "other" (buffer-file-name)) . other-c-mode-common-hook)) +;; Make sure the default style is appended. +(add-hook 'my-style-selective-mode-hook '(t . my-c-mode-common-hook) t) -- cgit v1.2.3