1 ;;;; Emacs Lisp help for writing curl code. ;;;;
3 ;;; The curl hacker's C conventions.
4 ;;; See the sample.emacs file on how this file can be made to take
5 ;;; effect automatically when editing curl source files.
9 (c-comment-only-line-offset . 0)
10 (c-hanging-braces-alist . ((substatement-open before after)))
11 (c-offsets-alist . ((topmost-intro . 0)
12 (topmost-intro-cont . 0)
14 (substatement-open . 0)
15 (statement-case-intro . +)
16 (statement-case-open . 0)
20 "Curl C Programming Style")
22 (defun curl-code-cleanup ()
25 (untabify (point-min) (point-max))
26 (delete-trailing-whitespace)
29 ;; Customizations for all of c-mode, c++-mode, and objc-mode
30 (defun curl-c-mode-common-hook ()
32 ;; add curl style and set it for the current buffer
33 (c-add-style "curl" curl-c-style t)
35 indent-tabs-mode nil ; Use spaces. Not tabs.
37 c-font-lock-extra-types (append '("bool" "CURL" "CURLcode" "ssize_t" "size_t" "curl_socklen_t" "fd_set" "time_t" "curl_off_t" "curl_socket_t" "in_addr_t" "CURLSHcode" "CURLMcode" "Curl_addrinfo"))
39 ;; keybindings for C, C++, and Objective-C. We can put these in
40 ;; c-mode-base-map because of inheritance ...
41 (define-key c-mode-base-map "\M-q" 'c-fill-paragraph)
42 (define-key c-mode-base-map "\M-m" 'curl-code-cleanup)
43 (setq c-recognize-knr-p nil)
44 ;;; (add-hook 'write-file-hooks 'delete-trailing-whitespace t)
45 (setq show-trailing-whitespace t)
48 ;; Set this is in your .emacs if you want to use the c-mode-hook as
49 ;; defined here right out of the box.
50 ; (add-hook 'c-mode-common-hook 'curl-c-mode-common-hook)