1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- (load-file "<YOUR-PATH-TO-CURL>/tools/curl-style.el")
- (add-hook 'c-mode-common-hook 'curl-c-mode-common-hook)
- (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-mood-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))))
- (add-hook 'c-mode-common-hook 'my-style-selective-mode-hook-function)
- (add-hook 'my-style-selective-mode-hook
- '((string-match "curl" (buffer-file-name)) . curl-c-mode-common-hook))
- (add-hook 'my-style-selective-mode-hook
- '((string-match "other" (buffer-file-name)) . other-c-mode-common-hook))
- (add-hook 'my-style-selective-mode-hook '(t . my-c-mode-common-hook) t)
|