Fixed ftp support with uClibc due to differing inet_ntoa_r() behaviour.
[platform/upstream/curl.git] / sample.emacs
1 ;; $Id$ -*- emacs-lisp -*-
2
3 ;; This file was contributed by Mats Lidell
4
5 ;; Here's a sample .emacs file that might help you along the way.
6
7 ;; First comes a setup that is ideal when you are only working with curl. Just
8 ;; select the next few lines, paste it into your .emacs and change the path to
9 ;; the tools folder. (If you are using more than one style. Look further down
10 ;; this file.)
11
12 (load-file "<YOUR-PATH-TO-CURL>/curl-style.el")
13 (add-hook 'c-mode-common-hook 'curl-c-mode-common-hook)
14
15 ;; If you are using more than one style in maybe more than one project the
16 ;; example below might help out. It uses a predicate hook pair to select the
17 ;; right hook to use.
18
19 (defvar my-style-selective-mode-hook nil
20   "Holds a list of predicate and hooks pairs. (list (PREDICATE . HOOK)
21 ...) It is used by my-mode-selective-mood-hook-function for choosing
22 the right hook to run.")
23
24 (defun my-style-selective-mode-hook-function ()
25   "Run each PREDICATE in `my-style-selective-mode-hook' to see if the 
26 HOOK in the pair should be executed. If the PREDICATE evaluate to non
27 nil HOOK is executed and the rest of the hooks are ignored."
28   (let ((h my-style-selective-mode-hook))
29     (while (not (eval (caar h)))
30       (setq h (cdr h)))
31     (funcall (cdar h))))
32
33 ;;; Example configuration.
34 ;; Add the selective hook to the c-mode-common-hook
35 (add-hook 'c-mode-common-hook 'my-style-selective-mode-hook-function)
36
37 ;; Add your own hooks and predicates. The predicate should evaluate to
38 ;; non nil if the hook in the pair is supposed to be evaluated. In the
39 ;; example a part of the path is used to select what style to
40 ;; use. Choose what is appropriate for you.
41 (add-hook 'my-style-selective-mode-hook 
42           '((string-match "curl" (buffer-file-name)) . curl-c-mode-common-hook))
43 (add-hook 'my-style-selective-mode-hook 
44           '((string-match "other" (buffer-file-name)) . other-c-mode-common-hook))
45 ;; Make sure the default style is appended.
46 (add-hook 'my-style-selective-mode-hook '(t . my-c-mode-common-hook) t)